Skip to content

LiPo Battery Power Management

LiPo Battery Power Management

This section covers LiPo (Lithium Polymer) battery integration for the e-paper display project. Proper battery management is essential for achieving long-term, maintenance-free operation. After completing this section, you will be able to:

  • Select appropriate LiPo batteries for ESP32 projects
  • Understand LiPo battery charging and protection circuits
  • Integrate battery power with ESP32 boards that have built-in battery management
  • Monitor battery voltage for low-battery warnings

Before starting this section, please ensure:

  • Deep sleep configuration is understood (see 02-08)
  • Basic understanding of lithium battery safety
  • ESP32 board with battery management (recommended: XIAO ESP32-C3 or similar)

LiPo (Lithium Polymer) batteries are the preferred power source for portable IoT devices due to their high energy density and light weight.

Key Specifications:

ParameterDescriptionTypical Values
Voltage (nominal)Average voltage during discharge3.7V per cell
Voltage (full)Maximum voltage when fully charged4.2V per cell
Voltage (cutoff)Minimum safe voltage3.0-3.2V per cell
CapacityTotal energy storage500-5000 mAh
C-ratingMaximum discharge current1C-5C
ConnectorPhysical connection typeJST-PH, Molex, wires

Voltage vs Charge Level:

4.2V ── 100% (Full)
4.0V ── 80%
3.8V ── 50%
3.6V ── 20%
3.4V ── 5%
3.0V ── 0% (Empty — disconnect immediately)

Warning: Discharging below 3.0V permanently damages LiPo batteries. Use a protection circuit or voltage cutoff.

A BMS handles:

  • Overcharge protection: Stops charging at 4.2V
  • Over-discharge protection: Disconnects load at ~3.0V
  • Short circuit protection: Instant disconnect
  • Balancing: For multi-cell batteries (not needed for single-cell)

Several ESP32 boards integrate battery management, making battery operation simple:

BoardBattery ConnectorCharging ICMax Charge CurrentNotes
XIAO ESP32-C3JST-PH (2-pin)BQ25100300 mAIdeal for this project
ESP32-S3-DevKitC-1No built-inExternal neededAdd external module
M5Stack AtomJST-PHIP5306500 mABuilt-in power management
TTGO T-DisplayJST-PHTP4054500 mAWith display included

XIAO ESP32-C3 Battery Features:

  • Built-in battery charging via USB-C
  • Automatic power source switching (USB ↔ battery)
  • Battery voltage monitoring via ADC
  • Low quiescent current in sleep mode

For the E-Paper Display Project:

Calculate required battery capacity:

# Power consumption calculation
active_current = 120 # mA (WiFi + display refresh)
active_time = 10 # seconds per cycle
sleep_current = 0.05 # mA (50 µA deep sleep)
sleep_time = 3590 # seconds (1 hour - 10 seconds)
# Energy per cycle (mAh)
active_energy = active_current * (active_time / 3600) # 120 * 0.00278 = 0.333 mAh
sleep_energy = sleep_current * (sleep_time / 3600) # 0.05 * 0.9972 = 0.050 mAh
total_per_cycle = active_energy + sleep_energy # 0.383 mAh
# Daily consumption
cycles_per_day = 24
daily_consumption = total_per_cycle * cycles_per_day # 9.2 mAh
# Battery life estimation
battery_capacity = 1200 # mAh (example)
days_of_operation = battery_capacity / daily_consumption # 130 days

Recommended Batteries:

CapacityDimensionsESP32 Run Time (1hr refresh)WeightPrice
500 mAh30×20×5 mm~54 days12g$5-8
1200 mAh50×35×6 mm~130 days25g$10-15
2000 mAh65×40×6 mm~217 days38g$15-20
5000 mAh100×40×8 mm~543 days80g$25-35

For XIAO ESP32-C3:

1. Prepare the battery
┌───────────────────┐
│ LiPo Battery │
│ 3.7V / 1200 mAh │
└──────┬──────┬─────┘
│ │
Red(+) Black(-)
│ │
↓ ↓
┌───────────────────┐
│ XIAO ESP32-C3 │
│ (JST-PH header) │
└───────────────────┘
  1. Connect the battery JST connector to the XIAO’s battery header
  2. The XIAO automatically detects the battery
  3. When USB is connected, the device runs on USB and charges the battery
  4. When USB is disconnected, the device seamlessly switches to battery power

For ESP32 without BMS:

Add an external TP4056 charging module:

USB Power ─→ [TP4056 Charger] ─→ LiPo Battery
[ESP32 Vin]

Wiring:

TP4056 ESP32
────── ─────
OUT+ ───→ Vin (5V)
OUT- ───→ GND
BAT+ ───→ LiPo +
BAT- ───→ LiPo -

Monitor battery level to alert users before shutdown:

