Questions tagged [python]

Python is a general-purpose, dynamically typed, object-oriented high-level programming language. Interpreters for versions 3.x and 2.x come installed on the Raspberry Pi's most popular operating system distributions.

Filter by
Sorted by
Tagged with
1 vote
0 answers
91 views

Thonny Python while loop - output "flashing"

I have a test program I am working on. I am using a Raspberry Pi 4B running Thonny Python controlling an HT16K33 LED Driver via I2C. My code right now is simple: import board import time from ...
Chris Wren's user avatar
2 votes
0 answers
609 views

pigpio Python Raspberry Pi wave PWM generation

I am using pigpio to generate a PWM signal varying in time. I create a wave, which contains one period of a sine wave, in the form of PWM signal. I use wave_send_using_mode and WAVE_MODE_REPEAT_SYNC ...
kubajed's user avatar
  • 21
1 vote
0 answers
453 views

Raspberry Pi and OpenCV. The cv2.error while capture the image through camera lens

https://stackoverflow.com/questions/43572387/error-215-size-width0-size-height0-occurred-when-attempting-to-display-a I have the similar issue with this discussion, after I read it still don't have ...
44 chuang's user avatar
  • 133
1 vote
1 answer
128 views

Measurement in realtime Raspberry Pi 3

I have written a script in python in my Raspberry Pi 3, to get and plot data in real-time from an ADC. The problem is that the data is not time accurate. I want my data to be read once per second or ...
lesandromarteniz's user avatar
1 vote
1 answer
2k views

Could not build wheels for opencv-python which use PEP 517 and cannot be installed directly

I'm trying to install opencv on a raspberryPI 4 (RaspberryPI OS Bullseye x64, Python 9), that is part of installing all the dependencies for this tutorial but it always fails with the error below. I ...
Zmur's user avatar
  • 111
1 vote
1 answer
1k views

Trouble using Tensorflow: SyntaxError

I'm trying to use the LSTM neural network found here on my Raspberry Pi 4 Model B https://machinelearningmastery.com/text-generation-lstm-recurrent-neural-networks-python-keras/ I have trouble running ...
delgado's user avatar
  • 23
2 votes
0 answers
35 views

Moisture sensor gives weird results when connected to a relay

I was about to review the items as faulty when I connected my brain and made a second test. The sensor is supposed to return 0 when dry and 1 when wet. In my script I repeat the reading 100 times. I ...
Lorenzo's user avatar
  • 21
1 vote
0 answers
171 views

RuntimeWarning: GPIO.setup(pin_rst,GPIO.OUT)

My python script was executed in the past 10 days without issues. I had to do some troubleshooting to find what is causing the problem. Here is part of my code where the issue is caused: from mfrc522 ...
Maria's user avatar
  • 11
1 vote
0 answers
152 views

Is there any sound card or ADC for Raspberry Pi 4 available in the market?

The currently used sound card is "HIFIBERRY DAC+ ADC", I want to use the ADC function to recover the "modulated carrier signal (PSK, FSK)", because the "gnuradio" block ...
user19104274's user avatar
1 vote
0 answers
116 views

Adding LUTs and film grain overlays to raspicam

learning python and such by coding and building a camera using the High Quality Camera. Being able to code physical inputs to control the various camera functions was a major win for me, so I don’t ...
Dana's user avatar
  • 119
1 vote
1 answer
345 views

How do I take in recurring snaps from MLX90640 Thermal Camera?

I'm using an MLX90640 Thermal Camera and I got it to work after some time through a Raspberry Pi. What I am trying to do however is take in a picture every minute (or every few minutes) from what it ...
ceilowens's user avatar
0 votes
0 answers
108 views

PIR Sensor Triggering Script Doesnt Loop

I'm using trying to create a living portrait that triggers by motion. The idea is a pi4b connected to a lcd monitor that displays a picture. On motion the picture kicks over to video and morphs. Its a ...
stargazerdood's user avatar
0 votes
1 answer
883 views

Can't install PyBluez2 on Raspbian

Title - I can't install pybluez2: bluetooth/linux/bluez/btmodule.c:20:10: fatal error: btmodule.h: No such file or directory 20 | #include "btmodule.h" | ^~~~~~~~~~~~ ...
Standard's user avatar
  • 113
0 votes
1 answer
765 views

Why am I getting this syntax error in micropython?

I am testing the raspberry pi pico, and am getting a strange syntax error. I have no idea why. from time import sleep led = Pin(25, Pin.OUT) wait = 0.1 while True for x in range(9) wait += ...
Sad Man's user avatar
1 vote
1 answer
371 views

Rasperry Pi 4 - Python i2c Device Not Found

I'm having a hard time setting up a i2c device on a pi4. I did i2cdetect -y 1 But when I run the python code import board import busio import adafruit_ads1x15.ads1115 as ADS i2c = busio.I2C(board....
Jith's user avatar
  • 13
0 votes
1 answer
135 views

pigpio I2C error

I would like to write 16 bits of data to an I2C bus. Considering that the data to be transferred is not in a list, I am using the pi.i2c_write_device() function, however I get the following error: ...
user49706's user avatar
1 vote
1 answer
287 views

