Records a 16 day voltage history of two batteries.
Implemented using the Arduino IDE for the Adafruit ESP32-S3 Reverse TFT Feather although I anticipate the code would port pretty easily for most ESP32 modules.
There are three top-level pages: a summary of both battery voltages, and a rolling history of each battery.
When active, the current voltages are updated every 2.5s. The voltage history records a sample every 5 minutes.
- After 15 minutes of no button activity, the device enters idle mode, switches off the display and enters deep sleep. In this state it wakes up every 5 minutes, without enabling the display, to record another voltage sample and then returns to deep sleep.
- While idle, the D1 or D2 buttons can be used to return to active mode and enable the display.
History is saved to flash in 16 segments (each corresponding to 24hrs). The current segment is also written to RTC memory that is preserved between deep sleep cycles. When waking from deep sleep, the full history is first loaded from flash and then the RTC history is copied into the current segment. An interruption of battery power therefore results in up to one segment of history being lost.
A summary display of both battery voltages and their percent state of charge (based on typical AGM battery chemistry).
- D1 (middle) button enters calibration page (see below).
- D2 (bottom) button cycles between summary page and voltage history for battery 1 and 2.
Displays voltage history for a single battery.
- D0 (top) button cycles between displaying 12hr, 48hr and 16 day history.
- D1 (middle) button enters options menu (see below).
- D2 (bottom) button cycles between summary page and voltage history for battery 1 and 2.
The options menu allows the history display to be customized.
- Show Stats - controls whether history page displays min/max/avg voltage over history.
- Dynamic Scale - controls whether vertical axis scales dynamically or always shows 11-15V.
- Clear History - resets the saved history (new in v1.1.0)
- Back - exits the options menu.
To navigate use:
- D0 (top) cursor up
- D1 (middle) cursor down
- D2 (bottom) select
Allows the factory calibration of the ADC to be adjusted to compensate for small errors. The setting is saved persistently in flash.
- D0 (top) increase voltage reading by 2%
- D1 (middle) decrease voltage reading by 2%
- D2 (bottom) save changes. Press again to confirm, any other key to cancel.
Power measurements were using a 13V power supply and included the ESP32-S3 Feather, a 12-5V buck converter and resistor dividers for the ADC inputs.
- Current draw when active (display on): 37.3mA (485mW).
- Current draw when awake and idle (display off): 26.5mA (345mW).
- Current draw in deep sleep: 0.25mA (3.25mW).
Wake time is approximately 3.5s every HISTORY_SAMPLE_INTERVAL_SECS. At the default sample interval of 5mins, the awake ratio is 1.17%, so average current draw is:
0.0117*37.3 + (1-0.0117)*0.25 = 0.682mA (8.87mW)
See the wiki for more information on design, schematics, 3D models and CAD files. Theoretically, leaving this battery monitor connected for one year would consume about 6Ah of battery capacity.



