Battery
Using 18650 Holder Battery with ESP32
What is the 18650 Holder?
18650 Holder practical reference
A basic single-cell 18650 battery holder, the standard building block for portable and battery-powered maker projects. It's simply a molded plastic clip with spring-loaded metal contacts sized for the common 18650 cylindrical Li-ion cell, giving a solderable or wire-lead connection point without needing to solder directly onto the battery itself — which is important, since soldering onto an 18650's bare terminals can damage the cell and is generally discouraged.
Key specifications
- Cell compatibility: Single 18650 Li-ion cell (18mm diameter x 65mm length)
- Contact type: Spring-loaded positive and negative metal contacts, no direct soldering to the cell required
- Output: Raw, unregulated battery voltage — typically 3.0V-4.2V depending on charge state
- Connection: Bare wire leads (usually red/black) or PCB-mount pins, depending on holder style
- Mounting: Surface-mount screw holes or PCB-through-hole pins, model-dependent
- Protection: None built in — holder is purely mechanical; use a protected 18650 cell or add a separate protection/charge circuit (e.g. TP4056) for safe charging and discharge cutoff
Pinout and connection notes
The holder itself provides no charge control or over-discharge protection — pair it with a charge/protection module like the TP4056 (with built-in DW01 protection) if the project charges the cell in place, and always observe correct polarity since 18650 cells can vent or be damaged if reverse-connected.
- + (Positive lead): Connects to the cell's positive terminal via the spring contact
- - (Negative lead): Connects to the cell's negative terminal via the spring contact
Integration checklist
- Confirm the exact part number and breakout-board revision.
- Verify supply voltage, current demand, logic levels, and signal direction against the datasheet.
- Check controller pin assignments and bus address or interface mode against the example code.
- Power up with external loads disconnected, then test signals before full integration.
- If readings or communication fail, check power and ground first, then pin mapping, interface settings, and library initialization.
Troubleshooting and reproducibility
Record the board used, wiring, library/version, supply arrangement, and measured behavior. Use the selected board-specific wiring example as the source of truth. Never assume visually similar modules share identical voltage tolerance or pin order.
Setting Up 18650 Holder with ESP32
Wiring
| Component pin | ESP32 pin | Note |
|---|---|---|
| + (Positive lead) | R1 (100k) to GPIO34, R1 also to + | GPIO34 is ADC1_CH6, input-only, safe to use while Wi-Fi is active |
| + (Positive lead) | R2 (150k) from GPIO34 to GND | Ratio picked so a fully charged 4.2V cell still lands under the ESP32's 3.3V ADC limit |
| - (Negative lead) | GND | Common ground |
Swipe sideways to see every column →
The ESP32's ADC tops out at 3.3V, lower than a fully charged 18650 (4.2V), so the divider ratio here is different from the Uno's — use 100k/150k, not 100k/100k, or you will clip the reading at full charge. Stick to ADC1 pins (32-39) for this; ADC2 is unreliable while Wi-Fi is running.
Related Components
AMS1117 33
Fixed 3.3V linear regulator for powering logic-level components.
CN3065
Solar-friendly single-cell Li-ion charger. 4.2 V, 500 mA out of the box.
LiPo 2000mAh
Slim rechargeable LiPo cell for compact wearable and drone builds.
MAX17043
I2C battery fuel gauge that reports accurate state-of-charge — far better than voltage guessing.
Related Guides & Projects
MicroPython vs Arduino on ESP32: Which Should You Learn First?
An honest comparison for beginners: where MicroPython is easier, where Arduino C++ is faster, how libraries and memory differ, and how to choose based on your project instead of hype.
MicroPython ESP32 Web Server: Control an LED or Relay from Your Browser
Create a working web server with the socket module, parse requests, serve a responsive control page for an LED or a relay, keep the displayed state truthful, choose a safe relay startup state and make the server survive bad or repeated requests.
MicroPython on ESP32 and Raspberry Pi Pico W: The Complete Guide
A structured MicroPython learning path for ESP32 and Pico W. Set up your tools, control GPIO, read sensors, connect to WiFi, build web servers, publish MQTT data and make projects reliable. Start here, then follow the links by level.
boot.py vs main.py in MicroPython: What Runs, When and Why
Understand the difference between boot.py and main.py in MicroPython, startup order, Wi-Fi setup, project structure, and recovery from boot errors.