// Battery monitoring for XIAO ESP32-C3
// The XIAO has an internal voltage divider connected to GPIO 2
#define BATTERY_PIN 2 // XIAO ESP32-C3 battery measurement pin
void setup() {
Serial.begin(115200);
// Configure ADC
analogReadResolution(12); // 12-bit resolution (0-4095)
// Read battery voltage
int rawValue = analogRead(BATTERY_PIN);
// Convert to voltage
// XIAO uses a 2:1 voltage divider
float voltage = (rawValue / 4095.0) * 3.3 * 2;
Serial.print("Battery voltage: ");
Serial.print(voltage);
Serial.println("V");
// Estimate battery percentage
int batteryPercent = mapBatteryToPercent(voltage);
Serial.print("Battery: ");
Serial.print(batteryPercent);
Serial.println("%");
// Low battery warning
if (voltage < 3.4) {
Serial.println("WARNING: Low battery!");
// Show low battery indicator on display
}
}
int mapBatteryToPercent(float voltage) {
// Approximate mapping for LiPo
if (voltage >= 4.2) return 100;
if (voltage >= 4.0) return 80;
if (voltage >= 3.8) return 50;
if (voltage >= 3.6) return 20;
if (voltage >= 3.4) return 5;
return 0;
}

Add a battery indicator to the display:

void drawBatteryIcon(int x, int y, int percent) {
// Battery outline
display.drawRect(x, y, 30, 15, GxEPD_BLACK);
display.fillRect(x + 30, y + 4, 4, 7, GxEPD_BLACK); // Terminal
// Fill level
int fillWidth = map(percent, 0, 100, 0, 28);
if (fillWidth > 0) {
display.fillRect(x + 1, y + 1, fillWidth, 13, GxEPD_BLACK);
}
// Low battery indicator
if (percent < 10) {
display.setFont(&FreeMono9pt7b);
display.setCursor(x, y + 25);
display.print("LOW BAT");
}
}
// Usage in display update
drawBatteryIcon(210, 5, batteryPercent);

Safety Recommendations:

  • Always use a protected battery — Batteries with built-in protection IC
  • Charge in a fire-safe area — Never leave charging batteries unattended
  • Use the correct charger — LiPo-specific charger with CC/CV profile
  • Never puncture or short-circuit LiPo batteries
  • Don’t charge below 0°C — Permanently damages the battery
  • Don’t store fully charged for extended periods — Store at 3.7-3.8V (50-60%)
  • Device powers on from battery alone (USB disconnected)
  • Device charges when USB is connected
  • Battery voltage reading is within expected range (3.3V-4.2V)
  • Low battery warning appears on display when voltage drops
  • Device runs for at least 24 hours on battery

Issue 1: Device Doesn’t Power On Battery

Section titled “Issue 1: Device Doesn’t Power On Battery”

Symptoms:

  • Device works on USB but not battery

Solutions:

  • Check battery voltage with multimeter (>3.3V required)
  • Verify JST connector polarity (red = positive, black = negative)
  • Check if battery protection circuit has tripped (try charging for 10 minutes)

Symptoms:

  • Battery lasts less than expected
  • Device draws >100 µA in sleep

Solutions:

  • Verify deep sleep is actually active (measure current)
  • Check for GPIO pull-up resistors draining power
  • Disconnect external components during sleep
// Disable all peripherals before sleep
digitalWrite(EPD_CS, HIGH); // Deselect display
pinMode(EPD_RST, INPUT); // High-impedance
pinMode(EPD_DC, INPUT);

Issue 3: Battery Voltage Reading Inaccurate

Section titled “Issue 3: Battery Voltage Reading Inaccurate”

Symptoms:

  • Voltage reading is 0V or 4.2V constantly

Solutions:

  • Check ADC pin configuration
  • Calibrate ADC with known voltage
  • Add averaging filter
// Averaged battery reading
float readBatteryAverage() {
int total = 0;
for (int i = 0; i < 10; i++) {
total += analogRead(BATTERY_PIN);
delay(10);
}
float avg = (total / 10.0) / 4095.0 * 3.3 * 2;
return avg;
}
  • Choose a battery with built-in protection IC — Prevents over-discharge
  • Use JST-PH connectors — Standard for LiPo batteries
  • Monitor battery voltage — Show status on the display
  • Don’t mix battery chemistries — Stick to 3.7V LiPo
  • Avoid batteries without protection — Risk of permanent damage
  • Don’t draw more than 1C — Battery may overheat
  1. LiPo batteries (3.7V) are ideal for portable ESP32 e-paper projects
  2. Boards with built-in BMS (like XIAO ESP32-C3) simplify battery integration
  3. Battery capacity selection depends on the wake interval and active power consumption
  4. Voltage monitoring provides low-battery warnings and prevents data loss
  5. Proper charging and handling is critical for LiPo safety
  6. With a 1200 mAh battery and 1-hour sleep interval, operation for ~130 days is achievable

Target Audience: Alibaba.com IoT Pre-sales Engineers
Status: ✅ Completed