HALPI2
is a Raspberry Pi Compute Module 5 based boat computer. halpid
is a power monitor and watchdog service for HALPI2. It communicates with the HALPI2 controller, providing the "smart" aspects of the operation. Supported features include:
- Blackout reporting if input voltage falls below a defined threshold
- Triggering of device shutdown if power isn't restored
- Supercap voltage reporting
- Watchdog functionality: if the HALPI2 receives no communication for 10 seconds, the controller will hard reset the device.
- RTC sleep mode: the onboard real-time clock can be set to boot the Raspberry Pi at a specific time. This is useful for battery powered devices that should perform scheduled tasks such as boat battery and bilge level monitoring.
- Power-cycling the USB ports: the HALPI2 can power-cycle the USB ports, which is useful if a connected device becomes unresponsive.
The main use case for the service software is to have the Raspberry Pi operating system shut down once the power is cut. This prevents potential file system corruption without having to shut down the device manually.
End-users should install the halpid
package using apt
:
sudo apt install halpid
The APT repository is available at https://apt.hatlabs.fi.
When developing, you can install the source code by cloning the repository and running:
./run install
This will install halpid
and its dependencies in a virtual environment, allowing you to run the daemon and test it.
The halpid
daemon can be configured using a configuration file.
The default configuration file location is /etc/halpid/halpid.conf
.
For example, if you want to change the blackout time limit to 10 seconds andthe poweroff command to /home/pi/bin/custom-poweroff
, you can edit the configuration file as follows:
blackout-time-limit: 10
poweroff: /home/pi/bin/custom-poweroff
For a more detailed HALPI2 documentation, please visit the documentation website.
HALPI2 devices are available for purchase at shop.hatlabs.fi.
The halpi
command-line interface provides access to device status, configuration, and control:
halpi status
- Show device status and measurementshalpi version
- Show version informationhalpi get <key>
- Get specific measurement or valuehalpi config
- Show all configuration settingshalpi config <key>
- Get specific configuration valuehalpi config <key> <value>
- Set configuration valuehalpi shutdown
- Shutdown the devicehalpi shutdown --standby --time <time>
- Enter standby modehalpi flash <firmware-file>
- Update device firmware
# Check device status
halpi status
# Get input voltage
halpi get V_in
# Set watchdog timeout to 30 seconds
halpi config watchdog_timeout 30
# Schedule standby wakeup in 3600 seconds
halpi shutdown --standby --time 3600