Raspberry in clear acrylic enclosure from Adafruit

Heartbeat for the Raspberry Pi


By default the RPi flashes the OK LED upon access of the SD card. This is usually ok but as my RPi is in an acrylic case I was looking for an alternative. This alternative was already there.

To get the heartbeat driver loaded at boot time I added a line into /etc/modules:

ledtrig_heartbeat

The configuration is then done in a startup script I created (/etc/init.d/heartbeat):

#!/bin/sh -e
### BEGIN INIT INFO
# Provides:          hearbeat
# Required-Start:    udev $local_fs
# Required-Stop:
# Default-Start:     S
# Default-Stop:
# Short-Description: Set LED at GPIO16 in hearbeat mode
# Description: Set LED at GPIO16 in hearbeat mode
### END INIT INFO

N=/etc/init.d/hearbeat

case "$1" in
  start)
        # make sure privileges don't persist across reboots
        if [ -f /sys/class/leds/led0/trigger ]
        then
                echo heartbeat >/sys/class/leds/led0/trigger
        fi
        ;;
  stop|reload|restart|force-reload|status)
        ;;
  *)
        echo "Usage: $N {start|stop|restart|force-reload|status}" >&2
        exit 1
        ;;
esac

exit 0

Finally the startup needed to be activated by issueing

update-rc.d heartbeat defaults

The result: my RPi now has a hearbeat LED reminding me of the HP PA-RISC workstations of former times (didn’t the Sun or Apollo workstations have them as well?).

Advertisements

One thought on “Heartbeat for the Raspberry Pi”

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s