Questions tagged [gpiozero]
For questions relating to the python gpiozero library.
57
questions
1
vote
1answer
25 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 (...
0
votes
1answer
75 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 ...
-1
votes
1answer
23 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 ...
3
votes
0answers
80 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 ...
0
votes
2answers
108 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 ...
1
vote
0answers
22 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 ...
0
votes
0answers
29 views
HC-SR04 Ultrasonic Rangefinder readings are way off
So im trying to make my Robot move by itself and then make a turn until the path is clear using the HC-SR04 Ultrasonic Rangefinder, but my problem is that my readings are off with a large margin, ...
0
votes
1answer
45 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 ...
1
vote
1answer
142 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 ...
4
votes
0answers
383 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 ...
-1
votes
1answer
30 views
second motor won't stop unless I disconnect power
I am using an L298N board and two pi yellow pi servos and a program on my pi to control everything:
# Driving One Motor Using GpioZeo and L298N v0.01 tlfong01 2019jun11hkt1156
# rpi3B+ python 3.5.3 ...
2
votes
1answer
48 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
...
1
vote
1answer
320 views
How to toggle button on and off with gpiozero?
I can't seem to find a solution of doing this using gpiozero. I've done it using rpi.gpio with add_event_detect and call back to change state but I was under the impression gpiozero is much simpler.
...
3
votes
1answer
62 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/...
0
votes
0answers
85 views
GPIO LED is constantly on. GPIOZero can't turn it off
If power is supplied to the Pi then the LED will be on by default. I've got the LED connected to GPIO pins [4, 6] and the script can not turn it off. I've switch the cables around and that's resulted ...
0
votes
0answers
81 views
I want to toggle a button from GUI tkinter and display a counts from GPIO
I want to toggle a button from GUI tkinter and display a counts from GPIO.
Here I have a counter system code:
from gpiozero import *
from time import sleep
#####GPIO input##########
led = LED(26)
...
0
votes
0answers
44 views
re error in using gpiozero
I am new to RPi, though have lot of experience with Arduino.
I recently installed the 'gpiozero' module to my RPi system, and while trying to run a simple LED on-off file, I encounter an error......
0
votes
0answers
140 views
gpiozero robot control
I have to control motors of my Braitenberg vehicle using robot class of gpiozero. Sometimes I have to turn my robot reverse direction either in left or right. But this thing is not happening. I am ...
1
vote
2answers
386 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 ...
0
votes
1answer
120 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
0answers
36 views
gpiozero ImportError in virtual environment
I've been trying to use the gpiozero library lately with one of my opencv projects. Installed gpiozero using pip. Sample code works fine, no issues.
The problem is, my opencv installation is in a ...
0
votes
0answers
31 views
Gpiozero inside custom function
So I have a odd problem.
I have raspberry pi model 3 using gpiozero in python 3.
Just trying to turn on the motor at half speed when calling the function.
Issue is that nothing happens when ...
2
votes
1answer
86 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 ...
0
votes
1answer
135 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:...
1
vote
1answer
187 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 ...
0
votes
1answer
199 views
Wiring Omron D6T Thermal Sensor to Raspberry Pi Zero W with Adafruit T-Cobbler Plus
I have a Raspberry Pi Zero W connected to a Adafruit T-Cobbler Plus and breadboard. My question is regarding wiring. I have followed tutorials to create simple circuits, however, I am struggling to ...
-2
votes
1answer
148 views
Understanding the GPIO pins
I've not yet got into the GPIO pins. Can someone help me understand how they work? Are some of them special in some way? Do certain pins produce certain polarities or is that software defined? What ...
2
votes
1answer
235 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 ...
1
vote
1answer
388 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 ...
0
votes
1answer
875 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 ...
-2
votes
1answer
363 views
gpiozero : Not working, no error messages
I can't make gpiozero to work. Here is my config:
raspbian on raspberry 3B V1.2
$ python -V
return: python 2.7.13
$ python3 -V
return: python 3.5.3
which mean that I have several version of ...
0
votes
0answers
86 views
HTTPServer / FTPServer loop colliding with callback thread
I am building an alarm application. I have a few PIR sensors and webcams.
The application contains a webserver I use to manage the alarm from a mobile application done with kivy.The webcams upload ...
0
votes
2answers
1k 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 ...
1
vote
1answer
528 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 ...
3
votes
2answers
8k 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 ...
0
votes
1answer
596 views
Difference in using an LED with gpiozero vs. RPi.GPIO
I'm trying to turn on an LED and it was trivial with the gpiozero library. The following works just as expected.
# Version 1 (working)
import gpiozero
import time
led = gpiozero.LED(21)
led.on()
...
1
vote
1answer
412 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
2answers
1k 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 ...
0
votes
0answers
183 views
Python, RpiZero and gpiozero
I'm coding on Rpi3 using python3. When trying to run a code, containing a gpiozero lib - it fails when running on RpiZero, while succeeds on Rpi3.
RpiZero contains gpiozero lib
Trying to find the ...
0
votes
1answer
90 views
MC3008 vs. Justboom amp
I just ordered the Justboom AMP Zero pHAT. My project needs reading analog signals, too. So I also ordered a MCP3008 in order to convert from analog to digital.
My question: is it possible to connect ...
0
votes
1answer
197 views
Running Flask on Pi Zero getting uneven PWMLED
This is my first trial run using a Raspberry Pi Zero W to run RGB LEDs following this tutorial: https://dordnung.de/raspberrypi-ledstrip/
I've completed the tutorial, have everything wired up, and ...
0
votes
2answers
2k views
function button.is_pressed from gpiozero do not work
Im working on a university project with raspberry and gpiozero.
I need to manage the button response to take diferent actions.
The problem is that de function button.is_pressed its always true (even ...
0
votes
1answer
410 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
597 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 ...
1
vote
1answer
165 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 ...
3
votes
3answers
2k 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 = ...
2
votes
1answer
460 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 ...
0
votes
1answer
55 views
Raspberry Pi Zero get 5 V directly from the input
I have a Raspberry Pi Zero and I would like a tiny fan which draws 90 mA.
Obviously, I can't connect it to the GPIO pins and therefore I need to get 5 V from the input cable.
Before I ...
0
votes
1answer
560 views
gpiozero: Ignore false positives/negatives
I've seen several threads where users experience some noise fluctuation in the GPIO input readings, for instance, without any physical change to a Button's state, the events when_released/when_pressed ...
0
votes
2answers
213 views
Weird LED behaviour
I run my program:
from gpiozero import PWMLED
ledpins = [2, 3, 4]
z = 10
for i in ledpins:
PWMLED(i).blink(on_time=1/z, off_time=1/z, n=3)
I tried it and got:
Exception Exception ...