ODROID-C2 Power LED when Kodi is running?

  • Hi all, forgive me if this has been covered already but my attempt at a search did not lead me far.

    I have just housed my ODROID-C2 in a Ali box purchased off eBay. The case is used as a heatsink and overclocking the C2 works just fine.

    I would like an LED on the front that shows when Kodi is powered up (ON/OFF via remote) I'm guessing this would be done via the GPIO pins and a line or two of code but not sure where to start, any pointers appreciated.

  • Suss'd it and it was actually easier than I thought.

    • First I connected a 3.5mm hi effeciency White LED in series with a 18K resistor. The reason for such a high value was to limit the brightness in a darkend room. It is just a status LED not a torch.
    • I then connected between 0V & GPIO pin 249 (Pins 7 & 9) of the J2 header.
    • In Libreelec there are two scripts available one for startup and another for shutdown. Using this reference I edited the files.
    Code
    nano /storage/.config/autostart.sh

    and added the following lines

    Code
    echo 249 > /sys/class/gpio/export
    echo out > /sys/class/gpio/gpio249/direction
    echo 1 > /sys/class/gpio/gpio249/value
    Code
    nano /storage/.config/shutdown.sh

    and added the following lines

    Code
    echo 0 > /sys/class/gpio/gpio249/value

    This probably is not the best way to do it but it works.

    On the bench I have a small test setup and the box is connected direct to the TV supporting HDMI CEC. The LED comes on with bootup but not when the TV turns OFF as Kodi is still running. I know this cos when you turn the telly on again Kodi is on the same page. Tis no biggy as the main setup is via a AVR and harmony remote which powers everything down itself.