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.

2 Answers 2

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
    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
    Aug 27, 2022 at 17:43

Your Answer

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

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