We’re rewarding the question askers & reputations are being recalculated! Read more.

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.

652 questions with no upvoted or accepted answers
Filter by
Sorted by
Tagged with
2
votes
2answers
14k views

Raspberry PI GPIO not working

I just got a raspberry pi 3 B+ model and have wrote some scripts to create an LED pattern. Everything worked and then suddenly stopped. Now every time I run a python script through sudo python #...
2
votes
2answers
867 views

Problems with RFID-RC522 and Raspberry PI B

I'm trying to use the RFID-RC522 with my RPi. The script work but I dont get any response no matter how long or how many cards I use, the module is working because I tested with an Arduino. I use this ...
2
votes
0answers
279 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
1k 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 bluetoothd ...
2
votes
0answers
406 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
1answer
831 views

CWiiD doesn't detect wii remote but hcitool and blueman do

I have a raspberry pi 2 model B version 1 running raspbian that I am trying to get a Wii remote to work with. I have an Inateck Bluetooth 4.0 adapter plugged in to it and have CWiiD installed. When I ...
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
730 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
203 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
2answers
3k views

Python Serial library for RaspberryPi2 tutorial/command list

I have a problem with using the UART on RPi2. I tried every program found on the internet but nothing works. I checked every baud rate of my two BT modules but whatever code I use I've got errors ...
2
votes
0answers
968 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
585 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
119 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
2answers
115 views

How to connect ST7789 LCD to SPI Bus 1 as 2nd screen?

I've been trying to get this ST7789 library working with the 240x240 1.3" display on the rpi0w Python lib https://github.com/solinnovay/Python_ST7789 So far I've set all the screen pins to the bcm ...
2
votes
1answer
257 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
1answer
30 views

Sending a binary data stream to a GPIO at a certain frequency

I would like to send a random binary data sequence to a rpi GPIO at a particular frequency and then read the data stream off a scope. Is there a way of implementing this through python?
1
vote
0answers
102 views

How to connect ST7789 LCD to Raspberry Pi

I'm trying to connect to this LCD ( sry 4 japanese page:( use translate plz ) This monitor driver is ST7789, 7pins.[GND VCC SCL SDA RES DC BLK] And now I'm connecting to pi like this https://imgur....
1
vote
0answers
59 views

Raspberry Pi always reboots when trying to shutdown

I've been facing this issue for a long time and I haven't been able to find a working solution for it. I've found a few different posts online of people having the same issue but none of the solutions ...
1
vote
0answers
26 views

picamera incorrect buffer length

I am currently using a pi camera module to stream video using flask and at some point, it randomly crashes. I found a similar question over here and they say that clearing the stream helped them sort ...
1
vote
1answer
41 views

433mhz Status sockets project

I've been working on getting a Home automation project going for a while, using a Rasp pi 1b (26 pin header). This is a well trodden path by others, as it is a project to control status remote sockets:...
1
vote
0answers
26 views

Setting application screen display layer

I am displaying a video onscreen with omxplayer using '--l 0' Is it possible to run a python program and set it's screen layer to > 0 Expanded info :- I am running omxplayer from within a python ...
1
vote
0answers
27 views

I don't know why suddenly mjpg-streamer and webcam stop working

I have made a program that uses three webcams and three ultrasonic sensors using raspberry pi 3 and python 3. When each ultrasonic sensors detect stuff in front of them, webcam take a picture of it. ...
1
vote
0answers
50 views

Pi freezes when running a script

I'm trying to set up a trap camera using a brand new Pi Zero W with Raspbian Buster but it freezes when I run the python scirpt. originally the code was a bit complicated with multithreading, email ...
1
vote
0answers
35 views

picamera error the second time I run camera.capture(output,'yuv')

I'm getting an error the second time I run camera.capture(output,'yuv'), what am I doing wrong? my code: from time import sleep from picamera import PiCamera from picamera.array import PiYUVArray ...
1
vote
0answers
20 views

LED Strip on Raspberry Pi Check if its On - Neopixel

How can I check if the one pixel is on or not? Is there any function for that. I've googled but couldn't find anything helpful. import board import neopixel pixels = neopixel.NeoPixel(board.D18, 17) ...
1
vote
0answers
17 views

Is raspberry able to retrieve/store some n time prior a trigger with multiple cameras?

I came across a project idea which I think would demand a lot from a raspberry pi and arduino hardware capabilities. From my understanding, a master raspberry could be used to trigger n slaves through ...
1
vote
0answers
81 views

Use OBDII over WiFi

I think i've tried everything at this point, and nothing seems to work. I'm using an ELM327 WiFi Dongle, connected it to the Pi, created a socat using: sudo socat pty,link=/dev/ttyUSB0,waitslave tcp:...
1
vote
0answers
128 views

Develop a communicattion between a Raspberry with BLE server and a Raspberry with BLE client

I have been developing an small project which requieres a communication between two Raspberries, the first one acts as a Beacon and the second one tries to connect to that beacon and obtain the RSSI ...
1
vote
0answers
48 views

PiCamera vs VideoCapture

So I have a project that requires Computer Vision (video stream). But when I want to try my Pi Camera (not USB), there's two method that I can use. They are PiCamera.capture_continuous and cv2....
1
vote
0answers
22 views

