Skip to content

Instantly share code, notes, and snippets.

@xhip
Last active June 22, 2022 21:52
Show Gist options
  • Save xhip/423fc4dd95fcbea7f912 to your computer and use it in GitHub Desktop.
Save xhip/423fc4dd95fcbea7f912 to your computer and use it in GitHub Desktop.
Raspberry Pi model 2 B, B+ and A+ onboard LED control
#!/bin/bash
# Raspberry Pi model 2 B, B+ and A+ onboard LED control.
#
# <led>:
# led0 = ACT = Green
# led1 = PWR = Red
#
# Turn leds on (1) or off (0):
# echo 1 | sudo tee /sys/class/leds/<led>/brightness
# echo 0 | sudo tee /sys/class/leds/<led>/brightness
#
# Triggers:
# - <option>:
# [none] mmc0 timer oneshot heartbeat backlight gpio cpu0 cpu1 cpu2 cpu3 default-on input rfkill0 rfkill1 phy0rx phy0tx phy0assoc phy0radio
# - defaults:
# led0 = mmc0
# led1 = input
# -cmd:
# echo <option> | sudo tee /sys/class/leds/<led>/trigger
#
#Disable for good the ACT LED.
dtparam=act_led_trigger=none
dtparam=act_led_activelow=off
#Disable for good the PWR LED.
dtparam=pwr_led_trigger=none
dtparam=pwr_led_activelow=off
#-------------------------------
#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
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment