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
0 votes
1 answer
64 views

multiple GPIO.add_event_detect doesn't show encoder output

so i have 3 GPIO.add_event_detect's each one comes with callback function when only one GPIO.add_event_detect is enabled, it shows proper output but if i add 3 of them it doesn't show anything while i ...
user avatar
0 votes
0 answers
80 views

Remote i/o Error when trying to read a value of a MCP23017 GPIO Expander connected to a DRV8833 Motor driver

I have a MCP23017 GPIO Expander that I am using to control a DRV8833 Motor driver. I do this as following: from adafruit_mcp230xx.mcp23017 import MCP23017 i2c = busio.I2C(board.SCL, board.SDA) mcp = ...
user avatar
  • 151
1 vote
0 answers
71 views

SpiDev read from BMM150 Geomagnetic Sensor

I am completely new to this topic so please excuse my mistakes. I have this: https://www.mikroe.com/geomagnetic-click geomagnetic click with a BMM150 sensor with this datasheet: https://download....
user avatar
  • 11
0 votes
0 answers
58 views

How to calculate yaw using 10 DOF?

I've recently purchased the Waveshare 10 DOF IMU Sensor which also contains the IMU 9250 and the . I've wrote a simple code for calculating the roll and pitch of the device which works, but I can't ...
user avatar
0 votes
1 answer
204 views

Raspberry Pi H264 to HLS Stream