Launch a python script in a lxterminal window using supervisord

I'm trying to launch a python script in a lxterminal window using supervisord. I'm stuck on using supervisord than a .desktop file. I'd like to keep the process running on loop Below is my config: [...
1
vote
0answers
33 views

PICamera white balance difference between preview and capture

Below is a screen shot of the preview and the captured image of the same scene taken from a single PICamera at the same time. As you can see the one on the left (the capture) is noticeably bluer than ...
1
vote
0answers
28 views

efficiency of python sleep function to set a raspi pin HIGH and pause the script

I am continuously measuring some parameters using Raspberry Pi. I am using Python. When the measured value is higher than a particular value, I want to set a GPIO pin high (for some LED indicator) and ...
1
vote
2answers
697 views

How can Rpi move a servo motor using a GPIO pin in PWM mode?

iam new to raspberry pi and i got an error while a running servo motor in my object detection script i need to run the servo whenever my if condition is true so the same pin run multiple times if ...
1
vote
1answer
672 views

Why is PIR motion Sensor always on?

I'm trying to make an alarm system but the motion sensor is always on as soon as the script is run. I've posted a question about a different problem i was having with this project so it'll confusing ...
1
vote
0answers
134 views

Mouse Control Function in Python for Raspbian

Does anyone tried to control mouse cursor position and click in Python application for Raspbian before? I am refering to this website: https://pyautogui.readthedocs.io/en/latest/mouse.html#mouse-...
1
vote
1answer
271 views

How to toggle button on and off with gpiozero?

I can't seem to find a solution of doing this using gpiozero. I've done it using rpi.gpio with add_event_detect and call back to change state but I was under the impression gpiozero is much simpler. ...
1
vote
0answers
18 views

Can I use the hostname of my Smart Plug in my Python script throughout different WiFis?

I have a Python script which retrieves the measured data from a smart plug so that I can visualize it on my Rasbperry Pi. This command gets the data send_hs_command("192.168.1.26", 9999, b'{"emeter":...
1
vote
0answers
20 views

Running mongodb as as service increases boot time by 30 seconds

Title says it all. I have an RPi 3 with Raspbian that has a web app running at start up in chromium. It took 20-30 seconds from powering on to the app appearing before I added mongo, and after I ...
1
vote
0answers
329 views

Error opening USB Cam with OpenCV4: GStreamer-CRITICAL **: gst_element_get_state: assertion 'GST_IS_ELEMENT (element)' failed

After installing OpenCV4.0 on my RPi, i tried a simple script below with a Logitech USB Cam (720p) but at "cam = cv2.VideoCapture(0)" it gives me an error "(python:num process): GStreamer-CRITICAL **: ...
1
vote
0answers
275 views

Getting Error: ImportError: No module named 'cv2' in Geany python editor

I'd finally installed OpenCV 4.1.0-dev in my raspberry pi with success, I checked that in Terminal by : pi@raspberrypi:~ $ python3 Python 3.5.3 (default, Sep 27 2018, 17:25:39) [GCC 6.3.0 20170516]...
1
vote
0answers
42 views

How to set access rights for lighttpd using python scripts (cgi) which uses temporary files

My problem is: I have a running lighttpd web server. The files are stored in \var\www, also a python script, which can be executed to get an image from the raspi camera. Every time the script is ...
1
vote
0answers
188 views

Multiple channel and multiple sound card

I need to do the following (if possible in Python): output at the same time on multiple USB sound card (cheap one you can find on Amazon) on the main audio file, I need to output temporary sound if ...
1
vote
0answers
84 views

Need help with Controlling WS2812B LEDS

I have made a 5 x 5 WS2812B RGB LED matrix to work with my raspberry pi. I'm trying to figure out how to run several tests from this tutorial: https://tutorials-raspberrypi.com/connect-control-...
1
vote
1answer
59 views

PIGPIO bit banging UART - SLR to plaintext

I've managed to read UART input by SLRO and SLR commands from pgpiod, however, SLR returns UART bit-banged data in the following format: [number of read bytes] [bytes] http://abyz.me.uk/rpi/pigpio/...
1
vote
0answers
165 views

Raspberry Pi/OBDII/Serial Communications over Bluetooth

Thanks for having a look at my post and my problem :) I'm presently developing an automotive on-board diagnostics scanner application in python3/wxPython. For the communications heavy lifting, I'm ...
1
vote
0answers
58 views

Issue with controlling GPIO via Flask web app

I am currently building a project in which I am using a Flask web app to control various different components with the pi's GPIO. The issue i am currently having is stopping the execution of code that ...
1
vote
1answer
113 views

Two stepper motors with python

I want to make a motorized rc paddle boat type machine for fun. I plan to use two stepper motors to spin two wheels on either side of the boat. I am controlling it with python. I have a master script ...
1
vote
1answer
51 views

Play a defined set of MP3's on defined days

am new to Python and have been struggling to create a workable script for a friends project - am hoping someone can point me in the right direction! The script is to control playback of mp3 files ...
1
vote
0answers
69 views

Supervisor config and certain python files

I need to start on boot and monitoring a python script with supervisor. The python script works when starting manually by sudo python getdata.py My scripy getdata.py executes subprocess.call(['bash',...