Skip to main content

Questions tagged [gpiozero]

For questions relating to the python gpiozero library.

Filter by
Sorted by
Tagged with
0 votes
0 answers
106 views

Not able to access GPIO pins on my Pi5

So, I've been writing this device driver program in C to access GPIO pins. Whenever I try to install the module onto the board I get an error at gpio_request. The part I'm not able to understand is ...
Lochan R's user avatar
0 votes
0 answers
11 views

Pi4B: picamera2 and gpiozero compatibility?

I am using a Raspberry Pi 4B with a Raspberry Pi Camera Module 2 to take pictures. As a control, I made a program that just detects button presses and prints out that the button has been pressed: from ...
Gabriel Da Silva's user avatar
0 votes
1 answer
230 views

Working code example for a button using GPIOd and Python

I am attempting to rewrite a bit of code that used gpiozero for a Raspberry Pi that no longer works on the Raspberry Pi 5 due to the GPIO changes in the Raspi 5. I need it to be backwards compatible ...
utdream's user avatar
  • 113
0 votes
0 answers
259 views

Using an RPI-5 w/ Bookworm GPIOZERO errors on setting GPIO pins 4, 17 & 18, but all the others work fine. What am I missing? See code below

I am trying to use GPIO pin 4 for control of a purchased circuit board and there's seems to be an issue with 3 of the GPIO pins. The simple code below illustrates the issue. For visual diagnostics I'...
Chet Mallory's user avatar
0 votes
1 answer
98 views

Why did my servo motor break when controlling it from a raspberry pi?

I was trying to control a Tower Pro SG-5010 servo motor using a Raspberry Pi 4, with the python code below, but after working for a minute or so, the servo started not turning for some of the commands,...
guest1253's user avatar
1 vote
0 answers
473 views

Connecting a RFID-RC522 with Raspberry Pi 5

I bought a new Raspberry Pi 5 for a project that has RFID-tag reading and writing functions. I tried using some old python scripts(MFRC522-python) that uses RPi.GPIO to interact with the IO pins but ...
Bruh255's user avatar
  • 11
0 votes
2 answers
479 views

RPi 5 PWM precise frequency output

On RPi5, it seems we have to use gpiozero. In gpiozero, pwm output is available for various devices within a range 0 to 1. I want to use a piezo transducer with musical frequencies from say c = 130....
Trober's user avatar
  • 1
0 votes
0 answers
24 views

Missing light sensor events but hardware seems to see them

My configuration is a a red laser (5V) and a light sensor (Dollatek) which outputs a HIGH signal if no light is detected. Using a potentiometer the sensitivity can be adjusted. I set it so that the ...
Krumelur's user avatar
  • 101
0 votes
1 answer
1k views

How can I generate a hardware PWM on Raspberry Pi 4 using Python?

I need a PWM signal of 25KHz and duty cicle 0-100%. It must be "hardware" becase I don't want to bother the CPU with that. The ony way I found to do that in Python is by using ppigpio ...
Marus Gradinaru's user avatar
0 votes
0 answers
96 views

RPi Zero as 4-pin-fan-controller: Faulty RPM readings on open collector with gpiozero

Introduction and Goal Disclaimer: I do not have profound but basic knowledge in electronics and hardware and my python is a bit rusty. For tl;dr, jump to the problem section below. Hello, I'm trying ...
ArmoredGoat's user avatar
0 votes
1 answer
251 views

Optical Encoder with GPIOZERO

I am trying to help some 8th graders build a robot. They learned about the Raspberry Pi and Python with GPIOZERO in an earlier class. They have wheels spinning using the Motor class from GPIOZERO and ...
Bob Brown's user avatar
  • 1,037
0 votes
0 answers
19 views

Synchronising with long-running activities

If this seems familiar, it's because this is a more-specific rework of a bad question. Currently coding with gpiozero, but I'm not wedded to it. If I have mixed activities, such as compute tasks and ...
RoUS's user avatar
  • 105
0 votes
1 answer
27 views

Reserving/locking pins between processes

Relatively new to RPi coding and gpiozero in particular. Pardon ignorance, please. The pin factory stuff is good for 'reserving' pins within a specific process, but is there a builtin mechanism, or ...
RoUS's user avatar
  • 105
0 votes
0 answers
149 views

pigpio, gpiozero, and remote control

I'm struggling to get some reliability out of the aforementioned packages. Here are my problems: When I want to toggle a single output, all outputs reset and change into their new state Outputs don'...
addohm's user avatar
  • 107
-1 votes
1 answer
56 views

Latching IO using gpiozero

Im working on doing some remote GPIO control (de)energizing relays. When I turn a relay on, it instantly turns off. That makes me assume that the output doesn't latch. I tried several of the ...
addohm's user avatar
  • 107
1 vote
3 answers
214 views

DC Motor not responding to GPIO Motor

I want to control 4 DC Motors from a Raspberry Pi. I am just starting by making sure that 1 motor can be controlled. I am following this guide: https://projects.raspberrypi.org/en/projects/physical-...
network_learner's user avatar
2 votes
1 answer
64 views

