Questions tagged [gpiozero]

For questions relating to the python gpiozero library.

Filter by
Sorted by
Tagged with
0 votes
1 answer
29 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
18 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
17 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
54 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
  • 111
0 votes
1 answer
25 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
  • 111
1 vote
3 answers
70 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
28 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
1 vote
1 answer
72 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
1k 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
66 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
111 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
64 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
158 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
148 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
212 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
116 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
154 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
170 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
98 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
1 vote
1 answer
206 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
81 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
697 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
377 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
983 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
211 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
133 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
3k 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
53 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
255 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
395 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
0 votes
1 answer
198 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
286 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
523 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
830 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
5k 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
  • 20.6k
1 vote
2 answers
166 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
261 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
301 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
509 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
0 votes
1 answer
276 views

Show boot info on character LCD

Is it possible to show boot log or info on a character LCD that the Raspberry Pi is still booting? I'm using a generic 16x2 character LCD
admin's user avatar
  • 147
2 votes
1 answer
2k views

GPIO inputs don't work on Raspberry 4 running Ubuntu

I have several RasPIs set up with Ubuntu Server 18.04 64Bit. One freshly setup up RasPIs 3B+ and two 4Bs. On all I can run the following minimum script without any error messages: #!/usr/bin/env ...
MichelH's user avatar
  • 23
-1 votes
2 answers
505 views

Problems with the rpi zero and relay [closed]

I Have a problem... (above the relay-coil Datasheet) I want to control a single relay with my pi zero, but it seems that it doesn't have enough power. the 3.3V pin of the rpi (measured to 3.19V) works ...
Nilusink's user avatar
1 vote
0 answers
260 views

I2C, SPI and Python Libraries with Raspberry Pi 4b

I've been working with RPi.GPIO so far but I have had issues with PWM and edge detection, which are well known issues with RPi.GPIO, anyway, after some research I'm considering using a different ...
Pokebab's user avatar
  • 86
0 votes
0 answers
438 views

when_pressed and when_released functions in gpiozero not working

I have the following code, and I cannot figure out how to make when_pressed and when_released work. The callback functions just do not run to the press and release. On the other hand, properties such ...
J0ANMM's user avatar
  • 111
0 votes
1 answer
333 views

PWM problem in a frequency less than 100Hz

I have attached a fan to pin #17 (through a transistor of course) and am writing a script to turn the fan on for a specified duration with a specified PWM duty. #!/usr/bin/env python import os ...
Sohail's user avatar
  • 163
-1 votes
1 answer
2k views

function to wait for any of the buttons press

I'm working on a project that use four buttons to navigate in a menu. The root options of the menu have nested options etc. The buttons don't have hardware de-bouncing. My ultimate objective is to ...
martin-mystere's user avatar
3 votes
1 answer
426 views

gpiozero for remote gpio control not work

i just knew how to control gpio from my laptop to desire raspberry pi using gpiozero. so, i following this docs on how to configure the raspberry pi and my laptop to performing remote gpio control. i ...
farhanrbnn's user avatar
0 votes
1 answer
268 views

Increase sleep interval for LED sequence whenever button is pressed. (Python)

This is the code: #!/usr/bin/python3 from time import sleep from gpiozero import LED, Button from threading import Thread from signal import pause, signal, SIGTERM LEDs = [5, 17, 22, 19, 26] LIGHTS ...
MrYosuko's user avatar
-2 votes
3 answers
91 views

What is simplest Python code to call the begin_time function with the value of time equal to 5 when the launch Button is pressed?

I have the following code: def begin_time(time): print(time) from gpiozero import Button begin = Button(27) I want to call this function with time = 5 Any help would be appreciated
MrYosuko's user avatar