Raspberry Pi – Controlling PWR and ACT LEDs (Red and Green LEDs)

To totally unlock this section you need to Log-in

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; from 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 4 Model B

In Raspberry Pi 4, using Raspbian (Raspberry Pi OS), we can use the following approach to shut off the two LEDs (PWR and ACT) on the board. First, we can test the following two commands to ensure that the LEDs can be changed directly from the terminal:

echo 0 >/sys/class/leds/led0/brightness #Turn off Green LED
echo 0 >/sys/class/leds/led1/brightness #Turn off Red LED

Additionally, if we want to be sure that after a reboot the LEDs will not be again activated, we can always use the /etc/rc.local approach, by putting the above commands in the configuration, as displayed below:

#!/bin/sh -e
# rc.local
# This script is executed at the end of each multiuser runlevel.
# Make sure that the script will "exit 0" on success or any other
# value on error.
# In order to enable or disable this script just change the execution
# bits.
# By default this script does nothing.

# Print the IP address
_IP=$(hostname -I) || true
if [ "$_IP" ]; then
  printf "My IP address is %s\n" "$_IP"
echo 0 >/sys/class/leds/led0/brightness #Turn off Green LED
echo 0 >/sys/class/leds/led1/brightness #Turn off Red LED
exit 0

Another way to turn them off is by writing the appropriate value to /sys/class/leds/led1/trigger and to /sys/class/leds/led0/trigger.

To switch it off use none, as follows:

sudo su
echo none > /sys/class/leds/led0/trigger     # Replace led0 to led1 to turn off also the second LED.

Use default-on to reverse it.

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 some ways, and the simplest way 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.

# 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

This will save few mW (milliWatts) used by the LEDs (well, a very small saving, but always a saving, so I recommend to shut them off anyway).

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

# Disable the ACT LED.
# Disable the PWR LED.

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. To completely turn off the LED on the Pi Zero completely, we will have to 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.

Article Name
Raspberry Pi - Controlling PWR and ACT LEDs (Red and Green LEDs)
Raspberry Pi models have a few built-in LEDs; the modern models have a PWD and a ACT LEDs, that can be turned off quite easily directly by software, to save a bit of mW (energy) and letting it to run without disturbing lights.
Publisher Name