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.

687 questions with no upvoted or accepted answers
Filter by
Sorted by
Tagged with
2
votes
0answers
307 views

Latency on a Raspberry Pi camera

I'm making a flight controller and want to stabilize the x-y plane using optical flow, which requires almost instantaneous processing thus requires almost no latency. How much latency does the Pi ...
2
votes
0answers
5k views

Read Qr-Code from Raspberry Pi Camera in Browser with Flask

Im stuck with implementing a Qr-Code Scanner I found here: https://stackoverflow.com/questions/23538522/scanning-qr-code-via-zbar-and-raspicam-modul I already managed to set up the Raspberry Pi ...
2
votes
0answers
619 views

Failed to add edge detection runtime error

from gpiozero import Button btn = Button(4) while True: print("begin") btn.wait_for_press() print("Pressed") btn.wait_for_release() print("Released") This code worked at first but ...
2
votes
0answers
229 views

multiple DS18S20 temp sensors without using 1wire

Can anyone tell me if it is possible to connect the multiple DS18S20 sensors to different GPIO ports and pull the temperature on different ports, as opposed to a single wire option where I can only ...
2
votes
0answers
9k views

Connecting a bluetooth device in python using pybluez

wondering if anyone can help me with this. I'm very new to programming in general and am struggling getting my head around bluetooth. I have been trying to follow the examples given at http://people....
2
votes
0answers
570 views

Raspbian Reboot Hangs

Having a bit of a problem on Raspbian Jesse. I have 2 switches which I use to shut down and restart my raspberry pi. Python does an os.system ("sudo reboot") and os.system("sudo shutdown -h now") on ...
2
votes
0answers
719 views

Increase FPS PiCam in Multiprocessing

Currently, my system is only producing 10 FPS out of 20, which is my target. I'm barely hit 15 FPS in single grab-and-show simple code like this: from picamera.array import PiRGBArray from picamera ...
2
votes
0answers
775 views

ffmpeg on raspberry pi

Whenever I use ffmpeg inside a Python script using subprocess it doesn't work. Here is the code I am using: import subprocess subprocess.call('ffmpeg -f v4l2 -framerate 25 -video_size 640x480 -i /...
2
votes
0answers
311 views

Unexpected voltage drop on GPIO 16

I have written a sprinkler timer system (Python) for the Raspberry Pi 2B+. The Pi is connected to a 2 line LCD, 4 switch circuits, and an 8-way relay board with all 8 relays being used, and the 5V and ...
2
votes
0answers
2k views

Emulate a Bluetooth Keyboard with a Raspberry Pi 3

Raspberry Pi 2 Model B (Raspbian Wheezy and bluez 4.99) Executes perfectly using a Bluetooth dongle. Raspberry Pi 3 Model B (Raspbian Jessie and bluez 4.99) Attempting to pair with Windows laptop ...
2
votes
0answers
7k views

Using Python with Bluetooth on Raspberry Pi 3

Following this tutorial I successfully ran PiTooth on the RPi2MB (Wheezy). Following the same tutorial on the RPi3MB (Jessie) I get the following message "Could not configure bluetooth. Is ...
2
votes
0answers
408 views

Raspberry Pi Robotics: How to follow line?

I'm making a raspberry pi robot in Python and it moves, but it does not follow the line and I am using an infrared line sensor. I think that I have done everything properly. Here are some results by ...
2
votes
0answers
1k views

SpiDev - spi.xfer([xxx]) -> Invaild argument error -> what?

I got trouble with a seemingly dumb-proofly simple code: import time import pigpio import spidev DS = 17 STCP = 27 SHCP = 22 MR = 5 spi = spidev.SpiDev() spi.open(0, 0) spi.xfer([0b10011011]) ...
2
votes
0answers
756 views

Low-latency SPI for MCP 3008

So, I am using the SPI interface on the Pi 2 model B to communicate with a MCP 3008 ADC chip, following the tutorial on http://www.raspberrypi-spy.co.uk/2013/10/analogue-sensors-on-the-raspberry-pi-...
2
votes
1answer
216 views

Stepper Motor Not Responding. Wiring Issue?

I am following the tutorial: But I am using a pi t-cobbler and a Pi 2. I am also using the ULN2803 driver. When plugging a button into the appropriate gpio spots on the breadboard, I am able to run a ...
2
votes
0answers
995 views

OpenCV. Can't open video from usb camera on the screen

