Battery
Using 18650 Holder Battery with Raspberry Pi
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 Raspberry Pi
Library
Adafruit-MCP3008 by Adafruit
pip3 install adafruit-circuitpython-mcp3xxx
Wiring
| Component pin | Raspberry Pi pin | Note |
|---|---|---|
| + (Positive lead) | R1 (100k) to MCP3008 CH0, R1 also to + | Pi has no built-in ADC — this goes through an MCP3008 over SPI, not directly into a GPIO pin |
| + (Positive lead) | R2 (150k) from MCP3008 CH0 to GND | Same divider ratio as the ESP32, since the MCP3008 also references 3.3V |
| - (Negative lead) | GND (shared with MCP3008 and Pi) | Common ground |
Swipe sideways to see every column →
Raspberry Pi GPIO pins are digital-only — there is no analog input on the header, so measuring an analog quantity like battery voltage always needs an external ADC such as the MCP3008 shown here. Enable SPI first with sudo raspi-config (Interface Options -> SPI).
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
Raspberry Pi Pico W and Pico 2 W: Install MicroPython with Thonny or UF2
Hold BOOTSEL, drag the correct UF2 file, open the REPL and blink the onboard LED. Includes the Pico vs Pico W vs Pico 2 W firmware differences and what to do when the drive does not appear.
Raspberry Pi Pico W Web Server in MicroPython: Control an LED and Read a Sensor
Connect the Pico W to WiFi, serve a responsive control page, switch an LED and display the onboard temperature or an external sensor, with timeouts and reconnect handling.
Raspberry Pi Pico Oscilloscope with MicroPython
Convert a Raspberry Pi Pico into a basic 500 kSPS oscilloscope using its 12-bit ADC and MicroPython. Displays waveforms on an SSD1306 OLED or streams samples over USB serial to a Python plotter on your PC.
Self-Hosted Nextcloud NAS on Raspberry Pi 4
Build a private, durable Nextcloud NAS on a Raspberry Pi 4 -- SSD boot instead of a failure-prone SD card, Docker Compose with Redis caching, Tailscale for remote access with zero ports forwarded, and an automated backup strategy that actually runs.