Raspberry Pi


Below is a simple configuration tweak to disable the red LED on a Raspberry Pi camera.

There are plenty of reasons to do so. So if you have a security setup where the camera should remain invisible, or do nature photos or other, the tricks below works.

Disable LED in Configuration Script

This trick is the easiest to achieve. Edit config.txt and reboot the device. Camera LED is disabled for good (can be blinked though via GPIO, see next section).

  • Edit the configuration file
sudo nano /boot/config.txt
  • Add the following line to config.txt (it helps to add a comment section if you wish)
  • save changes and reboot
sudo reboot

Disable LED via Python (GPIO)

It seems the Rev 2 Pi allows to control the camera LED using the GPIO. On the Model B you can use GPIO5 and on the B+ you can use GPIO32. Below is an example python script that blinks the camera LED five times:

#!/usr/bin/env python
import time
import RPi.GPIO as GPIO

# Use GPIO numbering

# Set GPIO for camera LED
# Use 5 for Model A/B and 32 for Model B+

# Set GPIO to output
GPIO.setup(CAMLED, GPIO.OUT, initial=False) 

# Five iterations with half a second
# between on and off
for i in range(5):
  GPIO.output(CAMLED,True) # On
  GPIO.output(CAMLED,False) # Off

Always read more Python related topics on our main Python page.