User avatar
leol
Posts: 147
Joined: Fri Jan 13, 2012 4:27 pm
Location: Haute-Vienne, France

Turning off camera LED

Thu May 23, 2013 3:19 pm

Am I right in thinking that since the last firmware update, you can no longer disable the LED by a line in config.txt?

Has the syntax changed or is this facility planed to be reinserted in a future release?

Thanks

Leo

User avatar
metaljay
Posts: 51
Joined: Fri Jun 22, 2012 7:26 am

Re: Turning off camera LED

Thu May 23, 2013 4:36 pm

you are correct, it seems editing the config.txt no longer works

User avatar
MattHawkinsUK
Posts: 538
Joined: Tue Jan 10, 2012 8:48 pm
Location: UK
Contact: Website

Re: Turning off camera LED

Thu May 23, 2013 10:14 pm

I hope it is re-enabled. The red LED is a pain when you are pointing the camera out a window due to reflections.

Yes you can stick tape over it, but that is a messy solution.
My Raspberry Pi blog and home of the BerryClip Add-on board : http://www.raspberrypi-spy.co.uk/
Follow me on Google+, Facebook, Pinterest and Twitter (@RPiSpy)

ludespeedny
Posts: 103
Joined: Mon Oct 01, 2012 6:55 pm

Re: Turning off camera LED

Fri May 24, 2013 3:47 am

putting in disable_camera_led=1 in my config.txt works for me. Just did it today.

User avatar
metaljay
Posts: 51
Joined: Fri Jun 22, 2012 7:26 am

Re: Turning off camera LED

Fri May 24, 2013 6:09 am

I imagine you haven't updated your packages yet

User avatar
alexeames
Forum Moderator
Forum Moderator
Posts: 2841
Joined: Sat Mar 03, 2012 11:57 am
Location: UK
Contact: Website

Re: Turning off camera LED

Fri May 24, 2013 6:32 am

I wonder why it broke?
Alex Eames RasPi.TV, RasP.iO

znanev
Posts: 6
Joined: Fri Oct 19, 2012 3:22 pm

Re: Turning off camera LED

Fri May 24, 2013 10:10 am

