5.2 Control LEDs
The Pi has a couple of LEDs: power indicator, memory activity indicator, network status, whatnot. Two of those can be controlled: the red one (PWR) and the green one (ACT). By default, the PWR one is always lit as long as the power supply does not dip below 4.5V and the green one indicates memory activity.
Configure LED settings
Pi model 2 B, B+ and A+
With those models you can control the LEDs by writing to /sys/class/leds/led{number}/trigger
, where {number}
is either 0
for the green ACT led, or 0
for the red PWR led. The values written to those paths control how the LEDs are triggered, as follows:
gpio
- controlled through GPIO (off by default)heartbeat
- heartbeat-like pulsetimer
- pulse every secondinput
- under-voltage detectionmmc0
- memory I/Ocpu0
- CPU activity
E.g., the defaults are set as follows:
# Red LED indicates enough power:
echo input | sudo tee /sys/class/leds/led1/trigger
# Green LED indicates memory:
echo mmc0 | sudo tee /sys/class/leds/led0/trigger
The brightness of the LED itself can be set by writing to /sys/class/leds/led{number}/trigger
. Since the LEDs do not support a gradient of brightness values, every value over 0
counts as full brightness:
# LED off
echo 0 | sudo tee /sys/class/leds/led1/brightness
# LED on
echo 1 | sudo tee /sys/class/leds/led1/brightness
Pi Zero
The Pi Zero has no PWR led, only the green ACT led, located at /sys/class/leds/led0/trigger
. The brightness values are also reversed, which means the LED can be turned off using the following:
echo none | sudo tee /sys/class/leds/led0/trigger
echo 1 | sudo tee /sys/class/leds/led0/brightness
Disable LEDs permanently
Setting the LED triggers as described above does not make the setting permanent across reboots. Here's how to accomplish that: edit /boot/config.txt
by adding the following lines:
dtparam=act_led_trigger=none
dtparam=act_led_activelow=off
dtparam=pwr_led_trigger=none
dtparam=pwr_led_activelow=off
Pi Zero
Again, because the brightness values of the Zero are reversed, we use 'on' instead of 'off':
dtparam=act_led_trigger=none
dtparam=act_led_activelow=on