This is a set of Python scripts which use an analog-to-digital converter (ADC) to measure a battery's voltage and display a status icon on the screen. It supports the Microchip ADCs MCP3001, MCP3008, MCP3208 and MCP3551. These scripts are intended to be used on a Raspberry Pi running. This project is based on (https://github.com/floppes/batmon).
Dispmanx is used to create a layer on the screen where the battey icon is displayed. It needs to be installed first with this set of commands:
cd ~
mkdir develop
cd develop
git clone https://github.com/AndrewFromMelbourne/raspidmx.git
cd raspidmx
make
sudo cp /home/pi/raspidmx/lib/libraspidmx.so.1 /usr/lib
git clone https://github.com/trngaje/batguiserver.git
cd batguiserver
make
Install batmon with these commands:
cd ~/develop
git clone https://github.com/trngaje/batmon.git
cd batmon
Run nano config.py
to open the configuration file and adjust the settings to your needs.
To test your configuration run python main.py
. Press CTRL+C to quit.
If you are satisfied with the result, you can make the script automatically start on every boot by adding the line python /home/pi/batmon/main.py &
(the ampersand at the end is important!) to the file /etc/rc.local
before the line exit 0
. You will need to be root to edit the file (sudo nano /etc/rc.local
).