Yep, I updated this morning and lost control over the camera LED :(

I read somewhere in the forum that GPIO 5 controls this LED, but couldn't figure out how to set it to 0 from shell. I always get "Operation not permitted" when trying to write "0" to /sys/class/gpio/gpio5/value even though I'm logged in as root.

Anybody knows a software workaround until this gets fixed in the firmware? Taping over the LED is not an option for me...

User avatar
alexeames
Forum Moderator
Forum Moderator
Posts: 2841
Joined: Sat Mar 03, 2012 11:57 am
Location: UK
Contact: Website

Re: Turning off camera LED

Fri May 24, 2013 10:16 am

znanev wrote:Yep, I updated this morning and lost control over the camera LED :(

I read somewhere in the forum that GPIO 5 controls this LED, but couldn't figure out how to set it to 0 from shell. I always get "Operation not permitted" when trying to write "0" to /sys/class/gpio/gpio5/value even though I'm logged in as root.

Anybody knows a software workaround until this gets fixed in the firmware? Taping over the LED is not an option for me...
It is GPIO 5. I've tried it out in a live Python environment and with the LED diabled in config.txt, toggling GPIO 5 switches the LED on and off at will. Matt "RaspberryPiSpy" Hawkins published a script earlier in the week. But even he has lost access to it with the update.

I haven't upgraded since last week, so mine are still off :) I'll be setting a week-long time-lapse later on. That camera's facing a window, so a red LED is not required ;)
Alex Eames RasPi.TV, RasP.iO

User avatar
AndrewS
Posts: 3625
Joined: Sun Apr 22, 2012 4:50 pm
Location: Cambridge, UK
Contact: Website

Re: Turning off camera LED

Fri May 24, 2013 12:45 pm

I've managed to come up with a sort-of workaround... even though the camera LED comes on by default, you can still turn it off from Python. So one approach would be to create a script named 'disablecameraled.py' containing: (this is a cut-down version of the RaspberrySpy script)

Code: Select all

#!/usr/bin/env python
import RPi.GPIO as GPIO
GPIO.setmode(GPIO.BCM)
GPIO.setwarnings(False)
GPIO.setup(5, GPIO.OUT, initial=False)
and make it executable with

Code: Select all

chmod +x disablecameraled.py
and then run e.g. the following command line:

Code: Select all

raspivid -d -t 10000 & sudo ./disablecamled.py
which will start raspivid, send it to the background (with & ) and then use Python to turn off the LED while raspivid is still running in the background. On my Pi the LED stays on for about half a second.
Obviously you can replace raspivid with raspistill, and add whatever other command-line-arguments you want...

Andrew

EDIT: P.S. The reason you can toggle GPIO5 with RPi.GPIO and not the bash shell, is because the Python module accesses /dev/mem directly (and prints a warning message, which I've turned off in the code above) whereas the bash shell accesses the GPIO via sysfs (which I guess can't "ignore" the warning message).

EDIT2: I've just checked, and this workaround method still works even if disable_camera_led=1 isn't in /boot/config.txt
Last edited by AndrewS on Fri May 24, 2013 1:02 pm, edited 1 time in total.

jamesh
Raspberry Pi Engineer & Forum Moderator
Raspberry Pi Engineer & Forum Moderator
Posts: 21653
Joined: Sat Jul 30, 2011 7:41 pm

Re: Turning off camera LED

Fri May 24, 2013 1:00 pm

I given Dom a heads up on this this thread - he's going to take a look at it.
Principal Software Engineer at Raspberry Pi (Trading) Ltd.
Contrary to popular belief, humorous signatures are allowed. Here's an example...
"My grief counseller just died, luckily, he was so good, I didn't care."

dom
Raspberry Pi Engineer & Forum Moderator
Raspberry Pi Engineer & Forum Moderator
Posts: 5213
Joined: Wed Aug 17, 2011 7:41 pm
Location: Cambridge

Re: Turning off camera LED

Fri May 24, 2013 5:05 pm

Should be fixed with rpi-update firmware.

User avatar
leol
Posts: 147
Joined: Fri Jan 13, 2012 4:27 pm
Location: Haute-Vienne, France

Re: Turning off camera LED

Sat May 25, 2013 11:30 am

Thanks dom, works great now.
Has anything else changed? Still pictures seem sharper now, but could be just because the sun is shinning at last!

Leo
dom wrote:Should be fixed with rpi-update firmware.

dom
Raspberry Pi Engineer & Forum Moderator
Raspberry Pi Engineer & Forum Moderator
Posts: 5213
Joined: Wed Aug 17, 2011 7:41 pm
Location: Cambridge

Re: Turning off camera LED

Sat May 25, 2013 11:47 am

leol wrote:Thanks dom, works great now.
Has anything else changed? Still pictures seem sharper now, but could be just because the sun is shinning at last!
Stills are now higher resolution. We were previously incorrectly capturing 2Mpixel stills (rather than 5Mpixel).
http://www.raspberrypi.org/phpBB3/viewt ... 43&t=44879

User avatar
leol
Posts: 147
Joined: Fri Jan 13, 2012 4:27 pm
Location: Haute-Vienne, France

Re: Turning off camera LED

Sat May 25, 2013 12:11 pm

Brilliant! Thanks to you, jamesh, and everyone working on this. The Pi project just gets better and better.
dom wrote:
leol wrote:Thanks dom, works great now.
Has anything else changed? Still pictures seem sharper now, but could be just because the sun is shinning at last!
Still are now higher resolution. We were previously incorrectly capturing 2Mpixel stills (rather than 5Mpixel).
http://www.raspberrypi.org/phpBB3/viewt ... 43&t=44879

Kojans
Posts: 1
Joined: Sun Jan 26, 2014 2:26 pm
Location: NL, Limburg

Re: Turning off camera LED

Thu Jan 30, 2014 8:27 am

I can confirm that adding:

Code: Select all

disable_camera_led=1

in my /boot/config.txt works to switch of the camera led (2014-01-07 wheezy-raspbian)

littletinman
Posts: 5
Joined: Mon Jan 25, 2016 3:58 am

Re: Turning off camera LED

Mon Jan 25, 2016 3:59 am

Code: Select all

disable_camera_led=1
does not work in Raspbian Jessie for me. Any alternatives to the python solution?

6by9
Raspberry Pi Engineer & Forum Moderator
Raspberry Pi Engineer & Forum Moderator
Posts: 6424
Joined: Wed Dec 04, 2013 11:27 am
Location: ZZ9 Plural Z Alpha, aka just outside Cambridge.

Re: Turning off camera LED

Mon Jan 25, 2016 9:49 am

littletinman wrote:

Code: Select all

disable_camera_led=1
does not work in Raspbian Jessie for me. Any alternatives to the python solution?
What model and revision of board are you using?
Vanilla Raspbian Jessie, or NOOBS? If NOOBS, are you editing the correct config.txt?
Output of "vcgencmd version" and "uname -a" please.
Genuine Pi Foundation camera module, or one of the clones?

This is a function of the GPU firmware not the Linux side, so as long as you set the config option correctly it should just work.
BTW Be aware that on A+ and B+ boards that it is generally GPIO 32 that controls the LED, not GPIO 5.
Software Engineer at Raspberry Pi Trading. Views expressed are still personal views.
I'm not interested in doing contracts for bespoke functionality - please don't ask.

littletinman
Posts: 5
Joined: Mon Jan 25, 2016 3:58 am

Re: Turning off camera LED

Mon Jan 25, 2016 5:33 pm

I have the Raspberry Pi 2 Model B: http://www.amazon.com/gp/product/B00T2U ... detailpage

This is the camera: http://www.amazon.com/gp/product/B00E1G ... detailpage

I'm running Rapbian Jessie and can successfully take pictures etc.

I'll have to run those commands later today.

littletinman
Posts: 5
Joined: Mon Jan 25, 2016 3:58 am

Re: Turning off camera LED

Wed Jan 27, 2016 4:44 am

"vcgencmd version" yields:

Code: Select all

Nov 18 2015 15:48:41
Copyright (c) 2012 Broadcom
version 0c9af7cde38e223c95c3404f468db8fc5004495c (clean) (release)
"uname -a" yields:

Code: Select all

Linux piserver 4.1.13-v7+ #826 SMP PREEMPT Fri Nov 13 20:19:03 GMT 2015 armv7l GNU/Linux

littletinman
Posts: 5
Joined: Mon Jan 25, 2016 3:58 am

Re: Turning off camera LED

Thu Jan 28, 2016 4:05 am

So... this looks like an issue of PEBKAC.

I was taking pictures for testing in a closed cabinet under my tv so I could see the red clearly in the picture (without getting up and down all the time). Turns out the camera LED was off, I was just seeing the red from my PS3's digital audio out.... :roll: :oops:

Knightlorish
Posts: 23
Joined: Fri Jun 21, 2013 4:21 pm
Location: Northumberland, UK.

Re: Turning off camera LED

Sat Mar 12, 2016 6:46 pm

I've found with Jessie that disable_camera_led=1 in config.txt disables the camera: cue some frustration dismantling camera from Pi in carefully placed Pi.

Is there a simple way to disable the camera LED using the current Jessie?

Knightlorish
Posts: 23
Joined: Fri Jun 21, 2013 4:21 pm
Location: Northumberland, UK.

Re: Turning off camera LED

Sat Mar 12, 2016 7:02 pm

I'll quickly answer my own question in case it helps anyone else. There was a bug and it's fixed by 'sudo rpi-update', with the caveats, for a firmware update. I had a camera in a binocular eyepiece and definitely needed the LED off.

See viewtopic.php?p=922799#p922799

RaspberryPieman2016
Posts: 1
Joined: Fri Jul 29, 2016 5:16 pm

Re: Turning off camera LED

Fri Jul 29, 2016 5:25 pm

Hi Knightlorish,
I am using "2016-05-27-raspbian-jessie.img" on a Raspberry Pi Zero with camera port.
The LED is always on. I edited the /boot/config.txt file and added: disable_camera_led=1 via sudo nano
and sudo reboot.
It failed to boot-up after that. I am busy re-imaging the SD card.
Whilst doing that I found your post.

Q1. Do you mean that "there was a bug and it's fixed by 'sudo rpi-update'" - that it was fixed after my 2016-05-27 image?
Q2. If fixed do I still have to disable it by adding "disable_camera_led=1" to /boot/config.txt ?

Regards,
RaspberryPieman2016

Return to “Camera board”