RpiZero and RpiPico communication through nrf24l01 not receiving packages

I am trying to implement a wireless communication between RpiZero and RpiPico through NRF24l01 modules. Pico is the receiver, and Zero is the transmitter. I have successfully started the Pico ...
Antifa's user avatar
  • 141
0 votes
1 answer
1k views

pyserial and parity check

I am using pyserial library to deal with serial communications between my CM4 and a particular device. This are my settings: _baudrate = 9600 _parity=serial.PARITY_EVEN _stopbits=serial.STOPBITS_ONE ...
otuga's user avatar
  • 11
0 votes
1 answer
171 views

Seeking help with my python loop - a basic MAX7219 8 Digit Seven Segment Display Module driver for a Pico W

I am trying to send serial data to a MAX7219 8 Digit Seven Segment Display Module from a Pico W. I can blank the display or make every last LED light up but nothing else. I cannot currently see what I ...
Matthew Brown aka Lord Matt's user avatar
0 votes
1 answer
929 views

monitoring two serial ports simultaneously

For my project I need two serial ports and I need to monitor both and act accordingly. Example of what I need to do: Port A and Port B Monitor all the time Port A and when message is received, I need ...
otuga's user avatar
  • 11
1 vote
1 answer
1k views

libgpiod read value Operation not permitted

Trying to read the values from gpio chips in a Python script using the gpiod python module. When calling get_value() we are getting "Operation not permitted". Have tried running the python ...
DJViking's user avatar
  • 111
0 votes
2 answers
311 views

python cv2 module not found when triggered by crontab

