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
3 votes
2 answers
7k views

Rpi to Arduino Serial UART Communication Tutorial

I'm trying to connect my Arduino to my Raspberry Pi using the GPIO pins. I understand that the Pi uses a 3.3V signal while the Arduino uses a 5V signal so I bought a bi-directional logic level ...
soapergem's user avatar
  • 139
2 votes
2 answers
4k views

Rpi GPIO Controlling 5V Relay Problem

I am working on a project that requires a camera analyzing some images and activating the appropriate GPIOs to control a relay board. I currently have a touchscreen display, a Raspberry Pi Cam ...
Sajid Khan's user avatar
6 votes
3 answers
15k views

Controlling Raspberry Pi GPIO with c and Python

I was searching for C and Python Libraries which support Pi4.
Milliways's user avatar
  • 58.6k
33 votes
10 answers
147k views

Running a Python script at startup

This question has been asked quite a few times before but I didn't seem to get it working using the existing information. My Pi runs Raspbian. I have a Python script named dnscheck.py which loops ...
Vlad Schnakovszki's user avatar
1 vote
2 answers
3k 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 ...
rah's user avatar
  • 11
4 votes
2 answers
4k views

How to use Rpi python to control PCM1802 24-bit HiFi stereo ADC and MAX4466 microphone amplifier

I want to get Analog Audio Input using a PCM1802 ADC Module and MAX4466 microphone module using python. It is actually a project for a very basic and introductory course about Arduino and AVR assembly ...
amir na's user avatar
  • 141
3 votes
1 answer
7k views

How can Rpi SPI python read the MFRC522 RFID / NFC module?

Trying to read my RFID MFRC522 using a Mifare blue tag and it is not working. Wondering if i could get any help on this as when i put the tag to read it doesn't show up as quick? using: https://...
627117717.pr's user avatar
22 votes
3 answers
34k views

Why are some GPIO pins HIGH when the Raspberry Pi boots up?

I have an easy circuit wired up, with an LED connected to pin 18 on the BOARD reference. I run a simple program to put pin 18 to HIGH, which turns the LED on, and then a couple of seconds later, I set ...
Viktor Raspberry's user avatar
4 votes
2 answers
3k views

How to set up dashboard for monitoring PI processes

I have PIs that use a schedule to play videos on loop. The PIs also use a daemon file 'surround.sh' to control the video player, and the daemon script allows the user to check the service status of ...
Kai's user avatar
  • 41
2 votes
2 answers
4k views

No methods for running python script on startup are working

I can not get my python file to start on startup. I've tried four different methods (below) and they all work in command line but none of them appear to run on start up. As an example, the file is ~...
Seph Reed's user avatar
  • 301
1 vote
2 answers
4k views

Rpi Neo-6M / Neo-8M GPS Module Setup / Fix / Update Problems

Hi i'm tryng to change the update rate of my gps tracker(neo 6m ublok) i know the byte that i need to send are 0xB5,0x62,0x06,0x08,0x06,0x00,0xC8,0x00,0x01,0x00,0x01,0x00,0xDE,0x6A i've tried echo -e &...
awaska's user avatar
  • 23
14 votes
1 answer
12k views

Raspberry pi GPIO input pins give random values

I've been playing a lot with the Raspberry Pi lately. But I have a problem. When I set up an input pin to check whether electricity is sent to it or not, it gives me rather unstable answers. A few ...
Gustaf's user avatar
  • 141
2 votes
4 answers
1k views

program my robot with python

initially my question was about how to fix my code. You informed me that usage of that python class will not work with my setup of one motor. I agree and I want to instead use the GPIO library to ...
thecanmanisback's user avatar
1 vote
1 answer
3k views

Rpi Python Serial Test Program

In Terminal its working but not working using python code. My Code: import serial from time import sleep ser = serial.Serial ("/dev/ttyS0") while True: received_data = ser.read() ...
Ragul Murugan's user avatar
1 vote
3 answers
2k views

Possible SPI issues around NRF24 operations post RPi system update?

I have a number of RPis that communicate with Arduinos via BLavery's lib_nrf24.py (which appears to be derived from Barraca's pynrf24). Recently several of the RPis automatically updated via apt-get ...
Ravingly Rabbit's user avatar
172 votes
1 answer
466k views

What is the difference between BOARD and BCM for GPIO pin numbering?

When using the RPi.GPIO library in Python you have to call import RPi.GPIO as GPIO and then GPIO.setmode(GPIO.BOARD) or GPIO.setmode(GPIO.BCM) What is the difference between these two options?
mirams's user avatar
  • 3,878
23 votes
7 answers
101k views

Raspberry Pi starting programs automatically on startup

