Python script for getting the state of Espresso Charge power bank
Device: https://us.espres.so/products/espresso-charge
A Python script to read battery telemetry from a Charge battery device over USB serial on Linux.
The device uses a Silicon Labs CP210x USB-to-UART bridge and communicates via a COBS-encoded binary protocol.
- Charge battery device connected via USB
- Linux with the
cp210xkernel module (included in most distributions by default) - Verify it is loaded:
lsmod | grep cp210x - If missing, load it manually:
sudo modprobe cp210x
By default, /dev/ttyUSB* devices require root or membership in the dialout group.
Add your user to the group (recommended):
sudo usermod -aG dialout $USERThen log out and back in for the change to take effect.
Or for a one-off temporary fix:
sudo chmod 666 /dev/ttyUSB0- Python 3.7 or later
pyseriallibrary:Or inside a virtual environment:pip install pyserial --break-system-packages
python3 -m venv venv source venv/bin/activate pip install pyserial
After plugging in the device, confirm it is detected:
lsusb | grep "10c4"
# Silicon Laboratories CP210x USB to UART Bridge
ls /dev/ttyUSB*
# e.g. /dev/ttyUSB0For a stable path that survives reboots:
ls /dev/serial/by-id/
# e.g. usb-Silicon_Labs_CP2102_...-port0python3 readcharge.pyBy default the script connects to /dev/ttyUSB0. If your device appears on a different port, edit this line near the top of the script:
with serial.Serial('/dev/ttyUSB0', baudrate=115200, timeout=2) as ser:SOC: 97% SOH: 83%
Voltage: 20.715 V Current: 58 mA
Temp: 35.95 °C
Remaining: 4928 mAh / 5113 mAh
Time to empty: N/A min
Time to full: Done
Power direction: SINK (charging)
| Field | Description |
|---|---|
| SOC | State of Charge — current charge level (%) |
| SOH | State of Health — battery condition vs new (%) |
| Voltage | Pack voltage in volts |
| Current | Charge/discharge current in mA |
| Temp | Battery temperature in °C |
| Remaining | Current usable capacity in mAh |
| Full capacity | Maximum capacity at current SOH in mAh |
| Time to empty | Estimated minutes of runtime remaining (N/A when charging) |
| Time to full | Estimated minutes until fully charged (Done when at 100%) |
| Power direction | SINK = charging, SOURCE = discharging |
| Parameter | Value |
|---|---|
| USB Vendor ID | 10c4 (Silicon Laboratories) |
| USB Product ID | ea60 (CP210x) |
| Baud rate | 115200 |
| Framing | COBS-encoded, 0x00-terminated packets |
| Checksum | XOR of all payload bytes, appended before encoding |
| Capacity fields | 16-bit little-endian |
| Voltage / current / temp / time fields | 16-bit, byte-swapped then big-endian |
| Temperature conversion | raw × 0.1 − 273.15 (Kelvin → °C) |