How To Disable The Red LED On The Pi Camera Module

The Pi camera module includes a red LED in one corner of the PCB. This lights up when the camera is active. It’s really useful in giving a visual indication that the camera is doing something and most of the time you will be glad it is there.

However there are a number of reasons you might wish it wasn’t.

In my testing here are some of the reasons it can get in the way :

  • Pi Camera Module Red LEDIt can cause reflections on objects you are trying to photograph giving them a red glow.
  • For nature photography it scares animals.
  • For security applications it may draw unnecessary attention to the device.
  • It consumes power.

To disable the red LED you simply need to add the following line to your config.txt file :

disable_camera_led=1

To edit the config.txt file you can use Nano :

sudo nano /boot/config.txt

Use the arrow keys to scroll to the end of the file and add “disable_camera_led=1″ to the last line. Press “CTRL-x” to quit. If prompted press “Y” followed by “Return” or “Enter”.

Reboot your Pi with “sudo reboot” and when you next use the camera the red LED will be disabled.

To enable the light again you can either use Nano to remove the line you added above or you can change it to “disable_camera_led=0″. Reboot the Pi and you will have your camera light back.

GPIO Control

Thanks to a hint by @TeamRaspi on Twitter I checked the schematics of the Rev 2 Pi and discovered that once disabled using the process above you can control camera LED using GPIO5. I tested this in Python and it works fine. Here is an example script that blinks the camera LED five times :

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

# Use GPIO numbering
GPIO.setmode(GPIO.BCM)

# Set GPIO for camera LED
CAMLED = 5

# 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
  time.sleep(0.5)
  GPIO.output(CAMLED,False) # Off
  time.sleep(0.5)

Here is a short clip showing the camera LED being turned on and off using Python :

UPDATE : Since the latest update to Raspbian the disable_camera_led feature appears to have stopped working. Hopefully it will be restored soon! The Python script still allows control of the LED.

This entry was posted in Camera Module and tagged , . Bookmark the permalink.


14 Responses to How To Disable The Red LED On The Pi Camera Module

  1. Awesome. When I saw the RTFS comment on Twitter I thought that would be the end of it. Well done for looking it up. GPIO 5 here we come.

  2. MW says:

    Hi, Thank you for this. I successfully disabled the light, later re-enabled it to show a friend, and now I am unable to disable it again. Any ideas why that would be?

  3. Harry Orford says:

    I am not able to turn off the led for some reason the command is in the config but just not recognizing it.

    • Matt says:

      It seems to have broken in the latest version of the camera utility. Hopefully they will restore it soon!

      • Robin A. Jensen says:

        Hey Matt
        Have just recived my camera today 25-05-2013 and testet the change in the config.txt and it seems to be working just fine.
        The LED is powered of when using it.
        I haven’t made any python script at all, just the change in boot/config.txt and a reboot. :-)

  4. FFAMax says:

    Which version of GPIO lib you use?
    Just my version does not know 3-d parameter:
    GPIO.setup(CAMLED, GPIO.OUT, initial=False)
    TypeError: ‘initial’ is an invalid keyword argument for this function

    • Matt says:

      I think the latest version is 0.5.2a. Do a full update (sudo apt-get update followed by sudo apt-get upgrade). Definitely looks like you’ve got an older version.

  5. Yaug says:

    Great news for the GPIO 5 controlling the LED.
    Thank you for the tip !

  6. rm says:

    Is there a way that to get the status of the camera led so that I can use a different led as my indicator?

  7. Mrbcsimpson says:

    Rather than remember this method every time I rebuild my pi, I simply head to google and end up on this page :) Thanks for the post.

  8. Ben Dasher says:

    Without changing the config.text file, i made 2 python programs out of this blinky program. clighton.py and clightoff.py. I just took out the time function and the off function for the on script, and the on function for the off script.

    clightoff.py

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

    # Use GPIO numbering
    GPIO.setmode(GPIO.BCM)

    # Set GPIO for camera LED
    CAMLED = 5

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

    GPIO.output(CAMLED,False) # Off

    clighton.py

    #!/usr/bin/env python

    import RPi.GPIO as GPIO

    # Use GPIO numbering
    GPIO.setmode(GPIO.BCM)

    # Set GPIO for camera LED
    CAMLED = 5

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

    GPIO.output(CAMLED,True) # On

  9. Jason says:

    Thanks for this great tip it is working and now I am playing around with the LED control.

    I noticed one thing when implementing the LED control python script you suggested:
    A RuntimeWarning was raised upon the line “GPIO.setup(CAMLED,GPIO.OUT,initial=False)”:
    RuntimeWarning: This channel is already in use, continuing anyway. Use GPIO.setwarnings(False) to disable warnings.

    It still does the LED control trick except for this error message.
    Without fully understanding what’s going on, I solved this referring to this:
    http://www.raspberrypi.org/phpBB3/viewtopic.php?f=32&t=20034
    Basically just adding the line “GPIO.cleanup()” at the end of the code, or in a try-finally group.

    • Matt says:

      That warning message happens if you run a script after you’ve already used the GPIO pins. As you found adding the GPIO.cleanup() command at the end of the script stops that warning the next time you add the script. I tend to always add it at the end of larger scripts but it is missing from the smaller examples. It’s not anything to worry about but neater if you include it.

Leave a Reply

Your email address will not be published. Required fields are marked *

You may use these HTML tags and attributes: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong>