Bench notes · Solar · ESP32
Keep an ESP32 running on sunshine
You don't need a big panel or an expensive power board to run an ESP32 off-grid. Two palm-sized solar panels, one 18650 cell and a few dollars of parts will do it, as long as the project spends most of its time asleep. I've written up the full circuit as a free guide.
The short version
- Four building blocks. Solar panels feed a TP4056 charger, which charges an 18650 cell, which feeds a 3.3V regulator into the ESP32's 3V3 pin.
- Use a low-dropout regulator. An AMS1117 gives up while the battery still has plenty left. An MCP1700 keeps going with only about 0.2V of headroom and uses almost no power itself.
- Add a battery gauge for two resistors. Two equal 100kΩ resistors halve the battery voltage for an ADC pin. That's simpler, and more accurate on the ESP32, than the usual 27k/100k pair.
- Sleep is the secret. Deep sleep is what makes a small panel enough. A board that stays awake on Wi-Fi will drain the battery faster than the sun can refill it.
Two gotchas worth knowing
When you plug in USB to program the board in Thonny, the board's own regulator also drives the 3V3 pin, so disconnect the solar supply first. And once the code goes into deep sleep, Thonny loses the board, which is why the example code waits 5 seconds before sleeping so you can press Stop.
Free library
Small solar power for ESP32 projects
The full guide: block diagram, parts list, step-by-step wiring, the battery gauge circuit and complete MicroPython code for Thonny.