13

Can I disable the yellow (PWR?) LED on the Pi Zero?

I've tried setting the brightness to 0 of led1 (it starts life as 255) and led0 is already 0 but I still get the LED glow.

Out of interest, I only managed to set the brightness file to zero by running the following from /etc/rc.local

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

Verified after booting with the following.

$ cat /sys/class/leds/led1/brightness
0

If I try as the pi user or even via sudo, I get the following error. Even after chmod. Any ideas why?

-bash: /sys/class/leds/led0/brightness: Permission denied
Toby
  • 264
  • 2
  • 10
  • 1
    It's not a power LED, the Pi Zero has one LED, the activity LED. – joan Jan 04 '16 at 20:15
  • 1
    Makes sense, I can see ACT next to it :) – Toby Jan 04 '16 at 20:16
  • "...If I try as the pi user or even via sudo,..." I think that is a common trap where people do not realise that the redirection (of stdout to the /sys/class/leds/led1/brigthness file) occurs before the sudo command is run so it does not get the sought for privileged elevation. There is a (somewhat funky) way around it with a tee command but I do not have the details to hand...! – SlySven Jan 05 '16 at 16:11
  • Thanks. I'd tried bash -c 'echo 0 > ... with the same affect (it doesn't work). I can't quiet remember but I think there's a difference between true root (which will be the user for rc.local no?) and sudo. Anyway... I'd have to do some reading to remind myself :D – Toby Jan 05 '16 at 18:06

2 Answers2

8

Add the following to /boot/config.txt and reboot.

dtparam=act_led_trigger=none

The LED is wired with inverse logic.

Write 1 to GPIO 47 to switch it off.

Write 0 to GPIO 47 to switch it on.

joan
  • 71,024
  • 5
  • 73
  • 106
  • 1
    Thanks, that worked (along with running echo 1 | sudo tee /sys/class/leds/led0/brightness, which I put in rc.local) – Toby Jan 04 '16 at 20:23
  • 2
    You may get away with also adding dtparam=act_led_activelow=on to /boot/config.txt (so you don't need the rc.local script). It doesn't do what it should do but a side effect does seem to be the LED starts up off. – joan Jan 04 '16 at 20:26
  • Even better! That works and keeps it all in one place. Thanks again. – Toby Jan 04 '16 at 22:08
0

sudo nano /boot/config.txt

There is currently a different way to achieve this on different pi models. You may want to add model filters to config file as followingly:

#Disable Power LED (Red)
[pi3]
dtparam=pwr_led_trigger=none
[pi3+]
[pi4]
dtparam=pwr_led_trigger=default-on
[all]
dtparam=pwr_led_activelow=off

#Disable Activity LED (Green) dtparam=act_led_trigger=none dtparam=act_led_activelow=off

sudo reboot