Controlling PWR and ACT LEDs on the Raspberry Pi

All Raspberry Pi models have a few built-in LEDs; the earlier models had PWR, ACT, and networking status LEDs all lined up on the board itself; for the B+ and model 2 B, the networking LEDs moved onto the network jack itself, leaving just two LEDs; PWR (a red LED) and ACT (a green LED).

Normally, whenever the Pi is powered on—except if the power supply dips below something like 4.5VDC—the red PWR LED remains lit no matter what. If you wanted to 'disable' the LED, you'd have to put a piece of tape or something else over the LED, or get out a soldering iron and modify the hardware a bit.

Raspberry Pi model 2 B, B+ and A+

Luckily, with the Pi 2 model B, B+, A+, and Zero, you can control the LEDs in software, in a few different ways. The simplest way to change the way these LEDs work is to modify the trigger for each LED by setting it in /sys/class/leds/led[LED_ID]/trigger, where you replace [LED_ID] with 0 for the green ACT LED, and 1 for the red PWR LED.

For example:

# Set the PWR LED to GPIO mode (set 'off' by default).
echo gpio | sudo tee /sys/class/leds/led1/trigger

# (Optional) Turn on (1) or off (0) the PWR LED.
echo 1 | sudo tee /sys/class/leds/led1/brightness
echo 0 | sudo tee /sys/class/leds/led1/brightness

# Revert the PWR LED back to 'under-voltage detect' mode.
echo input | sudo tee /sys/class/leds/led1/trigger

# Set the ACT LED to trigger on cpu0 instead of mmc0 (SD card access).
echo cpu0 | sudo tee /sys/class/leds/led0/trigger

I'm using this ability to turn off the bright red PWR LED on my Raspberry Pis, as I use decent power supplies and would rather save the few mW used by the LED so I can save a penny or two over the next couple years :)

If you want to disable both LEDs permanently, add the following to /boot/config.txt:

# Disable the ACT LED.
dtparam=act_led_trigger=none
dtparam=act_led_activelow=off

# Disable the PWR LED.
dtparam=pwr_led_trigger=none
dtparam=pwr_led_activelow=off

Raspberry Pi Zero

The Pi Zero's values are opposite, and it only has one LED, led0 (labeled 'ACT' on the board). The LED defaults to on (brightness 0), and turns off (brightness 1) to indicate disk activity.

If you want to turn off the LED on the Pi Zero completely, run the following two commands:

# Set the Pi Zero ACT LED trigger to 'none'.
echo none | sudo tee /sys/class/leds/led0/trigger

# Turn off the Pi Zero ACT LED.
echo 1 | sudo tee /sys/class/leds/led0/brightness

To make these settings permanent, add the following lines to your Pi's /boot/config.txt file and reboot:

# Disable the ACT LED on the Pi Zero.
dtparam=act_led_trigger=none
dtparam=act_led_activelow=on

Comments

As a footnote, I'm using these capabilities on my onboard-led-setup script for the Raspberry Pi Dramble project.

Many thanks!

Thanks! I've turned off the leds on all my headless Pi's.
You probably already know this one, but you can turn off the HDMI circuits with
/usr/bin/tvservice -o
saves a little more current (I read somewhere about 28ma).

I just checked, and it does indeed save ~30 mA. Thanks!

haw to cut off hdmi? but i use kali linux at RPI? thanks

Great article!

That did the job! I've started a 1-year time-lapse movie project and was getting a red arc in one corner of every photo in low light, and it's now gone away. Thanks!

NuBe here. How would I put these lines in a Python script
Thanks in advance for any help.

Hey Jeff, great article. I've got a question, though- is sys/class/leds/led1 only defined for the model 2 B? I've tried it on a B+, and sys/class/leds only contains led0. I don't have access to a 2 B at the moment to check...

Could be... I don't have my B+ anymore to test with, though on a Pi 3 it's the same—no led1, just led0 which is the green ACT LED.

Great article, Worked great on my PI2 but for some reason not on the PI3. But have to figure it out.

It seems like you can only control one of the two LEDs on the Pi 3. I'm looking into this.

The interesting thing for me was that the Pi3 kept the red light off with OpenELEC, but with Raspbian, it stays on. Once I connected the 7" touch screen to the OpenELEC Pi, the red light stays on. Not sure if this helps to determine a setting. It would sure be nice to keep the lights off on my surveillance devices.

I have OpenELEC 6.0.3 installed on my Pi3 and only the red power light seems to work. It is solid red all the time the power is on. The green activity light shows no signs of life either during boot or during a long file transfer to the SD card in the Pi3 :(

I read somewhere that: On the Pi3 the activity and power LED are no longer connected to Pi (0-53) GPIO. They are connected to an internal I2C GPIO port expander. But this doesn't mean that much to me!!

Any more info and how to get the green activity light on OpenELEC 6.0.3 would be greatly appreciated.

I just noticed that if I shut down my Pi3 OpenELEC 6.0.3 through Kodi GUI or execute poweroff command in SSH then after it powers down the green activity light is solid green until I boot my Pi3 again when it goes out.

Same here KnightAzul. When i power off my pi3 via gui or ssh, the green light turns on, the red one stays on. Actually i was expecting just the red one to be on, because the red is meant to stay on all the time. But i was not expecting the green to be constantly on after pi 3 power off via gui and i think it's a malfunction. Any comments would be appreciated.

Does anyone know the GPIO # for the ACT LED on the Pi Zero? I'm trying to make it flash to show when my script is running, but I can't seem to find the right # to control it.

as described above... no need of GPIO here.

Set the Pi Zero ACT LED trigger to 'none':
echo none | sudo tee /sys/class/leds/led0/trigger

Turn off the Pi Zero ACT LED:
echo 1 | sudo tee /sys/class/leds/led0/brightness

Turn on the Pi Zero ACT LED:
echo 0 | sudo tee /sys/class/leds/led0/brightness

I tried using your permenant solution on my Pi 2 Model B, but when I try to save the config file I am told I don't have permission. Suggestions?

@Michael - you may need to use sudo before the editor command so the file can be saved successfully.

The permanent solution listed above involves editing the config.txt file, so I don't think there the possibility of using a sudo command. Am I mistaken? Can I open the config.txt file in the editor window and then append the six lines of code to the bottom somehow?

Short and straightforward, thanks! Applied it on my Rpi2.