Ecosyste.ms: Awesome

An open API service indexing awesome lists of open source software.

Awesome Lists | Featured Topics | Projects

https://github.com/petrockblog/powerblock

Driver for petrockblock.com PowerBlock
https://github.com/petrockblog/powerblock

petrockblock power-switch raspberry-pi raspberrypi

Last synced: 22 days ago
JSON representation

Driver for petrockblock.com PowerBlock

Awesome Lists containing this project

README

        

PowerBlock Driver
=================

This is the driver for the petrockblock.com [PowerBlock](https://blog.petrockblock.com/powerblock-raspberry-pi-power-switch/),
which is an extension board for the Raspberry Pi (TM). The driver itself is denoted as _powerblock_ in the following. The
driver provides a service for interacting with the power button signal as well as driving the optionally attached LED.

:exclamation: The following description is intended to be used in combination with a Raspberry Pi and a
**Linux-based operating system** running on the Raspberry Pi. There is a **driver for Windows 10 IoT Core** that can be
found at https://github.com/petrockblog/PowerBlockWinIoT/releases :exclamation:

## Installation

There comes an installation script with this reposity that does all the steps described below: `install.sh` This script
compiles the driver, installs the binary and configuration files, and installs the PowerBlock service.

To run the quick installation, you just need to call this one line from the Raspbian console

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

To uninstall the service you can simply call `sudo ./uninstall.sh` from within the `PowerBlock` directory.

## Configuration

The configuration file of _powerblock_ is located at ```/etc/powerblockconfig.cfg```. It uses simple .ini file syntax = for setting the the values of its configuration parameters.

The parameters are explained in detail in the following:

- ```activated```: Can be set to
+ ```1```: Activates the handling of the power switch signals of the PowerBlock.
+ ```0```: Deactivates the handling of the power switch signals of the PowerBlock.
- ```statuspin```: Raspberry BCM pin used for status signaling (default: 17) connects to S2 on PowerBlock
- ```shutdownpin```: Raspberry BCM pin used for shutdown signaling (default: 18) connects to S1 on Powerblock
- ```logging```: Enables or disables logging via syslog to /var/log/syslog. The logging is enabled if set to 1.

## Logging

The PowerBlock driver logs certain events in the file `/var/log/syslog`.

## Shutdown Script

When the driver observes a shutdown signal from the PowerBlock, a shutdown Bash script is called. You can find and edit
it at `/etc/powerblockswitchoff.sh`.

## LibreELEC Installation

This section is about installing the PowerBlock service on LibreELEC. In the following, it is assumed that we install the driver on a fresh, unmodified LibreELEC installation.

First, use SSH to log into the running LibreELEC instance. This can be done, e.g., with the command `ssh root@IP_OF_LIBREELEC`. The default password is `libreelec`.

Being logged in, the actual driver installation is done with this command:

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

And that's it!




__Have fun!__

-Florian [petrockblock.com](http://blog.petrockblock.com)