I've built a wireless sensor network consisting of two Raspberry Pi's (runnnig Raspbian) with sensors on and a base station Raspberry Pi that collects the data. Each time I want to run the system I ...
Kersakov's user avatar
  • 415
13 votes
4 answers
22k views

How to boot into own python script (GUI) only?

I have the following problem: Using a RaspPi 3B running Raspbian Jessie (version 4.4.26-v7+) I would like the GUI of a self-written python script to be executed on startup. I know that this question ...
Fantilein1990's user avatar
1 vote
2 answers
6k views

Why is HC-SR501 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 ...
user avatar
13 votes
2 answers
25k views

Using OpenCV with RasPiCam and python

Has any one been able to get OpenCV to directly play video from the RasPiCam board using python? I've seen some projects involving workarounds, but what I'm interested in is being able to use the ...
Ryan's user avatar
  • 233
11 votes
2 answers
19k views

PiGPIO Library Example for Bit-Banging a UART

The PiGPIO library http://abyz.me.uk/rpi/pigpio/index.html mentions that one of it's features is "software serial links using any user gpio". I take this to mean that you can use it to generate a ...
PhilBot's user avatar
  • 371
10 votes
5 answers
37k views

gpio library on windows while developing

I am new to Python so maybe this is not an appropriate question. I am working on a project on Python that will use GPIO functionalities of the raspberry Pi. Right now, I am developing the python code ...
luisgepeto's user avatar
4 votes
1 answer
332 views

Pi Glow programming on python

After following the steps on this page. I did everything correctly and when I try to run the test.py file it says this. Traceback (most recent call last) : File "test.py" , line 9, in <module&...
user3140092's user avatar
4 votes
3 answers
9k views

Multiple GPIO Buttons vs Matrix Keypad

I've seen a tutorial here that shows me how to do this: But what I want to do is like this: I want to have multiple buttons and distinguish between them. The graphic I painted depicts the desired ...
user96931's user avatar
  • 729
3 votes
3 answers
6k views

I am getting ghosting/bouncing on my digital input

I am meassuring data pulses from my electrical meter, giving me one pulse per Watt used. I have 4 electrical meters connected to my Raspberry Pi model B. I have connected them directly like this (no ...
Beauvais's user avatar
  • 275
3 votes
2 answers
1k views

execute Python file on Systemstart

I want to run a simple python script like: import webbrowser webbrowser.open('http://google.com/', new=2) when the startup progress of my RPI 4 is finished. I tried something like "[How to run a ...
Soam.P's user avatar
  • 57
3 votes
5 answers
20k views

UART problems on my Pi3

I am trying to send and receive radio signals using my Raspberry, but I am already stuck at the first step :) My Radio module uses UART for communication but I have failed to set up my serial ...
Georg's user avatar
  • 193
3 votes
3 answers
5k 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 ...
nosuchintel's user avatar
1 vote
2 answers
1k views

Why is SPI not working on any of my Raspis?

I tried it on both Raspi 3 and 2 using the SpiDev python library. I've never even seen any kind of output on MOSI or CS lines with my oscilloscope. Controlling an SH1106 OLED display via the luma....
Tim W.'s user avatar
  • 11
1 vote
1 answer
12k 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://i.stack....
ichirow's user avatar
  • 19
1 vote
1 answer
2k views

Piezo sensor to pick up acoustic instrument signal using Rpi and ADC

I want to read analog inputs from piezo sensors like these on Raspberry using python, which ADC do you advise me with 8 or more channels and how to wire and program it to get digital values?
Miky's user avatar
  • 173
0 votes
2 answers
389 views

Raspberry pi run startup python script cannot send HTTP requests

I let my python script run at startup but some of HTTP requests (using requests pip module) not working. However, when I run the script manually with sudo openvt -s -w /path/to/launcher.sh, all HTTP ...
Pakpoom Tiwakornkit's user avatar
0 votes
1 answer
1k views

How can I amplify my voice in real time just like a microphone does?

I am planning to make a microphone and speaker system to amplify my voice just like a normal microphone does. I have a sound sensor and a speaker... is there any Python code that I can use?
freemint's user avatar
-1 votes
1 answer
1k views

How can Rpi Python control motor drivers L293D or L298N?

It is dangerous to run motors directly from the Pi, hence we need a motor shield. I own an Adafruit arduino motor shield clone: https://learn.adafruit.com/adafruit-motor-shield Note: I'm aware about ...
Abbas Kagdi's user avatar
48 votes
7 answers
206k views

Playing audio files with Python

I am looking for a well maintained Python library with allows me to play audio files on my Raspberry Pi using the standard audio output. So far I've tried several, but none of them seem to work. ...
Stein's user avatar
  • 1,768