When I'm trying to start simple code, the frame opens and don't respond. import numpy as np import cv2 cap = cv2.VideoCapture(0) while(True): ret, frame = cap.read() cv2.imshow('AIR',frame) ...
2
votes
0answers
588 views

Error running a simple python script at boot

I am attempting to create a button on my Retro Pie emulator case (A gutted NES), using the old reset switch, to exit out the of current game and go back to the menu. Then I realized it just required ...
2
votes
0answers
120 views

GPIO goes high on first initial run of script - please help get my ECTO 1 on the road!

I am having a few problems with my script, on a fresh boot of my pi, the GPIO Port goes High and switches my relay when I run this script, however, it doesn't do it after I initially run the script, ...
2
votes
1answer
4k views

Different Frequencies with Piezo Buzzer - Python

I have a multiple choice question game, and I'm wondering how to hook up a piezo buzzer to make a sound when someone puts in an answer. Basically, I need two functions - a sound for when they get it ...
2
votes
1answer
260 views

Stream MP3 file from Ubuntu source to Raspberry Pi using Python

I am a newcomer to Linux and Python and I am trying to attempt to stream an audio file (preferably MP3) from a Ubuntu source computer to a Raspberry Pi running Raspbian for immediate playback. I ...
1
vote
2answers
63 views

BlueZ BTGATT-client.py WriteValue

I had a successful attempts with BlueZ-5.50 > test > example-gatt-client.py with ESP32 set as HeartRate Sensor Server.I am able to read from ESP32 which i modified to suit the BlueZ example. ...
1
vote
0answers
31 views

Python - run Flask webserver parallel from main code?

For the Raspberry Pi i am developing some home automation tools. At one side i have my main application that reads a CSV file, that consists of date+time entries with a GPIO port nr and a duration. My ...
1
vote
0answers
46 views

How to add 2 RFID readers to Raspberry PI 4

I managed to install 1 rfid reader following this link tutorial but i have no idea how to read with 2 and know from which one reads
1
vote
0answers
19 views

Data logger with SenseHat and timelapse Pi Camera code not running

I am trying to use a SenseHat and Pi camera to do some data logging. What I want my program to do is when run, it should collect sensor data and take a photo every 10 seconds. The issue that happens ...
1
vote
0answers
24 views

Multiple NFC PN532 Using I2C interface with Raspberry

At first im only using 1 NFC PN532 and libnfc as the library, but when im trying to connect it to 2 same devices, it still gives the same address which is 0x24(because of libnfc). Since controlling it ...
1
vote
1answer
54 views

Read Incoming Bluetooth Audio On Pi With Python

this is my first post on here! I am trying to make my raspberry pi 3 a bluetooth speaker which synchronizes beat of the music being played from a phone to an LED light strip. For the LED light ...
1
vote
0answers
12 views

Adafruit MPR121 - Read/write threshold value

Please could you help me to work out how to change the threshold on the MPR121 using circuit python? The code is here: https://github.com/adafruit/Adafruit_CircuitPython_MPR121 By editing the ...
1
vote
1answer
632 views

How can Rpi read the MAX30100 / MAX30102 Oximeter?

I want to connect the sensor max30100 to the Raspberry Pi board.I think everything is accurate.When I run the code, the red light flashes.I activated I2C.max30100 device address 0x57 is detected. When ...
1
vote
0answers
22 views

Comparison between Object Detection Solutions on Raspberry PI

I have only little experience with embedded systems. I have a Raspberry Pi 4 with 1gb RAM and a Camera Module v2.1 and want to do object detection and tracking on it. By best solution I mean a ...
1
vote
0answers
35 views

Does python sleep function affect GPIO output?

I am using a sensor with Raspberry pi to monitor a process (temperature) every second. I have an LED to indicate if the value is above 50 degrees. And the LED should remail ON for the next 10 seconds ...
1
vote
0answers
36 views

Pi4 RTS pin big delay

I am trying to use modbus with RS485 on my Pi4. I'm using modbus_tk with pySerial library, and I managed to get controllig RTS pin while transmitting data, but I cant get it running faster - when TX ...
1
vote
0answers
61 views

Raspberry pi 4 model b uart is unable to write

I got some questions about uart in raspberry pi 4 model b. I used to run my program in rpi 3 model b+, but everything went wrong when I tried to do the same thing on pi 4. First of all, each time I ...
1
vote
0answers
45 views

Raspberry Pi stops running cron job after a few hours

My raspberry pi 4 is set to run a python script every hour that turns on some philips hue lights and takes a picture with the camera module. It worked perfectly for 26 days, then it stopped running. ...
1
vote
0answers
26 views

