12

I need to disable all LEDs on my Raspberry Pi 3s otherwise they interfere with the operation of my camera setup. I use Raspbian Jessie.

I can successfully use the following code:

echo 0 >/sys/class/leds/led0/brightness
echo 0 >/sys/class/leds/led1/brightness

Both LED go dark - I am happy. However, if I put these commands in rc.local or in a script called by rc.local, most of the times (but not always) one of those LEDs (in particular the red one) will not turn off. If I ssh into the Pi and repeat the command it will correctly turn off.

When the LED is not turned off, the brightness value contains 255:

# cat /sys/class/leds/led1/brightness
255

like if some other program sets it back up after rc.local is executed.

I have also tried to add:

echo none >/sys/class/leds/led0/trigger
echo none >/sys/class/leds/led1/trigger

But it did not have any effect.

What entity/program might interfere with LED brightness at boot time?

Also note: I have tried to add a 5 to 15 seconds delay to the execution in rc.local but the problem did not disappear, in fact I did not see any difference

Alessio Sangalli
  • 223
  • 1
  • 2
  • 5

5 Answers5

17

For the Raspberry Pi 2 you can add the following lines to /etc/rc.local:

sudo sh -c 'echo none > /sys/class/leds/led0/trigger'
sudo sh -c 'echo none > /sys/class/leds/led1/trigger'
sudo sh -c 'echo 0 > /sys/class/leds/led0/brightness'
sudo sh -c 'echo 0 > /sys/class/leds/led1/brightness'

Maybe it works for RPi3 too?

Aurora0001
  • 6,308
  • 3
  • 23
  • 38
MosEisley
  • 186
  • 1
  • 2
  • 2
    This worked for me too. An FYI though, the lights still come for roughly 30 seconds at boot. This is fine by me though. – Ben Mar 09 '18 at 15:15
  • Worked for me on the raspberry pi 3 model b. The light does stay on for a little bit at boot, but then goes off. – EllipticalInitial Dec 31 '19 at 06:44
6

Add the following lines to /boot/config.txt:

# Disable Activity LED
dtparam=act_led_trigger=none
dtparam=act_led_activelow=off

Disable Power LED

dtparam=pwr_led_trigger=none dtparam=pwr_led_activelow=off

Then reboot your Pi and both LEDs should be off permanently. Just tried it myself.

My source: https://buyzero.de/blogs/news/raspberry-pi-strom-sparen-tipps-tricks

UPDATE: This doesn't seem to work for the Power LED on the latest Raspbian (Buster). The image I was using at the time was a much older version (Stretch or possibly even older). If you're using Buster, for the power LED you need to the commands from MosEisley's answer.

Lasse Meyer
  • 161
  • 1
  • 3
  • I found this somewhere else so I think you have a typo in dtparam=pwr_led=activelow=off, this should be dtparam=pwr_led_activelow=off (at least for me it works only in this Version (with the underscore instead of the equals sign) – atticus Jul 06 '20 at 21:27
  • 1
    @atticus thanks, I corrected it in the answer – Lasse Meyer Jul 07 '20 at 08:45
3

You can also add this to config.txt to turn off both Ethernet LEDs, on a Pi 3 and later:

# Disable the Ethernet LEDs.
dtparam=eth_led0=14
dtparam=eth_led1=14

Note that if you're using the config.txt method to turn off the power and activity LEDs, you should not use the /sys/class/leds/ method as well. This is because the config.txt method inverts the LED behaviour, which results in echoing 0 to /sys/class/leds/led0/brightness turning the LED on again. (In this case echoing 255, which normally turns the LED on, now turns it off instead.)

Malvineous
  • 1,874
  • 14
  • 20
  • Thanks for the comment about the inversion of the LEDS! Couldn't find out why my LED remained on but it was due to inversion indeed. So to turn my LED off without rebooting I had to use echo 255 > /sys/class/leds/led1/brightness – brechtvhb Jun 13 '23 at 06:40
0

In Raspbian GNU/Linux 12 (bookworm) on a Raspberry Pi 3 Model B Rev 1.2 it does not work to disable the power LED with the modifications to config.txt and the paths to /sys/class/leds/led0/brightness and /sys/class/leds/led1/brightness do not exist.

The following command works:

sudo sh -c 'echo 0 > /sys/class/leds/PWR/brightness'

SysRq
  • 1
0

on rpi 3 with kodi 9.2.x I did it by adding a file autostart.sh (chmod +x) in /storage/.config folder

#!/bin/sh
echo 0 >/sys/class/leds/led1/brightness
echo none >/sys/class/leds/led1/trigger

power led turn on when rebooting but turn off after script execution

G_Freeman
  • 1
  • 1