This is a simple GUI application for Raspberry Pi that displays the battery status. It uses the INA219 sensor to measure the battery voltage, current, power, and percentage.
- Python 3
- Tkinter
- smbus
- INA219.py library (included in this repository)
-
Ensure Python 3 is installed on your system. You can download it from the official Python website.
-
Install the smbus library using pip:
pip install smbus
Run the script using Python:
- For the battery status gui application:
python3 battary_status.py
- For the battery status gui application and shutdown the Raspberry Pi when the battery is low gracefully. Not recommended to run this script. It is under development and not throughly tested.
python3 battary_status_graceful_shutdown.py
Note: You need to have the INA219 sensor connected to your Raspberry Pi. This code is tested with the Waveshare UPS HAT B board.