Power and protection/Lithium cells/Charging while it runs

Charging while it runs

The IP5306 is an entire power bank in one eight-pin package — charger, boost converter, power path, fuel gauge and button. It also switches itself off after thirty-two seconds if your project is too quiet, which is how most IP5306 projects die.

Open any cheap USB power bank and there is a good chance the only significant chip inside is an IP5306. It is an eSOP-8 that contains a 2.1 A synchronous lithium charger, a 2.4 A boost converter to 5 V, power-path management, a four-LED charge indicator, a button, and a torch driver — sharing one inductor between the charger and the boost.

For a project that needs a single cell to produce a steady 5 V while also being chargeable over USB, this one part replaces a TP4056, a protection board, a boost module and the wiring problem from the previous page.

The thirty-two second problem

Read this before you design a board around it.

IP5306: the 32-second timer
under 45 mA
Load
20 µA
Threshold
45 mA
Output
on
The clock is running and the board cannot tell. Anything under 45 mA starts the count. An ESP32 in deep sleep is three orders of magnitude under it. The usual fixes are a bleed resistor that wastes 45+ mA for ever — which defeats the point of sleeping — or a different chip. It is worth knowing before you design the board, not after.

From the datasheet: automatic load detection time — continuous load current of less than 45 mA — 32 s. Draw less than 45 mA from the 5 V output for thirty-two seconds and the chip switches its output off.

That is correct behaviour for the product it was designed for. A power bank whose phone has finished charging should not sit there boosting into nothing for a week.

It is fatal for an ESP32 that sleeps at 20 µA between readings. The board goes to sleep, the chip counts to thirty-two, the output goes off, and there is nothing left awake to press the button.

There are two honest fixes and both cost something. Bleed more than 45 mA continuously — which is a 110 Ω resistor across the output, 225 mW, and the end of any low-power design. Or use a different chip: the IP5306 is not the part for something that sleeps, and no amount of configuration changes that.

The I2C variant of the chip lets you read the charge state and adjust some settings, but the load-detect timer is not one of the things it turns off.

What the power path buys you

Injoinic's term is power-path management, and what it means in practice is that the charger and the boost can run in the same cycle. Plug a charger in while the project is running, and the output does not drop out. Unplug it, and the output does not drop out either. The cell charges with whatever the input has left after the load has taken its share.

That is the whole point of the part and it is why an IP5306 board can be left on a bench with a cable in it. Compare it with a bare TP4056, where the same arrangement means the charge cycle never terminates.

The charger supports 4.20, 4.30, 4.35 and 4.40 V cells, and it regulates its own charge current against input voltage and die temperature rather than holding one number and overheating.

Where the amps go

What the cell pays for a 5 V rail
90% efficient
Current out of the 5 V rail300 mA
Out of the cell
450 mA
Into the load
300 mA
Runs for
5.5 h
300 mA at the load costs 450 mA at the cell. The converter moves power, and power at 3.7 V needs about 1.50 times the current it needs at 5 V. So a 2500 mAh pack is 9.3 Wh, and after the boost takes its 10% you have about 5.5 hours — not the 8.3 the capacity number invites you to divide out. And that is with the datasheet's best-case efficiency; at very light loads it is worse.

This is the arithmetic nobody does, and it is why a "5000 mAh power bank" never charges a 3000 mAh phone twice.

A boost converter conserves power, not current. 500 mA out at 5 V is 2.5 W. 2.5 W out of a cell sitting at 3.7 V, through a converter that is 90 % efficient, is 750 mA out of the cell — half as much again as the number on the load.

So a 2500 mAh cell at that load is not five hours. It is about three and a third, and that is with the datasheet's best-case efficiency. At very light loads, where the converter's own overhead is a large fraction of the throughput, it is worse again.

The button, and what it does

KEY is a single input that does several things by timing: a short press turns the output on or shows the charge level, a double press drives the torch output, and a long press turns the output off. On a module this is wired to a tactile switch; on your own board it can be driven by a transistor from a GPIO, which is one way to wake the output up from a microcontroller that is still powered from somewhere else.

Under no load with the output off, the chip draws about 50 µA from the cell.

When to use it, and when not to

Use it for anything that is awake and drawing real current — a display, a speaker, a motor, a camera, a hand-held instrument. It is an entire power system for a few dollars and there is very little to get wrong.

Do not use it for anything that sleeps. A battery-powered sensor that wakes for two seconds every ten minutes wants a cell, a low-quiescent regulator and a charger with a power path — not a boost converter that counts to thirty-two while you are not looking.

Edit this page — content/fundamentals/power/charging-while-it-runs.mdx

Discuss this article

Ask about this page. The answer stays here, on the page it belongs to, for whoever hits the same wall next.

Browse Fundamentals on the forum