31 votes
3 answers
9k views

How can I use the GPIO pins as digital outputs?

I've read that the Raspberry Pi has a number of input and output pins. How can I switch them? (from Python?) What voltage logic? Do I need pull-up or pull-down resistors? Do I need to switch the pins ...
Alex L's user avatar
  • 7,595
27 votes
2 answers
49k views

How to get Python to work with Lighttpd?

I've got Lighttpd setup on my Raspberry Pi, but I'd like to get server-side code working now. I'm familiar with PHP, but I figure I should try Python as it's supposed to be the "go to" language for ...
Mark Ingram's user avatar
17 votes
4 answers
17k views

How can I use more GPIO ports on the Raspberry Pi?

I am currently planning a project for a course at school which involves using the Raspberry Pi - however I'm worried that I will not have enough GPIO connectors for the inputs and outputs that I will ...
ChaoticPanda's user avatar
17 votes
3 answers
112k views

GPIO: Warning Channel already in use

gpio.py:5: RuntimeWarning: This channel is already in use, continuing anyway. Use GPIO.setwarnings(False) to disable warnings. GPIO.setup(8, GPIO.OUT) That is what I get after I run: import RPi....
LilVinny's user avatar
  • 420
14 votes
5 answers
66k views

PyQt5 on a Raspberry Pi

I have a Raspberry Pi 3 with Raspbian installed, along with a 7" touch screen. I'm in the process of creating an application in Python to read several DS18B20 Thermocouples to monitor the temperature ...
CharlieHorse's user avatar
12 votes
4 answers
42k views

How to get the Raspberry Pi's IP address for SSH

I am using Mac OSx to access my Pi via SSH. To access it, I know that I need the Pi's IP address. So, I decided to use a few Python commands which have always succeeded in giving me the local IP. ...
xxmbabanexx's user avatar
  • 3,258
8 votes
1 answer
2k views

Raspberry Pi Camera - When is it ready for next frame

When using apis like the C++ or raspicam api, you poll the camera with a grab(), or similar, method. When a frame is ready, the method returns. Is there a way of checking if the camera is ready ...
user2290362's user avatar
6 votes
6 answers
48k views

How does python GPIO bouncetime parameter work?

I have a simple Python script that is observing two GPIO pins, I've set the bouncetime parameter to 500ms, but I get multiple (almost always 2) calls to my callback, usually 3 or 4 ms apart. This is ...
TomG's user avatar
  • 1,151
6 votes
2 answers
8k views

Read keyboad input from background process

For a new project, I need to read input from a USB barcode scanner (that registers as a keyboard) and perform some actions on the "typed" text whenever the Enter key was pressed. The requirement is ...
TheWolf's user avatar
  • 203
4 votes
4 answers
2k views

Raspberry Pi stable date time

I'm working on a Raspberry Pi project, in which date and time are the most important factors. So, I want them to be very accurate. I know there are two methods to configure the Raspberry Pi's date ...
Dani's user avatar
  • 469
4 votes
2 answers
9k views

Resetting usb device from terminal

I am using a USB IR Toy v2 and using this excellent https://github.com/crleblanc/PyIrToy python library to get it working after failing to get things going with LIRC. However, while it works once, ...
EnjoyThePi's user avatar
4 votes
1 answer
4k views

How to read the status of the Power-LED on Raspberry Pi 3 with Python

How to read the status of the Power-LED (or the rainbow square - if you like that better) on Raspberry Pi 3 to detect an low-voltage-condition in a python script? Since the wiring of the Power-LED has ...
JRoppert's user avatar
  • 141
1 vote
2 answers
7k views

Reliable way to play sound (ogg, mp3) in Python, on Pi Zero W

I have been trying to find a reliable method to play sound on my Pi Zero W, in Python. By default, Zero does not have audio output, but I have set up an I2S amp and speaker, following this guide: http:...
Passiday's user avatar
  • 109
1 vote
2 answers
11k views

Start python script at startup using SYSTEMD in RPI jessie

Setup: Raspberry Pi 2 Model B V1.1 Raspbian Jessie Version March 2016 Hi I am new in the RPI world, I managed to setup 2 DHT22 temperature sensors connected to GPIOs 22 and 23, 2 analog temperature ...
jmmb392's user avatar
  • 13
0 votes
2 answers
5k views

Start and run a Python script at boot and use Cron to make sure its still alive

Hopefully someone can tell me if I'm going at this the right way. I have a Python script which I want to launch at boot. That was easy enough by putting a file in /etc/init.d/myBootFile I want to ...
KHibma's user avatar
  • 270

1
2 3 4 5 6