Controlling the power LED and activity LED on your Raspberry Pi 2

This post is a tip for those who are planning to deploy a Raspberry Pi at a remote location. This tip is especially useful if the Raspberry Pi is located at a remote location and it is not possible to connect a monitor to the HDMI output of the Raspberry Pi (unless the Raspberry Pi is removed from its location) e.g. Outdoor deployment, next to a fish tank, christmas tree etc.

I was recently in a similar situation and I learned that the onboard LEDs of the Raspberry Pi are connected to the GPIO pins of the BCM2836 and it is possible to control them using kernel modules(Link). I learned that adding a couple of lines to the /etc/rc.local script before the ‘exit 0’ line (shown in the code snippet below) enables blinking the power indication LED and SD card activity LED together after the Raspberry Pi has successfully finished loading the different kernel modules (i.e. at the end of a successful boot)

Since the power indication LED and the SD card activity LED blink with a unique heartbeat sequence at the same time, it enables verifying if the Raspberry Pi is booting up correctly or rule out the possibility of a corrupted SD card while trying to fix problems with your project that is being powered by a Raspberry Pi. This tip might not be helpful to verify the Raspberry Pi’s operational health under bright sunlight as it is hard to determine whether the LEDs are glowing under bright sunlight.

Do you have similar tips for troubleshooting? Let us know. I will test it out and blog about it.

Note: I have verified the above tip using a Raspberry Pi 2 Model B. It should be similar in other cases as well (let me know if it is otherwise).

 

 

Leave a Reply