pigpio: Read PWM from RCcontroller then send to ESC via GPIO

Im trying to learn Python by combining my interest in designing an AWD radio controlled car (3D printed, Im decent with Fusion 360 too) with some smarts from Pi/Python to allow things like software ...
1
vote
0answers
22 views

Different user login (same 'pi' username) depending on method

I'm just using putty and SSH'ing into a Raspberry Pi If I log in using the hostname "pi@raspberrypi" + password then I get one filesystem/folders. If I determine the Pi IP address using ifconfig,...
1
vote
0answers
24 views

Raspberry pi oled display

I have got a problem with Raspberry Pi and Oled display (128x32). Yesterday I tried and everything was OK, but today when I started working it didn't work. Raspberry Pi detecting i2c device. I'm using ...
1
vote
1answer
33 views

Python Tkinder Button

i have a promblem with GUI Tkinter, when i click the button of my gui enviroment the arm of my robot dont response more specific call the function but steal remaning in 0 degre``es from the other my ...
1
vote
0answers
29 views

Uart Communication pi to pi

I first connected two raspberry pi, one is Model 4B(transmitter) and another Model 3 B+(receiver) via Uart. Done all uart enable steps (sudo raspi-config>Interfacing Options>Serial>Serial Interface is ...
1
vote
0answers
38 views

Multiplexer and Python problem on Pi

So I've got a 16-to-1 multiplexer I'm using on the raspberry pi. Right now I've only got one motion sensor attached to it (on channel 15) to test it before i attach and fill up all 16 channels on it ...
1
vote
0answers
71 views

Overlay text to a playing video

My project will play a video on a Pi with some buttons attached to the GPIO. What I need is to pop up a menu in response to those buttons, ideally without pausing the video if it's playing. I've seen ...
1
vote
0answers
65 views

Connect the Raspebrry pi to WiFi from another device

Is there anyway to connect the raspberry pi to WiFi from another device like from a flask app? I know it's a crazy idea, without connecting to a network I cannot access flask app but I'm just ...
1
vote
0answers
38 views

Problem using MQTT: published message will publish but won't receive

I wrote this code for controlling gpio pins everything is ok but i cant turn on or off gpio pins message will publish but it will not turn on or off gpio pins import paho.mqtt.client as mqtt import ...
1
vote
0answers
46 views

How would I go about writing a program(python) to mimic the use of an AND Gate using Raspberry Pi

How I set up my breadboard: Placed SN74LS08N (AND gate) on a breadboard. Connected IC pin 7 to GND and IC pin 14 to 5 V for IC to get powered. Connected GPIO pin 16 to IC pin 13, Connected GPIO pin ...
1
vote
0answers
30 views

Combining programs dht11 and soil moisture sensor

Hey I'm doing a project and I need to combine programs of dht11 sensor and soil moisture sensor..but they're in different directories and their libraries also. I'm not able to run them simultaneously ...
1
vote
1answer
48 views

RFID RC522 Clone Script Unicode Error

I've set up a RC522 Card on my pi using This Tutorial and hacked together the Read.py and Write.py scripts into a Clone.py script: #!usr/bin/env python import RPi.GPIO as GPIO from mfrc522 import ...
1
vote
0answers
44 views

what's the best method to detect lane lines using raspberry pi?

i have a question about a project that im working on. im making a lane keeping assistant on a self driving car (im using a toy battery car that a kid can ride on) which requires me to detect the lane ...
1
vote
0answers
17 views

SOCK_STREAM issue with Raspberry Pi 4 as client in client/server test

I am trying a simple client/server Python socket program between my MacBook Pro and Raspberry Pi 4. This code is from Computer Networking: A Top Down Approach [Kurose, Ross]. Client: #!/usr/bin/...
1
vote
0answers
38 views

Communicating with TPI synthesizer using pyserial

I have a raspberry pi 3b+, and I am trying to communicated with a TPI synthesizer model 1001-B. I want to use Python and specifically the pyserial module to communicate with a serial port - i.e. the ...
1
vote
0answers
24 views

Enabling loop and interrupt

I am a complete novice and would like some help with simple code. I am using a Pi4 and learning Python to code. I need to create a loop that counts pulse inputs to a certain number then triggers an ...
1
vote
0answers
541 views

raspberry pi GPIO input value changing randomly

We attached a wire to pin 40 and another one to 3V3 supply. Also attached an LED+resistor between 5 volt and pin number 38. When the wires do not touch each other, the LED constantly emits and all the ...

1
2
3 4 5
14