Facebook Twitter Instagram Pinterest YouTube
    Trending
    • Elecrow Meteor IPS Touchscreen with RGB LEDs
    • Pi Pico Pinout Display on the Command Line
    • How to Add a Raspberry Pi Pico Reset Button
    • Pi Pico Onboard LED
    • Pi Pico W Pinout and Power Pins
    • CrowPi L Raspberry Pi Laptop and Learning Platform
    • Pi Pico W Launched
    • Add Kodi to RetroPie Menu
    Facebook Twitter Instagram Pinterest YouTube RSS
    Raspberry Pi SpyRaspberry Pi Spy
    • Home
    • Categories
      • General
      • Hardware
      • Programming
      • Python
      • Software
      • Tutorials & Help
    • BerryClip
      • BerryClip Instructions
      • BerryClip Plus Instructions
      • Videos & Reviews
    • Buy
      • Buy Pi
      • Buy Pi Accessories
      • Buy Books
    • Tools
      • Ultimate Raspberry Pi Alexa Skill
      • Pi Power Estimator App
      • Pi-Lite 14×9 LED Matrix Sprite Editor
      • RPiREF Pin-out Reference App
      • Simple Ohm’s Law Calculator
      • Web Sites & Links
    • Tutorials & Help
        Featured
        November 9, 20200

        Raspberry Pi Temperature Monitoring

        Recent
        December 23, 2022

        How to Add a Raspberry Pi Pico Reset Button

        November 20, 2022

        Pi Pico Onboard LED

        May 6, 2022

        Add Kodi to RetroPie Menu

      1. Contact Us
      2. Site Map
      Raspberry Pi SpyRaspberry Pi Spy
      You are at:Home»Hardware»Camera Module»How To Disable The Red LED On The Pi Camera Module

      How To Disable The Red LED On The Pi Camera Module

      22
      By Matt on May 18, 2013 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 the GPIO. On the Model B you can use GPIO5 and on the B+ you can use GPIO32. 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
      # Use 5 for Model A/B and 32 for Model B+
      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.

      Share. Facebook Twitter Pinterest LinkedIn Tumblr Email
      Previous ArticleRaspberry Pi Camera Module Mechanical Dimensions
      Next Article Installing The Raspberry Pi Camera Module

      Related Posts

      Pi Pico Onboard LED

      Raspberry Pi 7-Segment LED Display Module using Python

      Send Pushover Notification when MotionEyeOS Boots

      22 Comments

      1. Alex Eames (RasPi.TV) on May 20, 2013 10:32 am

        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.

        Reply
      2. MW on May 20, 2013 7:26 pm

        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?

        Reply
        • Matt on May 21, 2013 6:02 pm

          Have you completely removed the disable_cam_led line from your /boot/config.txt file?

          Reply
      3. Harry Orford on May 22, 2013 12:52 am

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

        Reply
        • Matt on May 22, 2013 8:26 pm

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

          Reply
          • Robin A. Jensen on May 25, 2013 10:58 pm

            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. 🙂

            Reply
      4. FFAMax on May 22, 2013 10:50 am

        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

        Reply
        • Matt on May 22, 2013 8:25 pm

          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.

          Reply
      5. Yaug on May 27, 2013 8:20 pm

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

        Reply
      6. rm on May 30, 2013 5:33 pm

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

        Reply
      7. Mrbcsimpson on February 10, 2014 10:51 pm

        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.

        Reply
      8. Ben Dasher on March 9, 2014 6:05 pm

        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

        Reply
      9. Jason on March 24, 2014 7:03 pm

        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.

        Reply
        • Matt on April 2, 2014 4:43 pm

          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.

          Reply
      10. McHa on September 22, 2014 10:24 pm

        Just for completeness, on B+ version of the board the led is on GPIO32.

        Reply
      11. Harald Lordick on November 30, 2014 1:19 pm

        The python script works also on A+ version, with CAMLED = 32.

        Reply
      12. Graham on March 9, 2015 5:36 pm

        Hi – I must admit that I followed the /boot/config.txt changes to disable the LED before reading the Update about it not working on the latest version of Raspbian. Rather worse than just not switching the LED off it actually stopped the camera working on my system.

        Will be trying the python code to stop the reflection affecting low light photo streaming.

        Graham

        Reply
      13. Nick on April 30, 2015 9:30 pm

        This works fine on the B+ for me. Just the one line in /boot/config.txt.

        Reply
      14. Jan on September 2, 2015 7:51 am

        Is there also a way to dimm the led?

        Reply
        • Matt on September 4, 2015 10:54 am

          Not as far as I am aware.

          Reply
      15. Peter NZ on February 7, 2016 6:59 am

        Thanks, Works great I have motion detecting movement and turning on camled when motion is detected.

        Reply
      16. Lukas on March 14, 2021 6:27 pm

        Very old topic but just for completeness. On Pi Zero W the led is on Pin 40.

        Reply

      Leave A Reply Cancel Reply

      This site uses Akismet to reduce spam. Learn how your comment data is processed.

      Recent Posts
      March 13, 2023

      Elecrow Meteor IPS Touchscreen with RGB LEDs

      December 26, 2022

      Pi Pico Pinout Display on the Command Line

      December 23, 2022

      How to Add a Raspberry Pi Pico Reset Button

      November 20, 2022

      Pi Pico Onboard LED

      November 14, 2022

      Pi Pico W Pinout and Power Pins

      Categories
      • 1-wire
      • 3D Printing
      • Add-ons
      • BBC Micro:bit
      • BerryClip
      • Books
      • Camera Module
      • Cases
      • Events
      • General
      • Hardware
      • I2C
      • Infographics
      • Interfaces
      • Minecraft
      • Model A+
      • Model B+
      • News
      • Pi Models
      • Pi Pico
      • Pi Zero
      • Power
      • Programming
      • Python
      • Raspberry Pi OS
      • Raspbian
      • RetroGaming
      • Robotics
      • Sensors
      • Software
      • SPI
      • Tutorials & Help
      Tags
      Arduino audio battery berryclip Birthday bluetooth cambridge camera CamJam DigiMakers display games GPIO I2C interface Kickstarter Kodi LCD LED Linux media Minecraft Model A motionEyeOS PCB photography photos Pi-Lite Pi Pico power python Raspberry Jam Raspberry Pi Bootcamp raspbian Retrogaming retroPie screen SD card security sensor SPI SSH temperature ultrasonic video
      Raspberry PI Related
      • Adafruit Blog
      • Average Maker
      • Official RaspBerry Pi Site
      • Raspberry Pi Pod
      • RasPi.tv
      • RaspTut
      • Stuff About Code
      Tech Resources
      • MattsBits – Pi Resources
      • Microbit Spy
      • Technology Spy
      Archives
      About

      Unofficial site devoted to the Raspberry Pi credit card sized computer offering tutorials, guides, resources,scripts and downloads. We hope to help everyone get the most out of their Pi by providing clear, simple articles on configuring, programming and operating it.

      Popular Posts
      September 19, 2014

      Top 5 Reasons The Raspberry Pi Sucks

      July 27, 2012

      16×2 LCD Module Control Using Python

      October 20, 2013

      Analogue Sensors On The Raspberry Pi Using An MCP3008

      Recent Posts
      March 13, 2023

      Elecrow Meteor IPS Touchscreen with RGB LEDs

      December 26, 2022

      Pi Pico Pinout Display on the Command Line

      December 23, 2022

      How to Add a Raspberry Pi Pico Reset Button

      Facebook Twitter Instagram Pinterest YouTube RSS

      Entries RSS | Comments RSS

      This site is not associated with the official Raspberrypi.org site or the Raspberry Pi Foundation. Raspberry Pi is a trademark of the Raspberry Pi Foundation.

      Copyright © 2022 - All Rights Reserved - Matt Hawkins

      mastodon.social@RPiSpy

      Type above and press Enter to search. Press Esc to cancel.