We need to use Raspberry Pi camera for 2 tasks. One is getting image, the other is watching camera remotely. Ways are getting RTSP from Raspberry Pi camera (which when I did it become difficult to ...
user avatar
0 votes
1 answer
372 views

Why is my python script stopping after 1 month?

I'm running three python scripts on a Pi 4 Model B. These scripts are ran from boot using the '.config/autostart function'. I have a batch script placed in 'autostart' which then in turn starts the ...
user avatar
  • 1
2 votes
1 answer
111 views

How to expose for longer than 1/3 of a second with PiCamera HQ using picamera?

I've used the script below to make some under/over exposures in low light levels using the PiCamera HQ and the picamera module. In order to get long exposure times I've found that the camera object ...
user avatar
  • 528
0 votes
0 answers
30 views

Prevent access to main toolbar when fullscreen TKinter application is running

I have a Tkinter application (for a client) on a Raspberry Pi, which runs in fullscreen mode. There is nothing wrong with the application itself, however, the main RPi toolbar (The toolbar with the ...
user avatar
  • 133
0 votes
0 answers
178 views

Send Audio to Android Device Over Bluetooth Programmatically

I'm hoping to use the Raspberry Pi as a Bluetooth microphone for an android device. The basic idea is to feed audio from a USB microphone to the Raspberry pi, remove background noise, and then send ...
user avatar
  • 1
1 vote
1 answer
488 views

Getting OSError: /lib/aarch64-linux-gnu/libgomp.so.1: cannot allocate memory in static TLS block on Raspberry Pi 4

I am trying to access the models/tf.py from the Yolov5 repository with the following command on my Raspberry Pi 4 and getting the following error: Command ran: python3 models/tf.py --weights yolov5s....
user avatar
0 votes
1 answer
51 views

How to run a python script that plays an audio using php?

recently I'm doing a small project, and a part of it involves running a python script using PHP. to explain further: Python: from playsound import playsound playsound("path/of/the/audio") ...
user avatar
0 votes
0 answers
112 views

Using same GPIO pins simultaneously from two Python scripts using RPi.GPIO

I have two different scripts. One is a Kivy app and another is a MQTT client script that subscribes to topics received from a web server. The same hardware connected to the GPIO pins can be used from ...
user avatar
2 votes
1 answer
152 views

Reassign GPIO pins for SPI (swap MOSI with SCK)

I had an adapter board made for a Raspberry Pi 4B and I somehow swapped the SPI clock and data lines on the board. Rather than redrawing and waiting for new adapter boards, is there a way to reassign ...
user avatar
0 votes
1 answer
283 views

How can I use pigpio to "sniff" and collect data exchanged along an existing USB connection between two devices?

A controller module (power supply) for piece of scientific equipment in our lab uses a Windows program on a PC for a human interface via USB connection. I have a list of the "set" and "...
user avatar
  • 528
2 votes
0 answers
157 views

High-speed USB Audio Streaming

I am using a Raspberry Pi 3B+ as the USB host for an embedded device that I have configured to appear as a USB Audio 2.0 compliant microphone. I am currently using PyAudio for opening and recording ...
user avatar
2 votes
2 answers
525 views

Connecting RC522 RFID module to Raspberry Pi 4

I connect my RC522 RFID module to my Raspberry Pi 4 according to https://pimylifeup.com/raspberry-pi-rfid-rc522/ so we have Write.py and Read.py: Write.py: #!/usr/bin/env python import RPi.GPIO as ...
user avatar
  • 35
0 votes
0 answers
147 views

Running python GUI application with PyQt and python-vlc as a service

I'm trying to run a python GUI application as a service. The application is using PyQt5 and python-vlc packages. I have the following service file: [Unit] Description="Python VLC Service Test&...
user avatar
  • 1
0 votes
0 answers
29 views

Control Raspberry Pi 3 with Hue App?

I have some Hue lamps in my room. In addition, I have replaced a light switch that turns normal ceiling lights on/off with a relay that I can control with a Raspberry via SSH (with a little Python ...
user avatar
  • 1
0 votes
2 answers
44 views

python code to read SMS not working when running under cron

I made a python code to read SMS from SIM800 module, that is connected to a Raspberry Pi Zero W, and it is working like a charm when I run it on a terminal or another IDE. Here is the expected result: ...
user avatar
0 votes
1 answer
161 views

How to print temperature on nextion screen

I am new to the topic of raspberry and sensors, I am doing a project with a raspberry pi 4 and a temperature sensor DS18B20, I created a small project in python to display the temperature in real time....
user avatar
  • 1
0 votes
1 answer
21 views

raspberry pi 4B speaker interval time

I want to make a raspberry pi 4B speaker using python. And I would like to use a loop to open the voice.mp3 file where different values are created over and over again. I tried to use the playsound ...
user avatar
1 vote
0 answers
14 views

No mouse or keyboard until password entered [closed]

I'm trying to secure a Pi, and one of the things I'm keen on implementing - if possible - is that whatever input that comes in via the USB ports goes nowhere unless it's a 6-digit password (or longer) ...
user avatar
  • 11
0 votes
0 answers
90 views

python3 i2c register write problem

I'm writing code to read a i2c pressure sensor's data using python3, do the math and print in the screen. The problem is that I need a faster measurement time. I read in the sensor's manual that I can ...
user avatar
0 votes
1 answer
70 views

How to control the output rating of Raspberry Pi Pico Micro Python

I'm new to the Raspberry Pi community and need to power a 1v motor however, I can not figure out how to output such power. Here is all of ,my code if you need it: from machine import Pin import time ...
user avatar
0 votes
1 answer
144 views

Hardcode RF Codes - RPi-RF

I would like to use the rpi-rf module https://pypi.org/project/rpi-rf/ for a remote control alert system, using a PIR motion sensor as the input. I have so far set up the PIR input and send and ...
user avatar
1 vote
1 answer
459 views

How do I use NumPy and Pandas in my virtual environment?

I'm using Raspberry 4 to host a web service with FastAPI. In my code, there's a dependency on Pandas. When I ran the web service, it gives me the error message below: File "/home/pi/Projects/...
user avatar
1 vote
1 answer
133 views

Thonny IDE different directory then terminal when running python file [closed]

I have a discord bot python file I am running and editing in Thonny IDE I get an error where it cannot find the specified directory, when I run the code for pi camera: camera.capture('./files/meeka....
user avatar
0 votes
1 answer
222 views

Read from RFID sensor using UART

I have a board for the RDM6300 which can read RFID tags. I could successfully test the board using an ESP32. Here is the micropython code: from machine import UART, Pin import time uart = UART(1, ...
user avatar
  • 814
-2 votes
1 answer
66 views

Why my code doesn't run when I reboot the raspberry?

So to start in what I tried. first this is the code that I wrote to run import subprocess import pyautogui import urllib.request import time while(1): x = str(pyautogui.position()) time.sleep(...
user avatar
-1 votes
1 answer
173 views

Install 64bit Python on Rapbian with aarch64 Kernel

I enabled the aarch64 kernel with arm_64bit=1 in /boot/config.txt on Raspbian. After that I tried to upgrade python to its 64-bit version. Fist with "apt upgrade" then with building python ...
user avatar
  • 1
0 votes
2 answers
258 views

Pi 4 not reading the QMC5883L magnetometer

I am trying to set up my magnetometer QMC5883L with my raspberry pi 4. But the pi is somehow not reading the magnetometer. I ran the command i2cdetect -y 1, but there is no detection. My connections ...
user avatar
0 votes
0 answers
98 views

Interfacing with a button module using 3x MCP23018 port expanders

I have recently picked up a keypad I wish to use in a Raspberry Pi project. It has an i2c interface, with 20 buttons, each with an LED backlight. The buttons/LED's are connected to 3x MCP23018 port ...
user avatar
  • 101
0 votes
0 answers
735 views

Failed building wheel for pandas on model 3B+

I'm trying to install pandas in a Python virtualenv on a RPi model 3B+, but its wheel fails to build. Pandas does however successfully build/install for the system Python (py3.7.3, pip 18.1). Could ...
user avatar
  • 101
0 votes
1 answer
27 views

Can a Raspberry Pi send a binary 1/0 to a VAV controller and which board is best for this?

My senior project is to take in webcam footage, determine the number of people in the room, and if there is more than 0 people in the room send an "on" signal to a VAV controller. I'm ...
user avatar
0 votes
0 answers
60 views

how do i pass php variable to python script

I want to php file that pass file name to python script. The python script will open that particular file. What i did: php file $filename = "stringfile"; $command = "python ...
user avatar
2 votes
1 answer
442 views

Pygame.mixer does not play sound when started in cron

I have written a small python script that plays a track after the press of a button (and ignores further button presses until the track has completed). The script works perfectly fine when started ...
user avatar
1 vote
0 answers
240 views

Thonny crashing…why?

I’m an amateur, but I’ve used raspberry pi’s and have code running on them 24/7 for several years now with no issues. My latest home automation project has a (Python) raspberry pi outdoors (in North ...
user avatar
-1 votes
1 answer
117 views

How to UNDO unwanted changes on my raspberry pi 4. Bash_profile not found

Updated Question. I was trying to add this directory "/usr/local/opt/python-3.9.0/bin" to PATH on raspberry pi 4 and so I edited the bash file by adding the line: PATH = "/usr/local/...
user avatar
0 votes
1 answer
101 views

OLED 128x128 is not displaying correctly the colors

I'm having trouble using the OLED SSD1351. I'm running python programs with the luma.oled library. When I run a program that uses colors, these are displayed incorrectly, red is displayed like blue, ...
user avatar
0 votes
0 answers
67 views

Simple Graphical Animated Canvas For Python on Raspberry Pi Zero

Is there any way to efficiently create an animated canvas with python? Required Ability to efficiently render 2D lines and shapes (lines, arcs, circles, ellipses, etc.) Ability to show the canvas ...
user avatar
0 votes
1 answer
45 views

Raspivid stdout hangs after random interval in Node and Python

Around 2 years ago, I made a simple server in Node.JS, running on a RPi Zero W, that started a raspivid process and captured MJPEG frames from the output. These were send to a website using a ...
user avatar
0 votes
1 answer
40 views

Pi to Pi communication using Python

I started a project where i want 2 Pis to exchange codes (numerical only) and i have read how it is possible with a additional server but can it be done without? specific usecase: RPI1 detects a value ...
user avatar
-1 votes
1 answer
109 views

python3 ModuleNotFoundError: No module named 'SpeechRecognition'

I am trying to use this module, but it always says that its not installed. I am trying to run the file with python3 and installed it with pip3. pip3 list shows it. No idea why it doesn't work. import ...
user avatar
-1 votes
2 answers
894 views

Communication Raspberry Pico and 3B+

I recently bought a Raspberry Pico to increase the capacities of my oldest Pi3B + tenfold in terms of sensors, buttons, LEDs, GPIO, etc. But I can not find for the moment any protocol or Bus allowing ...
user avatar
0 votes
2 answers
267 views

How to run python script at startup?

I've been all over the internet looking for a solution for this but everybody seems to have different answers and none of them work. I have a python script that emits audio through the headphone jack ...
user avatar
0 votes
1 answer
40 views

Raspberry SD goes “read-only”: programatically detect and correct?

I´ve been experiencing the sudden change in SD Cards installed in Raspberry PIs (3B+ mostly) that go read-only after a sudden loss of power. As I have to install these devices far away, running a ...
user avatar
  • 11
0 votes
0 answers
39 views

Error in autorun script, RASP 3

I need to run a script in lxterminal in boot. The unit is headless, just have a digital button to start the process in the code. I already have a automatic pi user loggin and a .desktop created in ...
user avatar
0 votes
0 answers
255 views

E: Unable to locate package python-gudev

This simple command: sudo apt-get install -y python-gudev is giving this error: Reading package lists... Done Building dependency tree Reading state information... Done E: Unable to locate package ...
user avatar
  • 125
0 votes
1 answer
223 views

How to reduce PiCamera capture time without reducing resolution

I'm currently writing a python script which needs to capture an image. I'm currently using PiCamera.capture() to accomplish this, but it takes too long to capture images. The project requires as high ...
user avatar
  • 375
1 vote
0 answers
197 views

Serial RS232 Raspberry FTDI chip USB to RS232

Circumstances I am running my Raspberry Pi 3 Model B+ with Raspberry Pi OS. I use a FTDI chip serial cable adapter USB to RS232. https://www.amazon.com.mx/gp/product/B081PP3ZM4/ref=...
user avatar

1
3 4
5
6 7
62