Motor Controller Board Uncertainty for Raspberry Pi

I have a Raspberry Pi 4 Model B. I am trying to build a small car with 4 motors by using the GPIO pins to control the motors. I would like to be able to make the motor go forward, reverse, and ...
network_learner's user avatar
0 votes
1 answer
155 views

gpiozero's wait for release not working as it should

I'm trying to build a program that has 2 inputs connected to 2 limit switches and each of these needs to be first opened and then closed before the function respective to each button begins. As a ...
user20546541's user avatar
0 votes
0 answers
2k views

Can't connect to pigpio at localhost(8888)

So I don't think this issue is related necessarily to my code, because I'm thrown this error even running some formally working code examples from my textbook (Practical Python Programming for IoT): %%...
homfgomery's user avatar
1 vote
0 answers
86 views

Not getting an GPIO output

I am trying to light a led with the raspberry pi 3b, but I am failing to get an output. I connected the LED to physical pin #11: [img]https://i.imgur.com/TYeJc10.jpg[/img] And to physical pin #6(...
lars2203's user avatar
0 votes
1 answer
199 views

gpiozero and signal

My python script waits for motion (with gpiozero MotionSensor wait_for_motion()) most of the time. But it also needs to react to SIGUSR1. The problem is: when SIGUSR1 is received wait_for_motion() is ...
Antonio Garcia's user avatar
0 votes
0 answers
68 views

Raspberry Pi camera coding questions

I've been coding a little portable Pi camera using a Raspberry Pi Zero, the HQ camera module, and a WaveShare 1.44-inch screen. I've succeeded in programming a button to take a photo, and a button to ...
Dana's user avatar
  • 119
0 votes
1 answer
270 views

Button.when_activated event is not firing even though Button.is_active is setting correctly

Thanks in advance! I am using a Pi 3B to detect activation of a sensor on my model railroad layout. The sensor by default only offers a rising edge detection scenario. I decided to go with gpiozero ...
Sreekar Krishna's user avatar
-1 votes
1 answer
189 views

Can you use gpiozero wait_for_press() inside of a callback triggered by add_event_detect?

I am trying to write a script that uses a GPIO interrupt to callback a function that starts by playing a sound and then waits for a button to be pressed to start recording a sound, and then waits for ...
ant-in-pant's user avatar
0 votes
1 answer
321 views

How to use multiple HC-SR04 distance sensors

For a project I need to use many distance sensors HC-SR04 using less pins possible of a Pi Zero W. I was able to do a test program in python3 with one sensor connected using gpiozero library and it ...
Ripper346's user avatar
1 vote
0 answers
157 views

How to make analog servo power off with code?

I'm writing a sample code for my pi zero w and I have an analog servo motor (FS9225M) What I'm trying to do is make it work for a few spins then deactivate it so that I can move it manually with my ...
Michael Efraimidis's user avatar
1 vote
1 answer
213 views

Pi Zero - GPIO Lag

Summary: I have been trying to write a robot tank using a Raspberry Pi Zero W in Python and am running into an issue wrt to lag. The left motor moves 100-500ms before the right motor (or vice versa), ...
Basil Dsouza's user avatar
0 votes
1 answer
238 views

How to use gpiozero on RPi4 with Ubuntu 21.04, errored out NotImplemented

I'm trying to drive the motors from my RPi4. On the RPi4 4GB RAM, I installed Ubuntu 21.04. Here is the code, it used to be working on RPi Buster OS # import os # os.environ['GPIOZERO_PIN_FACTORY'] = ...
Franva's user avatar
  • 141
0 votes
0 answers
120 views

UART communication between Rhino DC servo motor and RPi4 B

I want to communicate with this Rhino DC servo motor with RPi4 B. I enable uart3 in RPi4 by modifying the /boot/config.txt file. In this file, I add dtoverlay=uart3 in the last. When I used ls /dev/...
Naseeb Gill's user avatar
2 votes
1 answer
302 views

GPIOZERO how to install lastest version on Ubuntu 20.10 servver

I am running gpiozero on my Raspberry Pi4 Ubuntu 20.10. I need to update gpiozero (1.2) to latest version (1.6.1) to use the RotaryEncoder class which is not present in the package I have installed ...
Bob Morton's user avatar
1 vote
0 answers
96 views

Rasberry Pi 4 LED.off() will not turn led off in a function

