A message from our CEO about the future of Stack Overflow and Stack Exchange. Read now.

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
0answers
41 views

Multi process loop not working as expected

I am working on project where i interfaced two MCP4725 dac with my Pi for sending set point to my two PID device i.e (rpm pid and torque pid) at same time .So i used multi threading concept but i am ...
2
votes
0answers
32 views

Rotary Encoder not working properly

I'm using raspberry pi 4B 4GB. When I attach my encoder(model ENC-1-2-1-24) it works successfully. But, when I am in an industrial environment, the encoder gets noise. (No turning) I use pull-down ...
0
votes
0answers
29 views

Rpi4B python I2C MCP4725 IOError: [Errno 121] Remote I/O error

I am working with MCP4725. I was working on this quite some time without any issues but currently even the default example given in the GitHUb Repository keeps throwing this error. Press Ctrl-C to ...
0
votes
1answer
16 views

Start a pyhton script, which depends on I2S as soon as possible during the startup of my Raspberrypi

I have the following systemd service, which starts a systemd service as soon as I boot my raspberrypi: [Unit] Description=MyService DefaultDependencies=false [Service] Environment=SERVICE_HOME=/home/...
1
vote
0answers
31 views

Updating python version3.6 to python 3.8.1

currently, my raspberry pi runs python versions 2.7 and 3.6 [by default] and version 3.8.1 [I'm trying to update the current version] This causes a lot of trouble when I try to install a new package ...
2
votes
1answer
50 views

Relay does not turn off

I am trying to control a 4-Relay module with my Raspberry Pi 4. I tried to do that by writing this script: import RPi.GPIO as GPIO import time GPIO.setmode(GPIO.BOARD) relais_1 = 8 relais_2 = 10 ...
0
votes
0answers
15 views

NDVI calculation using Pi noir camera

I am an engineering student working on a project based on NDVI calculation to monitor the crop health. I used the PiNoIR camera with blue filter for my experiment in order to obtain the values of NIR ...
0
votes
0answers
13 views

Basic Python interface to use with UHF RFID reader?

I have a Chinese UHF RFID reader that I'm using with a RasPi for a warehouse tracking project and it came with only a Windows SDK. The dense protocol document they provided in very rough English is ...
1
vote
0answers
29 views

How to install Minecraft full version with Python support on a Pi 4?

After getting a new Pi 4 and launching Minecraft Pi Edition, I have to say it's extremely limited, lacking most of the features that make MC fun. Granted it's abandonware that never made it past alpha,...
1
vote
0answers
14 views

How to lock the gain in picamera.campture_sequence command?

I am using picamera library in python to capture a sequence of pictures. The picamera is connected to a microscope and the microscope moves to different vertical positions and picamera capture images ...
2
votes
1answer
40 views

How to control python code though web page

Currently I am working on a dual axis sun calibration device. Everything was going well so far but I made a huge mistake. Here is what I made so far. I wrote my code in Python 3.8. Libraries I used:...
1
vote
1answer
36 views

Picam stream video to multiple devices with proxy

I am trying to stream live video from a Pi to multiple devices. Since the Pi is connected to a WiFi with very bad signal, I would like it to only stream to one device (proxy-server). This device ...
0
votes
0answers
15 views

Printing out to 7" monitor for installation using textwrapper + console login

I am working on a project/installation that will be run on a 7" screen. At the moment the project selects a sentence from a txt file and then prints it out using a 'typewriter effect'. I am doing this ...
-1
votes
0answers
25 views

Is there a way to receive a 2D image from an ultrasonic sensor?

Is there a simple way to create some code that quickly creates images from readings of an ultrasonic sensor? Like, you can move it around and it shows what it "sees" on a screen.
1
vote
2answers
65 views

Use HC-SR04 Distance Sensor and Relay to trigger the Water Pump - Need help with triggering the pump

I am trying to trigger/stop a water pump with the use of a 4-channel relay and a UC-SR04 distance sensor. I tried with some codes but I think I am missing something because although there was no error ...
0
votes
1answer
43 views

How to hit the “run” button after starting up thonny automatically after boot to Desktop GUI

I try to hit the run button after opening the "thonny python ide" successfully with the following adjustments in /etc/xdg/lxsession/LXDE-pi/autostart @lxpanel --profile LXDE-pi @pcmanfm --desktop --...
0
votes
0answers
18 views

picamera.exe.PiCameraIOError: Failed to write 291840 bytes from buffer to output <picamera.stream.BufferIO object at 0x62f70c60>

Using the PiCamera Advanced Recipies in the link I am trying to capture the image to a numpy array. My code basic lines of code are. final_image = np.empty((height , width , 3), dtype=np.uint8) ...
2
votes
1answer
43 views

is it possible to get 12 bit(4096) resolution output from pi hardware pwm pin?

I want to produce 12 bit resolution from Pi hardware pwm pin for my project. Please help me to go in right way as I am new to both Python and Pi. import time import pigpio as pi import RPi.GPIO as g ...
1
vote
1answer
108 views

Raspberry pi line follower using camera

I want to create a two-wheeled line following robot. I want to use the camera to detect a black line for the car to follow. I have programmed the wheels so now I need to work on the line detection. I ...
-1
votes
0answers
28 views

Check WiFi Credentials from PHP API

I have put together a custom pi running raspbian that creates an access point if it can't connect to a wifi connection set within wpa_supplicant.conf. The mobile app connects to this connection and ...
1
vote
0answers
31 views

raspberry pi 3 spi issue

I connected MOSI to MISO on Raspberry PI 3 Executed the below code: import time import sys import spidev spi = spidev.SpiDev() spi.open(0,0) print(spi.bits_per_word) print(spi.mode) print(spi....
-2
votes
1answer
36 views

How to print list of availble networks and connect using python

I have been search for a couple of hours to find a a tutorial on how to show the list of available networks and connect to a network programmatically.I don't want to use command line. I have ...
1
vote
2answers
67 views

Multi-threaded python function using list and dictionary of GPIO pins cannot activate a relay problem

At the first part of the code(Initializing relays) the GPIO output works as expected, but at the second part it doesn't works, I have break my head for the last four hours trying to find out what is ...
0
votes
1answer
45 views

Connecting Multiple Raspberry Pi to One Laptop

I'm trying to use my laptop to instruct multiple raspberry pi's to take a picture simultaneously. I have a DHCP LAN network which connects to my laptop and raspberry pi through ethernet cables. I've ...
0
votes
0answers
24 views

How to concatenate multiple variables

I have three UV sensors - integers output; one BMW280 - float output (temperature and pressure); and one GPS Module - float output. I need to build a string in this form - #teamname;temperature;...
1
vote
0answers
24 views

Embedded Software on RPi - Operating System with only a browser and ability to run python

We're in the final stages of shipping a product using a Raspberry Pi as a general computer for embedded software. However, I want to find and set up an operating system that, instead of booting into ...
0
votes
0answers
35 views

How to configure the RaspberryPi-B1 RFID reader by Eccel?

I am trying to configure the B1 RFID hat on my raspberry pi since it is a cleaner solution than using a USB RFID reader. However I have ran into some issues. Firstly, the documentation supplied by ...
1
vote
1answer
75 views

Error Installing TensorFlow on Rasperry Pi 3 B

I'm following this guide to create an AI chatbot which requires Python 3.6, tensorflow etc. So I installed Python 3.6.8. To install TensorFlow I tried sudo pip install tensorflow I also downloaded ...
2
votes
1answer
46 views

5v/12v power source/submersible water pump/RPI/relay. What kind of combination is suitable?

I am using a 12v DC water pump with a 20 l/min flow rate, a raspberry pi 3B and a distance sensor. I would like to use a relay and an external power supply to control turning on/off the water pump. so ...
0
votes
0answers
70 views

Rock Pi and temperature sensor

I have Rock Pi 4 B 4GB. Kernel for now is: Linux rock 4.4.154-95-rockchip-gd2ab1f26e1b3 #1 SMP Mon Oct 21 06:42:35 UTC 2019 aarch64 aarch64 aarch64 GNU/Linux I also have DS18B20 temperature sensor ...
1
vote
0answers
29 views

“Attribute Error”- How to display data from distance sensor on lcd display?

I am trying to incorporate LCD display features with the codes that are already written for the sensor. "lcddriver.py" is in "lcd". "distance.py" contains codes for my distance sensor. This is the ...
-1
votes
1answer
43 views

Distance sensor with 16x2 lcd display- ImportError: cannot import name lcddriver

Happy new year. I am working on a personal project which involves a distance sensor and a LCD display. The distance sensor's data should ideally be displayed on the 16x2 LCD display. The codes for the ...
1
vote
0answers
19 views

How do I get a list of only bluetooth audio devices?

I'm currently using pexpect in python to use bluetoothctl. I can get a list of all bluetooth devices, but is there a way to narrow down the list to only audio devices (bluetooth speakers, headphones). ...
2
votes
1answer
99 views

Voice transmission through UART

I want to transmit real time voice signal recorded by usb MIC through uart using Raspberry pi 3b. But by using USB MIC it is not possible for me to transmit voice to uart directly without storing it. ...
0
votes
0answers
19 views

Cannot play audio through command line (“No available audio device”)

My end goal is to open an .mp3 file with either python or the command terminal. I have tried both pygame and mg123 After executing "mpg123 CarelessWhisper.mp3" into the terminal I get: High ...
1
vote
0answers
37 views

Problems Connecting to Bluetooth devices through python

I am trying to write a simple python script that connects any bluetooth audio device to the raspberry pi 4. I keep getting "bluetooth.btcommon.BluetoothError: (111, 'Connection refused')" Here is ...
0
votes
0answers
21 views

Raspberry Pi Sense HAT Error: Unorderable [sic] Types

I have recently attempted to complete a program for my Raspberry Pi, the purpose of which is to generate a grid of pixels with randomised colours for the Sense HAT, which possesses exactly 64 pixels. ...
1
vote
2answers
70 views

What is the best way to automate the generation of bootable SDcard images for Raspberry Pi projects?

For a new project, I plan to release ready-to-use bootable SDcard image files for various Raspberry Pi models (2, 3, Zero, Zero-W). The actual OS will be PiCore, the RAM-only Linux variant based on ...
0
votes
0answers
8 views

RPi alsaaudio.PCM works good for Python2.7.16 but not for Python3.7.3

I am new to audio related programming in RPi. Following code works well and playing sound from a wav file in Python2. import alsaaudio as aa output = aa.PCM(type=aa.PCM_PLAYBACK, mode=aa.PCM_NORMAL, ...
1
vote
0answers
60 views

Raspberry 3 model B v2 I2c slave, ESP8266 I2c master

I try to learn I2C with goal : read my ESP8266 events (I2C master) from my Raspberry 3 model B v2 (I2C slave). I use the Arduino Wire library on the ESP and python pigpio lib on the Raspberry. ...
0
votes
0answers
34 views

Adafruit Neopixel 60LED RGBW Strip showing up with wrong RGB color

We are currently using the Adafruit Neopixel RGBW 60 pixel LED strip with our project, and are currently trying to control it. The strip, however, is displaying incorrect colors when trying to ...
1
vote
0answers
22 views

How to produce audio for tensorflow object detection on the raspberry pi?

I'm trying to add audio output for Tensorflow object detection on the raspberry pi. For example, if it detects a person from the picamera, I'm trying to get the program to say "person". When I use the ...
1
vote
1answer
52 views

Cannot install OpenCV on Raspberry Pi 2

I've tried following this tutorial: https://www.learnopencv.com/install-opencv-4-on-raspberry-pi/ I installed a fresh copy of Raspbian Buster on the Raspberry Pi 2 before following the tutorial. It ...
2
votes
2answers
72 views

How can Rpi4B select multiple ADS1115 ADCs using PCA9546 / TCA9548A I2C multiplexer?

I have a PCA9546 i2c multiplexer hook to my raspberry pi under it are 4 ads1115 i2c ADC. My first main problem is how do you switch the address of the i2c in python the sample code that i have seems ...
1
vote
1answer
43 views

Bluetooth camera button key input data with Python Pynput?

I have a Raspberry Pi 3b+ setup that controls a robot. I am looking to control it using a small wireless bluetooth button. After much research I was able to get this button connected https://www....
1
vote
1answer
66 views

Unable to control and count RPM of 2 motors in single python code in raspberry pi

I'm trying to count rpm of dc and controlling its rpm using PID controller motor which I have done successfully in my code as shown below. But when I try to count RPM of 2 DC motors simultaneously in ...
2
votes
1answer
68 views

Pi based Radio Telescopes?

I'm interested in building a Raspberry Pi based radio astronomy telescope. I'm not too set on any particular science objectives, but rather just want to get some experience with the full system, learn ...
0
votes
0answers
22 views

GPIO push button popout webpage

I have a project that I connected a push button to RPi 4's GPIO, and if I push the button it writes out "Button pushed". I wrote this code in python. Now I want this code to run in a webpage. So I ...
1
vote
1answer
37 views

Raspberry PI random connection interruptions

i am running a raspberry pi B+ headless and losing network connection irregulary. I am living with that since a few years, but now want to fix the problem. What would be a good approach to find out ...
0
votes
0answers
22 views

Stuttering audio with PyAudio on raspberry pi zero

I'm writing some code that plays audio on a Raspberry Pi Zero while a button is pressed. When I test the code on my laptop, using mock pins to simulate button presses, the code below runs fine with no ...