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
| Part | Qty | Role |
|---|---|---|
| ESP32 DEVKIT V1 | 1 | Controller and Wi-Fi |
| Current Sensor ACS712 20A | 1 | Measures DC current |
| L7805 Voltage Regulator | 1 | 12 V to 5 V supply |
| Resistors, 100 kΩ, 18 kΩ and 2 × 10 kΩ | 4 | Battery and sensor dividers |
| Veroboard Double Sided 5x7cm | 1 | Permanent assembly |
Wiring
| Signal | Connect to | Why |
|---|---|---|
| Battery + | 100 kΩ to GPIO33, 18 kΩ from GPIO33 to GND | 14.4 V reads as about 2.2 V; add 100 nF from GPIO33 to GND. |
| ACS712 OUT | 10 kΩ to GPIO32, 10 kΩ from GPIO32 to GND | Halves the 0.5 to 4.5 V output into the ADC range. |
| ACS712 VCC | 5 V from the L7805 | |
| L7805 IN | Battery + through a fuse | 0.33 µF on the input and 0.1 µF on the output, as the datasheet suggests. |
| L7805 OUT | ESP32 VIN |
Firmware outline
Written for ESP-IDF. The same steps work in Arduino with the matching calls.
- At start-up, with the load switched off, read the current channel and store it as the zero offset.
- Read voltage and current every second through the ADC calibration scheme, and compute power.
- Count amp-hours in and out, and reset the count when the battery reaches its full-charge voltage.
- Publish voltage, current, power and amp-hours every 10 seconds.
- 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.
