Skip to main content
Share Your Experience: Take the 2024 Developer Survey
16 votes
Accepted

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

This error was resolved when I disconnected and reconnected my camera module. Somehow my camera module must have been wiggled loose when I was working with it and the Pi was not able to detect the ...
Justin's user avatar
  • 432
5 votes
Accepted

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

This is not a Pi specific question, but all the normal python commands work (at least as well as in any python shell) e.g. import gpiozero help(gpiozero) dir(gpiozero) To document the Button class ...
Milliways's user avatar
  • 60.3k
4 votes

LED not blinking

Two possibilities. The gpiozero module exclusively uses the Broadcom GPIO numbering scheme. So 22 refers to Broadcom GPIO 22 which is connected to expansion header pin 15. Are you using the correct ...
joan's user avatar
  • 71.1k
4 votes
Accepted

Using GPIO from my virtualenv

Either install the libraries you need into the virtualenv using e.g. pip install gpiozero or when you create your virtualenv, enable site-packages using virtualenv --system-site-packages. Be aware ...
ben_nuttall's user avatar
  • 2,461
4 votes
Accepted

High Impedance state for GPIO

Tri-state output circuitry as used for most computer busses can be set Low, High or HiZ. In fact many circuits actually have 4 states as they can be set as Inputs. The state of a bus (consisting of a ...
Milliways's user avatar
  • 60.3k
4 votes

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

First of all, test the LED by connecting it to 3V3 and GND to make it come on without needing code. Then move from 3V3 to a GPIO pin and make sure you know which pin you're connected to. Refer to ...
ben_nuttall's user avatar
  • 2,461
3 votes

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

If you are connecting pin 4 (5v) to ground pressing the button is shorting your power supply. The power supply will then shutdown and cut power to the Pi -- killing your ssh connection. Then it ...
Craig's user avatar
  • 3,014
3 votes

GPIOzero motor backward and forward pins

You need to specify the GPIO you are connecting to the motor driver board which in turn controls the motor. The motor driver board normally has two pins per motor. If you set one pin high, the other ...
joan's user avatar
  • 71.1k
3 votes

Python parallel processes for raspberry pi zero...possible?

Well, the way you wrote your script, it does everything sequentially - one line after another. However, there are ways to execute commands parallely using python on a Raspberry Pi, whether it's a zero,...
Fantilein1990's user avatar
3 votes
Accepted

Does gpiozero need RPi.GPIO?

gpiozero does not need RPi.GPIO. However there is little reason not to install RPi.GPIO, it doesn't take much space and there are a wealth of examples of its usage. gpiozero can use any one of a ...
joan's user avatar
  • 71.1k
3 votes
Accepted

PWM problem in a frequency less than 100Hz

I expect in reality the final state of the GPIO is pretty random. As you don't do a cleanup GPIO 17 will be left as an output. Its level will remain at whatever it was when the sleep elapses and RPi....
joan's user avatar
  • 71.1k
3 votes
Accepted

Problems with the rpi zero and relay

Driving the coil of a relay requires power. Power (P) - in direct-current electrical form - may be calculated as the product of voltage (V) and current (I): P = V * I Knowing even a little bit about ...
Seamus's user avatar
  • 22.2k
2 votes
Accepted

PiCamera, PIR Motion Sensor 'Attribute Error: __exit__'

The error: AttributeError: __exit__ indicates that the object is not a context manager. In this particular case it is because picamera.PiCamera is a class not an instance of a class. The proper ...
Stephen Rauch's user avatar
2 votes
Accepted

Raspberry Pi Zero get 5 V directly from the input

There are two pins (2 and 4) on the gpio connector that carry the 5V supply voltage. See official schematics - look for J8 - or any of the gazillion websites showing Raspberry Pi pinouts.
Ghanima's user avatar
  • 15.9k
2 votes
Accepted

gpiozero: Ignore false positives/negatives

As far as I am aware my pigpio library is the only gpiozero back-end to have a proper debounce implementation. pigpio provides a glitch filter which ignores any level transitions shorter than a ...
joan's user avatar
  • 71.1k
2 votes

Weird LED behaviour

Two issues: you are not assigning the objects at anything, and your script is reaching the end of the file and exiting. While PWMLED(i).blink() is valid Python, you are not keeping the objects alive, ...
ben_nuttall's user avatar
  • 2,461
2 votes
Accepted

GPIOs of Pi3 not working

Is it possible that at any point PIN 4 (PIR) was configured as OUT? That would damage GPIO permanently and be an easy root cause (if PIN 4 was set to OUT0, and sensor is reading 1, that is a direct ...
crasic's user avatar
  • 3,003
2 votes
Accepted

Ultrasonic program in raspberry pi stops working after some time

The bug is in the following lines. # wait for ping echo while GPIO.input(pin)==0: starttime = time.process_time() while GPIO.input(pin)==1: endtime = time.process_time() You should timeout both ...
joan's user avatar
  • 71.1k
2 votes

Upgrade to gpiozero 1.4 on Jessie breaks gpiozero

The documentation for gpiozero shows that the way that you can change the default pin implementation has changed. Before, you changed the variable gpiozero.devices.pin_factory; now, you have to ...
Allan Burleson's user avatar
2 votes

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

This seems to be working for me: from gpiozero import Button from time import sleep aBtn = Button(6) bBtn = Button(13, pull_up=False) def buTest(but): sleep(0.5) #adjust to your liking act =...
kb__'s user avatar
  • 43
2 votes

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

A simpler solution would be to use button1.when_released = fucntion_a. Then function a only has to determine if function b executed by checking the button's held_time property.
Daddy the Runner's user avatar
2 votes
Accepted

Monitor GPIO activity to debug possibly broken script

For a GUI solution (remote or local) you can use piscope. For a non-GUI terminal based monitor you can use monitor.py. Both require the pigpio daemon to be running (sudo pigpiod). pigpio is ...
joan's user avatar
  • 71.1k
2 votes

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

The first thing that comes into my mind is that the camera is used at the same time by another script or program. Please check that the camera is not used. Also, be sure that you run only an instance ...
alex's user avatar
  • 21
2 votes
Accepted

Difference in using an LED with gpiozero vs. RPi.GPIO

The gpiozero module always uses Broadcom GPIO numbering to identify a GPIO. The RPi.GPIO module can use physical pin numbering (BOARD) or Broadcom GPIO numbering (BCM). The physical pin 21 is ...
joan's user avatar
  • 71.1k
2 votes
Accepted

gpiozero button callback running only once

I think the signal.pause() may be the issue. Could you replace signal.pause() with the following? import time while True: time.sleep(1) Alternatively perhaps you should try GPIO4. GPIO2 and ...
joan's user avatar
  • 71.1k
2 votes
Accepted

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

I rewrote using RPi.GPIO module instead of gpiozero. It feels different, but it was easier than researching a way to do exit without cleanup using gpiozero. Here is the "equivalent" program without ...
RufusVS's user avatar
  • 141
2 votes

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

Milliways and Dirk are correct, import* was the problem. I should have realized that both GPIO Zero and Tkinter have a Button class, so one was overwriting the other and causing the error. Thank you ...
Clueless_User's user avatar
2 votes
Accepted

enable software i2c on raspberry pi gpio

i2c devices can be 'daisy chained' so you only need 2 pins: Use 'i2cdetect -y 1' to list the addresses of each device:
CoderMike's user avatar
  • 6,997
2 votes
Accepted

remote connection pigpio

PIGPIO_ADDR=192.168.1.3 python3 led.py is a terminal command. If you're using PyCharm on Windows, you need to either: Set an environment variable within PyCharm Set an environment variable within ...
ben_nuttall's user avatar
  • 2,461
2 votes
Accepted

second motor won't stop unless I disconnect power

I suspect that the second line should read motor2.stop(): motor.stop() motor.stop() # <-- change to motor2.stop()
stevieb's user avatar
  • 1,456

Only top scored, non community-wiki answers of a minimum length are eligible