PiCheckVoltage is a project for the Raspberry Pi intended to provide a mean to check voltage of a battery pack which is used to power electronic assemblies connected to the Raspberry Pi, and execute scripts depending on battery level.
Wanting to power MovingRaspi with a battery pack, I faced some technical “challenges”:
Providing a stable 5V voltage (which need to power electronic assembly, and optionally the Raspberry Pi itself).
Monitoring battery voltage in order to stop MovingRaspi server (then preventing powering motors), and properly shutdown the Raspberry Pi if it's battery powered when battery level goes too low.
Providing a “kill switch” in order to switch off voltage regulator (thus +5V power supply) when battery level goes really too low.
And here comes PiCheckVoltage, an hardware and software set which provides the following features:
A voltage regulator with a +5V / 3A output (L78S05CV).
A “kill switch” based BCU81 transistor (30V / 3A, minimal gain of 140).
A voltage measuring unit based on a MCP3008 ADC, with a resistor voltage divider.
Two status LED to quickly know if battery voltage is OK or not.
On the software side, there's a Python software, running in background and perpetually monitoring battery voltage, with the following features:
Run scripts depending on battery level (unplugged, dangerously low voltage, low voltage, normal voltage).
Status LED driving depending on battery level (unplugged, low voltage, normal voltage).
“Kill switch” driving depending on battery level (dangerously low voltage).