Add a Power Button to Your LibreELEC Installation on a Raspberry Pi

by petrockblog in Circuits > Raspberry Pi

3240 Views, 3 Favorites, 0 Comments

Add a Power Button to Your LibreELEC Installation on a Raspberry Pi

IMG_2692-1024x768.jpg

In the following we will learn how to add a power button to LibreELEC running on a Raspberry Pi. We will use a PowerBlock to not only add a power button, but also a status LED that indicates the power status of you LibreELEC installation.

For these instructions we need

  • a Raspberry Pi
  • Raspberry Pi accessories like power supply, SD card, ethernet cable
  • a PowerBlock
  • a power button and cables for attaching it to the PowerBlock
  • (optionally) a status LED and cables for attaching it to the PowerBlock

Download LibreELEC

Screenshot 2020-02-13 at 21.13.28.png

For these instructions we are going to install LibreELEC on a Raspberry Pi. Therefore, we go to https://libreelec.tv/raspberry-pi-4/ and click the .img.gz link to start the download.

Install LibreELEC on an SD Card

Screenshot 2020-02-13 at 21.18.05.png

Now we are going to load the downloaded image to an SD card. I recommend to use Etcher for that. You can find it at https://www.balena.io/etcher/. It is a tool for writing SD card images and is available for all major platforms.

Hardware Setup

IMG_2692-1024x768.jpg

When you have loaded the LibreELEC image onto the SD card, put it into the Raspberry Pi. If not already done, connect the HDMI cable and the Ethernet cable with the Raspberry Pi.

Then attach the PowerBlock to the GPIO header of the Raspberry Pi.

Attach a power button and, optionally, a status LED to the PowerBlock.

Finally, attach the USB power cable to the PowerBlock.

Power on and SSH Into LibreELEC

Screenshot 2020-02-13 at 21.32.45.png

Switch on the Raspberry Pi with the power button and wait for LibreELEC to finish booting.

Next we want to SSH into the running LibreELEC instance. Therefore, we need the IP address of it. You can find it, e.g., via the settings - network menu from within LibreELEC. Log into LibreELEC with the tool of your choice. From a Mac or Linux command line, e.g., you could call ssh root@IP_OF_YOUR_LIBRELEC_INSTANCE. The default password of LibreELEC is libreelec.

Installation of the PowerBlock Service

Screenshot 2020-02-13 at 21.37.31.png

For the installation of the PowerBlock driver we follow the instructions from the official Github repository. Install the PowerBlock service with the following command:

wget -O - https://raw.githubusercontent.com/petrockblog/PowerBlock/master/install_libreelec.sh | bash

The installation finishes and the driver is started automatically.

Test, If It Is Working

With the driver being installed, you should be able to switch off and on the Raspberry Pi with the power button that you attached to the PowerBlock.