My python script imports cv2, and it works fine when I start the script manually. If I set the script to launch on boot (either via crontab, or via a .desktop file (in the user/.config/autostart/...
Matt Welander's user avatar
0 votes
2 answers
476 views

Unable to Use Nala Package Manager DietPi

I have a fresh installation of DietPi on a RPi 3 Model B. Also, I understand Nala package manager can provide better details about packages, optimize the mirrors, and even install multiple packages ...
Joel G's user avatar
  • 7
0 votes
1 answer
726 views

Record audio whilst pressing a button in scipy

I am trying to make wedding guest answer phone for my sister. The basic idea of these things is you pick up the handset, hear a message from the host, leave you own, replace the handset, and the ...
hieronopro's user avatar
-2 votes
1 answer
190 views

Running python script at reboot

On a headless raspberry pi I want to run a python script at reboot which continuous to run using tmux. From time to time I connect via ssh to get the data my python script collects. All works fine ...
Bastian's user avatar
0 votes
0 answers
95 views

How can I figure out my Python code with Kivy and Raspberry Pi GPIO?

I try to add actionbar to all screenmanagers in Kivy 2.1.0. I found some solution to my problem but I added some more features like GPIO pinout from Raspberry Pi. Here is a solution without gpio. I ...
yottabyte's user avatar
1 vote
3 answers
364 views

Run py script on boot

--------- LAST UPDATE ---------- I moved on to a different question since I had not accurately spotted the problem. The problem is that cv2 module can not be found when the script is triggered either ...
Matt Welander's user avatar
0 votes
2 answers
550 views

How to simultaneously control over 200 GPIO pins while maintaining timing accuracy

I am currently using a raspberry pi zero, which I connect directly to my computer via usb. I have connected eight MCP23017 GPIO expander chips, which is the maximum amount you can connect to a single ...
Yes's user avatar
  • 169
-1 votes
1 answer
52 views

Can't get the correct serial response between Raspberrypi 4 and Pico

I'm trying to make a little connection between both my Raspberry pi 4 and my Pico. Everything was ok until the pico suddenly stoped recieving what I'm sending from the Raspberrypi. Expected Outcome I ...
mr.xed's user avatar
  • 21
2 votes
1 answer
82 views

How to open PI for network traffic on a schedule [closed]

In an attempt to reduce risk to an IOT device I'd like it to enable wifi on a schedule, say only between 00:00 and 00:03 every day. Only just enough to upload a log file to my server, and then disable ...
Matt Welander's user avatar
0 votes
0 answers
82 views

DHT22 RPi Zero W Accuracy not matching Arduino

I am trying to use my Raspberry Pi Zero W for an IoT project. I want to read the temperature of a room. I have the DHT22 sensor (the blue 3 pin one that has the resistors soldered onto the pcb). I ...
zealotben's user avatar
1 vote
0 answers
246 views

Running Python Selenium script on Raspberry Pi auto start

i have a big problem with running selenium script which opens chromium browser and shows some dashboards in Tableau from auto start. I am using Raspberry Pi 4 with newest Raspbian from their webpage. ...
Przemek's user avatar
  • 11
0 votes
0 answers
132 views

PyQt QSoundEffect not working on Pi 4B

I am having a perplexing difficulty, in that I cannot get my PyQt program to produce any sound. I am able to get sound correctly from the Pi over HDMI using speaker-test and paplay, so I am happy ...
Christi's user avatar
  • 210
0 votes
1 answer
356 views

i2c clock speed is varying depending on used resource

I am having problems with my i2c bus speed on a Raspberry Pi 4. My Sensor requires clock stretching, which I set according to [these instructions (https://pypi.org/project/scd30/) When I check the bus ...
shoj's user avatar
  • 1
0 votes
1 answer
107 views

Pass serial port readings on RPi to remote for automated testing

The objective of my current RaspberryPi test setup is to read from/write to hardware, and constantly monitor the state/log message stream for test scenarios. The testing code runs on the RPi, and ...
m4ng0o's user avatar
  • 9
1 vote
1 answer
89 views

Using the microUSB Port over the 4 pin for Neo-6M GPS Module on Raspberry PI

Just a quick question, what is the difference between using the microUSB port over the 4 pins for data input for the Neo-6m gps module by ublox? or for any other sensor. Does this affect the current/...
Ijaz Ahmed's user avatar
0 votes
0 answers
211 views

python script does not start at boot

I follow this blog to the t to start a python script on startup. (Rasperi pi4B OS 64bit) my launcher.sh works fine she trying sh launcher.sh the file looks like: cd /home/pi/Documents PYTHONPATH=/home/...
Towlie's user avatar
  • 3
0 votes
1 answer
137 views

launcher.sh behaves differently @reboot than calling with sh

I was send here from Stackoverflow. Thank you for your help. I am using a launcher.sh for a raspberrypi 4B with Raspi os x64 to start a python script in a python env on startup. But setting the ...
Towlie's user avatar
  • 3
0 votes
0 answers
522 views

Can I use the PI Camera Stream in Python on a PC and use OPENCV?

So I got a Raspberry Pi with the Pi camera and I would like to use the camera with OpenCV in Python. The problem is, I know I can do this easily on the Pi itself but I highly doubt the Pi will be able ...
Clement S's user avatar
1 vote
2 answers
220 views

Can't get Cron to run python script

I'm trying to set up porkbun dynamic dns python script to run at reboot via Cron (later I'd like to run it hourly, but baby steps...) following porkbun's tutorial https://www.youtube.com/watch?v=...
APEX's user avatar
  • 11
0 votes
0 answers
112 views

Interrupt Exception in thread Thread-1: and I2C read failed using pigpio

im writing a sensor program with python 3 that has a GUI and if the accelerometer detects motions it goes into an interrupt routine and saves and plots the data for a specific timeframe. Now onto the ...
Xenoshell's user avatar
2 votes
0 answers
75 views

HQ camera hanging after gpu_mem is increased

I just recently got a Raspberry Pi HQ camera and wanted to operate it using a python script. I initially tried to take full resolution pictures using the default gpu_mem=128, but the program crashed ...
PMM's user avatar
  • 131
2 votes
2 answers
116 views

In what way can I connect my two Raspberry-Pi to a INA219 sensor at once using GPIO? This is more of a hardware question/ No Code was used

I am trying to figure out how to connect a INA219 sensor to two Raspberry Pi's. I am currently using 4 wires that connect the main Raspberry Pi and the INA219 sensor. There is no code, I am connecting ...
WhisperingSupreme's user avatar
-1 votes
2 answers
135 views

How to set PWM to actual 0

I am controlling a stepper motor using PWM on a RPi 4 and python. The motor has a controller/driver (BLDC-8015A) that accepts 0-3.3V to set the rotational speed. According to the documentation, this ...
user7408924's user avatar
1 vote
2 answers
977 views

What model of Raspberry Pi is good for a local web server?

I need some useful information about running a local web server in a Raspberry Pi and the best embedded system that can handle my device. What do I mean? Well I've created a website using django + ...
Amirhosseinzibaei's user avatar
-1 votes
2 answers
807 views

How to control (angle specific) a continous 360degree servo?

I want to control a "Servo motor analoog Micro Servo 9g SG90 360°/continous rotation" with a python script. I do understand the control of a 180° servo but somehow the 360° is not reacting ...
Mart's user avatar
  • 1
0 votes
1 answer
839 views

How to get Python binding to recompiled libcamera?

I am trying to recompile libcamera, as I will be changing some stuff in it and I would therefore like to install it manually. The compilation and installation are successful, but I am not able to ...
arminveres's user avatar
0 votes
1 answer
319 views

Python script that set baud rate in raw

I need help for python script that set baud rate in raw. Because on my raspberry after use sudo stty -F /dev/ttyUSB0 2400 raw and then reboot I lose baud rate and should execuse manually that command.
icedog's user avatar
  • 3
1 vote
1 answer
3k views

How to add libcamera to pyenv

I am running a pyenv with 3.10.5 for a RPi 4 b. RPi OS version if important: pi@raspberrypi:~ $ cat /etc/os-release PRETTY_NAME="Raspbian GNU/Linux 11 (bullseye)" ... The pyenv was simply ...
Boooke's user avatar
  • 11
1 vote
1 answer
171 views

Using I2C/SMBus with Sense HAT and Output stays the same

I have a problem while reading the my lsm9ds1 acceleratorsensor registers . It always displays the same values. My setup is a raspberry pi 4 and the sense HAT which has this sensor integrated. I dont ...
Xenoshell's user avatar

1 2 3
4
5
65