(+39) 351 838 6453 [email protected]
Home · Projects · Smart battery charger
Project · Firmware and electronics

Networked smart battery chargers

Chargers for 2-cell lithium batteries that organise themselves: they talk over radio, decide who charges and when, and let several stations share one power supply.

ESP32-C3TI BQ25887Li-ion 2SESP-NOWOTAC++

The project

When several batteries have to be charged from the same power supply, charging them all at once can exceed the available current. You need chargers that can agree with each other: each one looks after its own battery, but only one charger at a time actually charges.

That is why we developed the firmware and electronics of a smart charger: each charger is a small node built on the ESP32-C3 with the TI BQ25887 charger, and all the nodes form a radio network with no central unit.

In short: switch on the chargers, connect the batteries and the system organises itself. No communication wiring between stations and no central controller to configure.

Charging

Texas Instruments' BQ25887 is a charger for 2-cell series Li-ion batteries that runs from a 5 V USB input and steps the voltage up with a boost converter. It has built-in cell balancing, so both cells stay at the same voltage and the battery lasts longer.

  • The ESP32-C3 talks to the charger over I²C: it sets charge and input currents, voltage per cell and termination current
  • The charger's ADC measures input voltage, battery voltage, each individual cell and temperature
  • The firmware only starts charging when the battery is within a safe voltage range, and stops at the full-charge threshold
  • With no input power, or a battery out of range, the charger stays off

Coordination between chargers

The chargers communicate over ESP-NOW, Espressif's radio protocol that links ESP32 devices directly, with no router. Every few seconds each node sends a heartbeat with its battery voltage and state, and keeps a table of the other chargers around it.

Using that information, each node decides on its own with a state machine:

01

Listen

At power-up it listens to the network to see whether anyone is already charging.

02

Wait

The battery needs charging: it waits until the slot is free.

03

Charge

Nobody else is charging: it enables the charger and tells the network.

04

Idle

Battery full or out of range: the charger stays off.

If two chargers are ready at the same moment, the same one always wins based on its address, so there are no conflicts. If a node is switched off, the others notice within seconds and the slot passes to the next one.

Dashboard and maintenance

Every charger has a built-in web page. At power-up it opens a Wi-Fi network for one minute: connect with your phone and the dashboard opens by itself, with no app to install.

  • Status: battery and cell voltages, charge state and the other chargers on the network
  • Diagnostics and board IDs for support
  • Settings stored in the device's memory
  • Over-the-air firmware updates: the charger downloads the new version from the server and checks every file with SHA-256 before installing it
  • A watchdog restarts the firmware if it ever hangs, so the charger never stays in an undefined state

Technologies

ESP32-C3

RISC-V microcontroller with Wi-Fi and the ESP-NOW radio, programmed in C++.

Espressif

TI BQ25887

Boost charger from 5 V USB for 2 cells, with cell balancing and a built-in ADC.

Li-ion 2S

ESP-NOW network

Radio network with no master: periodic heartbeats and a table of nearby chargers.

Peer-to-peer

Web dashboard

Access point and captive portal: the dashboard opens from your phone, no app.

Wi-Fi

OTA updates

Firmware and web pages updated from the server, with every file verified.

SHA-256

Watchdog

Constant firmware supervision and automatic restart if it hangs.

Reliability

Need a custom charging system?

We design firmware and electronics for chargers, battery management and connected devices. Tell us about your project.