4

So far failing to switch the camera LED either from Python using RPi.GPIO or from the command line using /sysfs/gpio... I've tried using both GPIO5 and GPIO32 as suggested from various online sources, but haven't found any source specifically refer to the Pi zero or zero w and camera led GPIO.

The camera LED is disabled by config.txt - but setting up GPIO as output and state 'True' or 'False' via Python, or directly as '0' or '1' using /sysfs/gpio does nothing (all done using root shell). Is it possible to switch the CSI camera led on the Pi zero without rebooting?

1
  • Had a look a the value of /sys/class/gpio/gpio5/value after setting (using 'cat /sys/class/gpio5/value' )and it remains unchanged. Is this a problem with the O/S (motioneyeos)?
    – Charemer
    Commented Aug 3, 2017 at 9:26

1 Answer 1

5

After much searching I attempted to use an overlay as detailed here https://github.com/raspberrypi/linux/issues/1332 however on checking the source dts file it appears that the camera led for the pi zero w is set as gpio40. The answer is that simple - using /sys/class/gpio I am able to switch the led (or in my case using a waveshare camera with IR-Cut IR-filter) on and off simply using gpio40. (I'm using motioneyeos so admin user is root). With

disable_camera_led=1

in config.txt: the following commands run as root user will switch the led on (or IR cut filter in depending on your camera).

$>echo 40 > /sys/class/gpio/export
$>echo out > /sys/class/gpio/gpio40/direction
$>echo 1 > /sys/class/gpio/gpio40/value

To switch back out again;

$>echo 0 > /sys/class/gpio/gpio40/value

I haven't test from Python, but I expect that it will work fine using RPI.BCM and gpio40.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.