Questions tagged [gpiozero]

For questions relating to the python gpiozero library.

Filter by
Sorted by
Tagged with
7
votes
5answers
20k views

Failed to create MMAL component b'vc.ril.camera': Out of memory

I am trying to run a simple script that listens for a button click and then takes a picture. Once two pictures have been taken it compares the two using OpenCV to calculate the difference. I am ...
5
votes
1answer
1k views

How fast can GPIO pins toggle on the Pi 4?

Benchmarking of the Pi 4 using the Python GPIO Zero library shows a significant increase in the frequency of toggling a GPIO pin on and off compared to previous models. This result is attributed to ...
4
votes
1answer
2k views

GPIOZero button not working

I've been getting into GPIO recently with the GPIOZero library but when i first tried it today it completely failed. As my first foray into GPIO i set up a circuit to light up an LED with the push of ...
3
votes
3answers
3k views

Using GPIOZERO button for 2 functions (Long/Short press )

I'm trying to make a dual use of 1 button: first use ( short press ) to exectute function "A", a second use ( long press ) to execute function "B". function A is executed after button1.when_pressed = ...
3
votes
2answers
1k views

Does gpiozero need RPi.GPIO?

I'm trying out gpiozero, but after running the examples from their documentation, I still get this errors but it still runs ok. gpiozero is installed on venv using pip3 #!/usr/bin/env python from ...
3
votes
2answers
1k views

Python parallel processes for raspberry pi zero…possible?

I'm trying to setup a concurrent photo capture and immediate email of said capture (triggered by a PIR motion sensor) in a Python script. Basically what I'm trying to accomplish is to have my Pi take ...
3
votes
1answer
150 views

gpiozero import resets pullup

In order to use a GPIO connected button as a power off switch I have set a pullup for pin 23 in a dtb overlay (following http://blog.gegg.us/2017/01/setting-up-a-gpio-button-keyboard-on-a-raspberry-pi/...
3
votes
0answers
98 views

Raspberry Pi button bug, what is happening?

I am new user of raspberry pi. I have two buttons, and some code to run, yet the led will not react to the buttons. It's probably a easy fix, but keep in mind, I am new to robotic and have only ...
2
votes
2answers
95 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 ...
2
votes
1answer
501 views

LED not blinking

Raspberry Pi Zero Wireless I have a Pi Zero connected to a breadboard using the GPIO Extension Board and ribbon cable. I have followed several of the basic blinking LED tutorials. One jump cable is ...
2
votes
1answer
128 views

remote connection pigpio

Asking the other day this question I discovered a new fascinating world, the gpio zero library. My first code was this (an example to blink a led): from gpiozero import LED from time import sleep ...
2
votes
1answer
222 views

Attribute and Type Error using Button class in Tkinter/GPIO Zero combination

I'm new to programming and I'm trying to write a simple program to change the blink rate of an LED using a GUI. When I try to run this on my RaspberryPi 2B running Raspbian, I get the following ...
2
votes
2answers
417 views

Using `gpiozero` on `raspberry pi` to control pins, but output pins are reset upon script exit, even though state is remembered between runs

I am using gpiozero to control devices on the Raspberry Pi. When I create a reference to (for example) an LED device, there is a parameter for creating the object without effecting it's current state:...
2
votes
1answer
506 views

PiCamera, PIR Motion Sensor 'Attribute Error: __exit__'

I'm pretty new to both Python and utilizing the GPIO pins on my Raspberry Pi. I am trying to make a "trail camera" that will take pictures of birds when they land on the branches of the trees just off ...
2
votes
1answer
2k views

gpiozero button callback running only once

I'm getting started with a project on a Raspberry Pi (never done anything with RPi or python before, so it's all new to me, but I've done a little Arduino stuff). I'm trying to create a very simply ...
2
votes
1answer
686 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 ...
2
votes
1answer
137 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 ...
2
votes
1answer
5k views

Unable to locate package python-gpiozero

I've just run apt-get update and apt-get upgrade on Raspbian, but when I try apt-get install python3-gpiozero python-gpiozero it can't find either package. Can't find any evidence of ...
2
votes
1answer
87 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 ...
1
vote
3answers
101 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 ...
1
vote
1answer
477 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 (...
1
vote
1answer
515 views

Showing “ssh packet_write_wait broken pipe” error while taking button input on Pi

I was trying to write a program which can take input from button. Here is the code: from gpiozero import Button btn = Button(4) while True: btn.wait_for_press() print('You pressed me') ...
1
vote
1answer
332 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 ...
1
vote
2answers
56 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 ...
1
vote
1answer
58 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 ...
1
vote
1answer
1k 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....
1
vote
2answers
2k views

Run gpio script from startup to listen for button press and then execute command and bash script

I have this python script that is intended to run from startup and listen for a buttonpress. If there is a buttonpress (held for 2s) the gpio script should run two bash scripts. The python script runs ...
1
vote
1answer
180 views

Upgrade to gpiozero 1.4 on Jessie breaks gpiozero

On a stock Jessie install, gpiozero works. E.g. >>> from gpiozero.devices import pin_factory >>> print(pin_factory) <class 'gpiozero.pins.rpigpio.RPiGPIOPin'> I then upgrade ...
1
vote
2answers
141 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 ...
1
vote
1answer
144 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 ...
1
vote
1answer
427 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 ...
1
vote
2answers
737 views

Piezo Beeper sound output is too low

I need to use some kind of indicator for errors and warnings, I thought a piezo beeper would be perfect since I have one lying around, I did some research online and found out that I can connect it ...
1
vote
1answer
336 views

Python IDLE (mu-editor) “RuntimeError: Failed to add edge detection ” Error

from gpiozero import Button from signal import pause def say_hello(): print("Hello!") button = Button(2) button.when_pressed = say_hello pause() The above code works nicely in when I run it ...
1
vote
1answer
1k views

Monitor GPIO activity to debug possibly broken script

I recently picked up a b3+ and a nespi+ case. The case comes with a power and reset button and provides a script for the safe shutdown and for the most part has been driving me insane. I've fixed the ...
1
vote
1answer
1k views

Fail to run Remote GPIO code from a PC using python3

I'm trying to run a remote GPIO code from a Linux machine to operate on RPI3. Code is running OK on another RPI3 to control each other, but when trying to do so from a PC, it fails. I followed the ...
1
vote
1answer
41 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), } ...
1
vote
0answers
36 views

