Repository navigation
Power System Check
Nov 14, 2026 · Scott Sheppard with help from Claude.ai
One command, battery-check.py, shows whether a station's power system is working as designed: every check reads PASS after 24 hours on the station's own power. This guide is for anyone deploying a DigiPi station on a 12 V battery for the first time, or after changing anything in the power system (supply, battery, charger, solar panel, radio).
Nothing extra has to run for the check. The battery monitor (battery_monitor.py, running as battery.service) reads the INA226 every 2 seconds, tracks state of charge by counting amp-hours, and logs one row a minute around the clock. battery-check.py reads that log and the Pi's undervoltage flags.
The guide assumes this hardware:
| Part | Example used here |
|---|---|
| Raspberry Pi running DigiPi | Pi 3B+ (also Pi 4 or 5) |
| Battery | 12 V 10 Ah LiFePO4 |
| Pi power | 9–36 V to 5 V 5 A buck converter, set to 5.1–5.2 V |
| Battery monitor | INA226 0–36 V 20 A module, 0.002 Ω (R002) shunt, address 0x40 on I2C bus 3 |
| Charging | 50 W solar panel with charge controller, or a LiFePO4 mains charger |
| Loads | Pi, GPS, Wi-Fi radios, Baofeng UV-5RM for APRS |
The station build (station-build.sh 2.2 and later) installs the battery monitor, APRS telemetry and battery-check.py. For a manual install and wiring, see the INA226 Battery Monitor wiki page. Scripts are in the ina226 folder of sonoaltercocker/Scott-weewx-aprs.
Current sign used throughout (same as the battery monitor and the APRS telemetry): positive (+) means the battery is charging. Negative (−) means it is discharging (running the load).
These checks take under a minute and confirm the monitor and the Pi's supply are healthy right now.
| Check | Command | Good result |
|---|---|---|
| INA226 is on the I2C bus | sudo i2cdetect -y 3 |
40 appears in the grid |
| Battery monitor running | systemctl is-active battery |
active |
| Live readings |
sudo journalctl -u battery -f (Ctrl+C to stop watching) |
A line every 2 s with volts, amps, SoC |
| Latest reading | cat /dev/shm/battery_now.json |
Sensible voltage (12.8–14.6 V) and current |
| Pi 5 V supply | vcgencmd get_throttled |
throttled=0x0 |
I2C bus. On a DigiPi with an RTC, bus 1 shows UU at 0x68 (the clock). The station build puts the INA226 on its own software bus 3 (GPIO 23/24, pins 16/18).
Reading get_throttled. 0x0 means no undervoltage since boot. 0x50000 means undervoltage happened earlier; 0x50005 means it is happening now. Either one means the 5 V supply needs a higher setting, a shorter or thicker lead, or more current capacity. The flags reset at each reboot, so the check after a long run is the one that counts.
Let the station run for at least 24 hours on the power it will be deployed with, then run one command:
battery-check.py # last 24 hours
battery-check.py --hours 6 # a shorter period24 hours covers a full day and night, so charging and overnight discharge both show. The battery monitor logs around the clock, so there is nothing to start or stop.
When to run a check:
- At first deployment
- After any power change: supply, battery, charger, panel, or a new load or radio
- When moving a station to a new site or to solar only
- Seasonally, especially in winter when solar is weakest
- When something seems wrong: missed APRS packets, unexpected reboots
What it checks:
| Check | Pass |
|---|---|
battery.service running |
active |
| Latest reading | Under 2 minutes old |
| Pi 5 V supply | No undervoltage since boot |
| Log gaps | None over 5 minutes (a gap means the monitor stopped: reboot or power loss) |
| Lowest battery voltage | Above 12.5 V |
| Daily balance | Net loss under 10% of capacity per day (1 Ah for a 10 Ah battery) |
It also prints the voltage range, amp-hours in and out, state of charge at start and end, and the peak load. It exits with status 0 when every check passes, 1 otherwise.
Not installed? Stations built with station-build.sh 2.2 or later already have it. On other systems:
sudo remount
sudo wget -O /usr/local/bin/battery-check.py https://raw.githubusercontent.com/sonoaltercocker/Scott-weewx-aprs/main/ina226/battery-check.py
sudo chmod 755 /usr/local/bin/battery-check.pyWhere the log is. The station build keeps it on the /data partition at /data/battery/battery_log.csv, so it survives reboots. A manual install writes ~/battery_log.csv, or /tmp/battery_log.csv when the home folder is read-only (lost at reboot). battery-check.py uses whichever is newest; give another file with --log FILE.
A healthy station shows four things: charging when the sun or charger is on, a steady load when it is off, a battery back near full after a day's cycle, and no undervoltage.
| Area | What to look for | Normal | Investigate |
|---|---|---|---|
| Charging | Current while sun or charger is on | Positive (+), voltage rises toward 14.4–14.6 V | About −0.4 A in full daylight |
| Discharging | Current at night, no charger | Steady about −0.4 A (5.5–6 W) | Well above normal with no cause |
| Daily balance |
net Ah over 24 h |
0 or positive | −1 Ah or worse, day after day |
| Battery voltage | Lowest voltage | Above 12.8 V | Below 12.5 V |
| Pi supply | get_throttled |
0x0 |
Anything else |
Charging. Solar charge controllers hold a full battery at a float voltage of about 13.5–13.8 V. After a mains charger has taken the battery to 14.5 V, the voltage drifts down to float with near-zero current. That is normal, not a fault. Some mains chargers cycle on and off near full, so the current flips between charging and discharging every few minutes.
Discharging. Short spikes of −1.3 to −2 A are radio transmissions. One-a-minute log rows catch only some of them; peak load shows the largest.
Daily balance. in and out count only current through the battery. When the charger or panel carries the load directly, the battery barely moves. The figures come from one row a minute, so treat them as close estimates.
State of charge (SoC). The monitor counts amp-hours in and out, and resets to 100% when the voltage is at least 14.0 V and the charge current has tapered below 0.5 A for 2 minutes. Its SoC is reliable after the first full charge. Voltage alone gives SoC only after the battery has rested an hour or more (no charge, no load); readings above 13.6 V right after charging are surface charge. The monitor's resting table:
| Resting voltage | Approximate SoC |
|---|---|
| 13.60 V | 100% |
| 13.40 V | 95% |
| 13.32 V | 90% |
| 13.25 V | 70% |
| 13.15 V | 50% |
| 13.05 V | 30% |
| 12.90 V | 15% |
| 12.50 V | 5% |
| 12.00 V | 2% |
Battery health. Two checks, a few times a year:
-
Capacity test. Charge fully, disconnect the charger and solar, and let the station run until the monitor shuts the Pi down (5% or 12.0 V). After powering back up, run
battery-check.py --hours N, where N covers the whole run.outis close to the real capacity. Near the rated 10 Ah is healthy; under about 8 Ah means the battery is aging. - Voltage sag. Compare the voltage during a transmit spike with the voltage just before it, and divide the drop by the extra current. Example: a drop of 0.19 V for 1.5 A extra is about 0.12 Ω, wiring included. Track this number over time; a rising value points to an aging battery or a loose or corroded connection.
A test station (Pi 3B+, GPS, two Wi-Fi radios, UV-5RM beaconing APRS every 5 minutes) passed its power checks after a new 5 A buck converter was fitted in November 2026.
battery-check.py on 5 hours of that station's log, indoors on a LiFePO4 mains charger (too short for the 24-hour verdict, so coverage reads CHECK):
Last 9999 hours
309 readings covering 5.2 h
voltage min 13.554 V (11-14 08:44) max 14.527 V (11-14 09:05)
charge in 0.83 Ah out 1.01 Ah net -0.18 Ah
peak load -1.92 A at 11-14 08:44 (radio transmit, if well above normal)
CHECK log covers only 5.2 of 9999 h - let it run longer for a full check
PASS no gaps in the log
PASS battery stayed above 12.5 V
What the full 17-hour run showed:
-
No undervoltage (
throttled=0x0) throughout, including during transmissions. - Steady load of about −0.41 A (5.6 W) with the charger off.
- Mains charger cycling about every 10 minutes: the battery sagged to about 13.7 V, the charger pushed it back to 14.5 V, then shut off. This is how some chargers hold a full battery.
- Transmit spikes of −1.3 to −1.9 A; the lowest voltage (13.55 V) came during one.
- On solar at midday, current hovered within ±0.1 A of zero while voltage eased from 14.2 to 13.9 V: the panel carried nearly the whole load.
- Net about −0.1 Ah, about 1% of capacity: effectively balanced.
| Symptom | Likely cause | Fix |
|---|---|---|
battery.service is inactive |
Monitor stopped or never started |
sudo systemctl start battery; see sudo journalctl -u battery -n 20
|
latest reading too old |
Monitor stuck waiting for the INA226 | Check the jumpers (pins 16, 17, 18, 20); sudo i2cdetect -y 3 should show 40
|
40 not on bus 3 |
Wiring, power, or bus 3 line missing from config.txt
|
See the INA226 Battery Monitor wiki page, Step 4 |
undervoltage has happened since boot |
Pi 5 V supply too low under load | Raise buck output to 5.1–5.2 V; shorter, thicker lead; 5 A converter |
monitor stopped for N min |
Reboot, power loss, or low-battery shutdown | Check the boot report in /data/bootlog; if the battery ran low, see the daily balance |
no battery_log.csv found |
Battery monitor not installed | Install it (station build, or the wiki page) |
| Current flips between charging and discharging | Charger cycling near full, or load changing | Normal near full charge |
| Charging shows negative | Shunt wired the other way, or charger on the battery side of the shunt | Set INVERT = True in battery_monitor.py, or move the charger to the +12 V bus |
| Battery slowly discharging at midday on solar | Battery above the controller's float voltage after a mains charge | Normal; it settles at about 13.5–13.8 V |
| About −0.4 A in full sun | Shade, poor angle, wiring or controller setting | Clear shade; face south, tilt about 45–50° in winter; set controller to LiFePO4 |
charging is not keeping up |
Panel too small for the season or site | Larger panel, better site, or lower load |
Scott Sheppard, KJ4ZZB