Monitoring an INA219 chip in a Raspberry Pi battery-backed power supply

from blog Kevin Boone's website, | ↗ original
↗ original
Many battery-backed power supplies for the Raspberry Pi, and similar systems, use the INA219 current/voltage monitor IC. This device has an I2C interface by which the Pi can determine the battery voltage and current, and estimate the charge level and run-time. This article describes how to write C code that interacts with the INA219.