Can pulse widths on output pins be specified when using the RaspberryPi Gpio library?

According to the AngularServo documentation in the Gpiozero, one can set an angle for a servo (which of course in fact sets a pulse-width), or a value (where 0 is one end of a range and and 1 is the ...
1
vote
1answer
404 views

Programming MLX90640 to display what I want [closed]

Yay. Got my MLX90640 working and boy it works great. However, the ambient temp of around 20C keeps showing as a green background and i would like it to be blue or even grey. Has anyone attempted to ...
1
vote
1answer
2k views

RpiZeroW - Can't find `pigpio` while running Python code

I have a python code, using gpiozero. When running this code on a RPI-ZEROW it fails, while running same code on RPI3 it succeeds. All installed pretty much the same ( shown checks below ), pigpio is ...
1
vote
1answer
2k views

Python picamera module: Interval photo capture while recording video

So I've been trying to figure this out for a while now, without success. I am using a RPi Zero Rev 1.3 model and have connected it to the 8MP RPi camera along with a PIR motion sensor. What I'm ...
0
votes
2answers
67 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 ...
0
votes
1answer
35 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....
0
votes
2answers
81 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 ...
0
votes
1answer
74 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 ...
0
votes
1answer
116 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 ...
0
votes
1answer
67 views

GPIO pin numbers for gpiozero class

So im trying to learn robotics with raspberrypi and I am following two different guides where I chose the wiring from one guide and the code from the other guide. My left motor is working but the ...
0
votes
1answer
246 views

enable software i2c on raspberry pi gpio

I am trying to interface more than one sensor with Raspberry Pi Zero W, which communicate using i2c interface. So far I am able to connect sensor to dedicated i2c and read the data. Want to know ...
0
votes
2answers
2k views

How can I wait for two presses of the button then run function in while loop

I am trying to compute the difference between two images with OpenCV on Raspberry Pi and I want the script to run continually like in a while loop and then after the first button press store the first ...
0
votes
1answer
518 views

GPIOs of Pi3 not working

Problem Description I have experienced some problems with the GPIOs on my Pi3. From one day to another the MotionSensor and the LED strip that where connected to the GPIOs stopped working while the ...
0
votes
1answer
657 views

Ultrasonic program in raspberry pi stops working after some time

Below is the code I'm running on my raspberry pi zero to detect the range by Ping))) ultrasonic. after some time (ex: 300 pings) the program uses most of the CPU (90%) and then it stops working, is ...