0

I want to light up the picamera LED using python for a few seconds as a test to see if it works, without actually taking a photo. And yes I know I can test that by just taking a photo and watching it light up

I've read through the picamera documentation and can't seem to find a command to do it, any help would be much appreciated.

3 Answers 3

2

You can turn on the camera led through the pi’s GPIO using the python code below:

 #!/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)

 GPIO.output(CAMLED,True) # On
 time.sleep(1)
 GPIO.output(CAMLED,False) # Off

 But I believe that this may require you to first disable the red led by adding the following line:

disable_camera_led=1

To your config file which can be opened with the following command:

sudo nano /boot/config.txt
1
  • Of course this will only work with Picamera V1. Picamera V2 does not have a LED.
    – Dirk
    Commented Sep 26, 2018 at 17:34
0

On a Pi Zero the GPIO pin is 40:

import RPi.GPIO as GPIO
import time
GPIO.setmode(GPIO.BCM)
CAMLED = 40
GPIO.setup(CAMLED, GPIO.OUT, initial=False)
GPIO.output(CAMLED,True)
time.sleep(1)
GPIO.output(CAMLED,False)
1
  • Your answer could be improved with additional supporting information. Please edit to add further details, such as citations or documentation, so that others can confirm that your answer is correct. You can find more information on how to write good answers in the help center.
    – Community Bot
    Commented Aug 27, 2022 at 17:43
0

i tried using this code on pi 0

#!/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)

 GPIO.output(CAMLED,True) # On
 time.sleep(1)
 GPIO.output(CAMLED,False) # Off

it worked but when i tried it on pi 0 2w it wont work. is the gpio different

2
  • If you have a new question, please ask it by clicking the Ask Question button. Include a link to this question if it helps provide context. - From Review
    – Milliways
    Commented May 1 at 11:09
  • this is not an answer to the question ... please delete it ... then post your own question
    – jsotola
    Commented May 2 at 20:57

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.