Raspberry Pi – Control the on board LED lights

If you want to control a LED from the command line, but you’re not comfortable using the GPIO (and perhaps soldering), then feel free to use the HDD Status LED on the Raspberry Pi chip.

It’s a fun feature, but pretty useless. Most of Raspberry Pi’s LEDs are hardware-controlled, meaning you can’t control them from the operating system or software. But if you don’t mind the other LEDs flashing distractingly, then it might be more useful to you.

First you want to disable the trigger with:

echo none > /sys/class/leds/led0/trigger

Now you’re free to set the state. It goes from 0 to 255, but anything above 0 will turn the LED on. The follow would light it up:

echo 1 >/sys/class/leds/led0/brightness

And this would shut it down:

echo 0 /sys/class/leds/led0/brightness

I’d suggest a full reboot to restore the diode when (if?) you’re done playing with it.

(You might need to use sudo, as with anything fun. At your own risk and so on.)

Leave a Reply

Your email address will not be published.