Demo GIF
" data-cpx-injected="1"> ESP32 Deep-Sleep Battery Node — ESP32 & ESP8266 Build | CodeProven

ESP32 & ESP8266 Connectivity · Intermediate · Low power

ESP32 Deep-Sleep Battery Node

A node that wakes, reports and sleeps, and can run for weeks on one cell.

Firmware status: Generated from this project's own pin map and compiled with arduino-cli for esp32:esp32:esp32 before publication; bench validation on your hardware is still required..

Hardware scope

Timer wake, RTC-retained counter, battery divider, radio on only during the report. Pins assigned by the generator: sense → GPIO34, status led → GPIO4.

Components

  • ESP32 board
  • Analog sensor
  • 18650 cell and holder (or a 3.7 V LiPo)
  • 10 kΩ + 10 kΩ divider for the battery sense
  • USB cable

Tools

  • USB programming cable
  • Multimeter
  • Current-limited bench supply (for anything that switches a load)
  • Small screwdriver and wire cutters

Build steps

  1. Build the 1:2 divider across the cell and take it to a pin that can read it.
  2. Set WAKE_SECONDS, flash, and read the boot counter and voltage in the log.
  3. Watch the awake time — it should be a few seconds, not a minute; that number is the battery cost.
  4. Confirm the counter increments on each wake, which proves the RTC memory survives sleep.

Test and expected result

The board wakes on schedule, the boot counter survives every sleep, and the awake time is a small fraction of the cycle.

Acceptance checks

timer wake works, counter persists, awake time under five seconds, voltage reported

Safety and limits

A lithium cell needs a protection board and the right charger. Measure the divider on the bench before connecting a cell to a 3.3 V pin.

Guide source: Generated from this project's own pin map and compiled with arduino-cli for esp32:esp32:esp32 before publication; bench validation on your hardware is still required.

Download Arduino source code

Download connection diagram SVG

Related projects

Back to all project guides · Study the course