RD-03

DC power monitor

Voltage and current logging for a 12 V battery system up to 20 A, such as a solar battery or a router backup, with alerts before the battery is drained too far.

Draft. Wiring and firmware outline written. Bench validation pending.

Where it fits

  • Small solar battery systems
  • Router and CCTV backup batteries
  • 12 V DC loads in a workshop

Power: From the battery being measured, through a fuse and an L7805 regulator.

Parts list

PartQtyRole
ESP32 DEVKIT V11Controller and Wi-Fi
Current Sensor ACS712 20A1Measures DC current
L7805 Voltage Regulator112 V to 5 V supply
Resistors, 100 kΩ, 18 kΩ and 2 × 10 kΩ4Battery and sensor dividers
Veroboard Double Sided 5x7cm1Permanent assembly

Wiring

SignalConnect toWhy
Battery +100 kΩ to GPIO33, 18 kΩ from GPIO33 to GND14.4 V reads as about 2.2 V; add 100 nF from GPIO33 to GND.
ACS712 OUT10 kΩ to GPIO32, 10 kΩ from GPIO32 to GNDHalves the 0.5 to 4.5 V output into the ADC range.
ACS712 VCC5 V from the L7805
L7805 INBattery + through a fuse0.33 µF on the input and 0.1 µF on the output, as the datasheet suggests.
L7805 OUTESP32 VIN

Firmware outline

Written for ESP-IDF. The same steps work in Arduino with the matching calls.

  1. At start-up, with the load switched off, read the current channel and store it as the zero offset.
  2. Read voltage and current every second through the ADC calibration scheme, and compute power.
  3. Count amp-hours in and out, and reset the count when the battery reaches its full-charge voltage.
  4. Publish voltage, current, power and amp-hours every 10 seconds.
  5. Alert when the voltage under load falls below a threshold you set, before your inverter or charger cuts off on its own.

Design notes

Measure zero, every time
The ACS712's zero-current output moves with temperature and with its 5 V supply. Reading it at start-up with no load and subtracting it removes most of that error.
A divider that sips
100 kΩ over 18 kΩ puts a 14.4 V charging voltage at about 2.2 V, inside the ESP32's recommended range, and draws about 120 µA from the battery.
Heat in the regulator
An L7805 burns the difference: (12 V − 5 V) × 150 mA is about 1 W, so it needs a small heatsink. A switching buck module would waste far less.
Bigger systems
An inverter's battery cable often carries 30 A or more. For that, use a higher-range sensor such as the ACS709 carrier; the firmware stays the same apart from the sensitivity constant.

Limits

  • Voltage alone is a rough guide to how full a lead-acid battery is. Readings at rest and under load differ, so log both.
  • Work on battery banks only with a fuse close to the battery terminal.