I have a simple circuit connected to my Raspberry Pi 4 with 3 push buttons and an LED. The buttons are connected to gpio2(pin 3), gpio17(pin 11), and gpio16(pin36), with the LED connected to gpio25(...
tcolbert's user avatar
-1 votes
2 answers
870 views

RPi.GPIO: multiple buttons one callback function, ignore buttons while callback is executing

I have 4 buttons connected to my Raspberry Pi that call the same function when pressed. I'm using GPIO.add_event_detect to connect the buttons to the callback function. When one button press executes ...
J.P.'s user avatar
  • 1
-1 votes
1 answer
456 views

gpiozero button to raise SystemExit / gpiozero clash with GPIO.cleanup()

TL;DR: Since this is a long question I have the following problems: I'm looking for a good way to use gpiozero Button to raise SystemExit upon button press I have an imported module to drive an E-Ink ...
J.P.'s user avatar
  • 1
-1 votes
2 answers
1k views

LEDs do not turn off after the Raspberry Pi powers down

I have a Raspberry Pi with six LEDs and a button (also with LED) on a custom circuit board that is connected to GPIO pins. This RPi previously had an Adafruit Neopixel with LEDs, but later my client ...
Dawid Loranc's user avatar
-1 votes
1 answer
274 views

How to know if a pin is assined in raspberry pi?

I'm "playing" with Django and I'm trying to read the state of a pin when a button is pressed using gpiozero. I'm able to do this without trouble outside Django, meaning that I can detect ...
antusystem's user avatar
0 votes
1 answer
146 views

GPIO Soundboard with just one button [closed]

i am trying to program a soundboard in python using gpiozero and a single button. Every time you press the button it should play the next sound. It almost works, but unfortunately not satisfactory yet....
Storm's user avatar
  • 3
0 votes
3 answers
4k views

Using Gpiozero for Relay Device

I am writing a Python app on my RPi to manage an 8-port Sainsmart relay. All that I need to do operate a port on that relay is to change the state on a GPIO pin to either low or high. I cannot find ...
BoCoKeith's user avatar
  • 147
0 votes
1 answer
57 views

Python tkinder reset button code fails on third attempt

I am trying to trigger a timer when there is audio and stop the timer when the audio is lower than a set value. There is a reset button that will reset the timer back to zero. The reset button works ...
P.V.Anthony's user avatar
0 votes
1 answer
305 views

gpiozero's LED.toggle() switches LED again after some seconds

I am using the gpiozero library to controll a LED strip and a relay connected to my raspberry pi 4. This is the way I connected the LED strip to the pins. I use a type SMD5050 LED strip similar to the ...
Jan's user avatar
  • 3
0 votes
2 answers
481 views

Cannot connect to UART via USB

I am trying to connect to a raspberry pi zero (and a pi3) via uart and USB (USB to TTL YP-01) I am connected to pin 8, pin 10 and a ground. tx -> rx, rx -> tx I have tried everything on this url ...
brad's user avatar
  • 109
-1 votes
1 answer
234 views

Register button presses within button press function?

I'm working with code that looks something like this: from time import sleep from gpipozero import Button BUTTONS = { 'start': Button(21), 'choice_1': Button(1), 'choice_2': Button(7), } ...
Alexander Soare's user avatar
1 vote
3 answers
447 views

How exactly do i make a LED Blink? I tried every possible result

I am trying to make a LED blink on a Raspberry Pi Breadboard, but after everything I've tried, it doesn't work. I have tried: Changing wires and moving them around Switching LED's to check if the ...
Raw Eggs's user avatar
0 votes
1 answer
711 views

Using gpiozero and RPi.GPIO in one script

I use the gpiozero.MotionSensor to detect motion and upon motion to change the state of GPIO pin 17 using RPi.GPIO. This works well. At the end of the script I clean up using RPi.GPIO.cleanup(), but ...
Kurt's user avatar
  • 1
1 vote
2 answers
2k views

GPIOZero- How to double button press?

I am new to Python, used my Python common sense but did not get any results. I am trying to learn how to do x-times of button presses and in x-amount of time to trigger something. In the below code, I ...
Consig1iere's user avatar
1 vote
1 answer
1k views

gpiozero on a pi4?

Working on getting some working samples setup for my son on his RPI4 so he can play with the GPIO's, breadboard, and some various pieces to use with the breadboard. Right now we're trying to test out ...
user3246693's user avatar
2 votes
1 answer
6k views

High Impedance state for GPIO

I've not used GPIO on RPi much. On other hardware, the GPIO pins can be configured in software to be in a "High Impedance" state (Hi-Z). I have assumed that it's possible to place most of ...
Seamus's user avatar
  • 22.3k
1 vote
2 answers
193 views

Breadboard circuit with LED going through 2 circuits doesn't work as expected

I have the resistor, GPIO24, and the LED anode connected along the same row of a breadboard. The signal from GPIO24 works as expected, but any signal from GPIO23 is lost and the LED will not light. I ...
Brady Dean's user avatar
1 vote
1 answer
372 views

RGB LED - Only first color activates when multiple colors are called

I have one RGB LED (common anode type), and while I can get every color to light up independently I am seeing some bizarre behavior when trying to combine colors. This is my first project involving ...
GrinningX's user avatar
  • 113
0 votes
1 answer
396 views

Long/short button press doesn`t work with IF statements - Need some help [closed]

I am trying to build a simple game and I have the following problem. My code is executed but the button presses cannot be detected whatever I am trying. There are no errors and I cannot figure out why ...
Veleslav Panov's user avatar
0 votes
0 answers
620 views

PIR sensor connection to the Raspberry Pi not working

I'd like to connect a PIR sensor (HC-SR501) to the Raspberry Pi, namely GPIO BCM 4. But the pin level always reads as 0. If I assemble a standalone circuit with PIR (its OUT pin - resistor - LED - GND)...
Alexandr Zarubkin's user avatar