Questions tagged [gpiozero]

For questions relating to the python gpiozero library.

Filter by
Sorted by
Tagged with
0 votes
0 answers
91 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): %%...
user avatar
1 vote
0 answers
32 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(...
user avatar
0 votes
1 answer
40 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 ...
user avatar
0 votes
0 answers
55 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 ...
user avatar
  • 109
0 votes
1 answer
56 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 ...
user avatar
-1 votes
1 answer
48 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 ...
user avatar
0 votes
1 answer
105 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 ...
user avatar
1 vote
0 answers
52 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 ...
user avatar
1 vote
1 answer
84 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), ...
user avatar
0 votes
1 answer
77 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'] = ...
user avatar
  • 123
0 votes
0 answers
46 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/...
user avatar
1 vote
1 answer
60 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 ...
user avatar
1 vote
0 answers
56 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(...
user avatar
-1 votes
2 answers
386 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 ...
user avatar
  • 1
-1 votes
1 answer
228 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 ...
user avatar
  • 1
-1 votes
2 answers
462 views

LEDs not turning off after Raspberry Pi power down

I have a Raspberry Pi with six LEDs and button (also with LED) on the custom circuit board that is connected to GPIO pins. This RPi previously had an AdaFruit Neopixel with LEDs, but later my client ...
user avatar
-1 votes
1 answer
148 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 ...
user avatar
0 votes
1 answer
99 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....
user avatar
  • 3
0 votes
2 answers
2k 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 ...
user avatar
  • 137
0 votes
1 answer
38 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 ...
user avatar
0 votes
1 answer
184 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 ...
user avatar
  • 3
0 votes
2 answers
228 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 ...
user avatar
  • 109
0 votes
1 answer
117 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), } ...
user avatar
1 vote
3 answers
175 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 ...
user avatar
0 votes
1 answer
314 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 ...
user avatar
  • 1
1 vote
2 answers
845 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 ...
user avatar
1 vote
1 answer
547 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 ...
user avatar
1 vote
1 answer
3k 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 ...
user avatar
  • 17.9k
1 vote
2 answers
121 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 ...
user avatar
1 vote
1 answer
140 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 ...
user avatar
  • 113
0 votes
1 answer
205 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 ...
user avatar
0 votes
0 answers
334 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)...
user avatar
0 votes
1 answer
136 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
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 ...
user avatar
  • 23
-1 votes
2 answers
363 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 ...
user avatar
1 vote
0 answers
185 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 ...
user avatar
  • 76
0 votes
0 answers
221 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 ...
user avatar
  • 111
0 votes
1 answer
218 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 ...
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 ...
user avatar
2 votes
1 answer
329 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 ...
user avatar
0 votes
1 answer
220 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 ...
user avatar
-2 votes
3 answers
67 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
user avatar
2 votes
2 answers
124 views

Can I use the Python Interpreter to list a modules' classes and methods, as well as descriptions? [closed]

I believe there is documentation available online, but for the sake of learning a little more about the interpreter, I am specifically wondering if I can use it to find out what is all available for ...
user avatar
0 votes
0 answers
80 views

Interrupt Servo once movement has initiated

I'm new to python and RPis. I'm building my own robot to learn. I manage to control my little robot and move it around, as well as moving the pan camera with my keyboard. While I was searching for a ...
user avatar
1 vote
1 answer
3k views

Please set pin numbering mode using GPIO.setmode(GPIO.BOARD) or GPIO.setmode(GPIO.BCM)

I've got an LED on bcm 18 and a servo motor on bcm 8. My code appears here. from gpiozero import LED import RPi.GPIO as GPIO import time GPIO.setmode(GPIO.BCM) GPIO.setup(8,GPIO.OUT) servo = GPIO....
user avatar
  • 191
2 votes
1 answer
161 views

How do I incorporate a button for pedestrian crossing when making traffic lights?

Here's a link to what I have been trying a accomplish: https://projects.raspberrypi.org/en/projects/physical-computing/9 Near the bottom of the page it says, "Try adding the button for a pedestrian ...
user avatar
1 vote
1 answer
1k views

While loop picking up button press twice with gpiozero

good morning! I've been working on some python (pretty new to the language) to control some buttons and LEDs utilising gpiozero and I've run into a few issues which I've been trying to troubleshoot ...
user avatar
2 votes
1 answer
1k views

Using GPIO from my virtualenv

I have a project I am developing with python3. I would like to add some status LED functions to it. If I am not root everything is fine, my activated virtualenv is all good, but I cannot use GPIO (...
user avatar
  • 123
0 votes
1 answer
142 views

How to wire a button

O have tried to do this so many times, so many websites, so many books, and it just won't work. I do not know how to wire it so that the LED lights up when I press the button. I'm pretty sure that I ...
user avatar
-1 votes
1 answer
41 views

How to make lilypad temperature sensor work with raspberry pi zero?

I discovered a lilypad sensor thought of connecting it with raspberry pi zero to measure living room temperature. But lilypad sensor is analog input and pi doesn’t have analog pin. How can i make ...
user avatar