← Block library

Li-ion Charger (1 cell)

@electrace/liion-charger@1.0.0 · CC-BY-4.0
vin 4.5–5.5 Vvbat 4.2 Vicharge 1 A
TP4056
The actual schematic inside this block — every part is explained below.

Li-ion Charger (1 cell)

Charges a single lithium cell safely from 5 V (USB) — running the CC/CV profile every lithium cell requires: constant current while the cell is empty, smoothly handing over to a constant 4.2 V as it fills, then tapering off to done.

  • U1 (TP4056-class) — the whole charge brain. It measures the cell at BAT and decides which phase you're in. The cell is safe because this loop never lets it see more than 4.2 V or more than the programmed current.
  • R2 — the one resistor that sets the charge current: Icharge ≈ 1200 / R(PROG). The 1.2 kΩ here means 1 A. Swap it to match your cell — never charge faster than 1C (a 500 mAh cell wants ≤ 500 mA → 2.4 kΩ).
  • R1 — pull-up for CHRG, the open-drain status output: low while charging, releases when full. Wire it to an LED or a GPIO.
  • TEMP is tied to ground here, which disables battery-temperature monitoring — fine for a bench project at room temperature; for anything enclosed or outdoors, wire a 10 k NTC against the cell instead.

It's a linear charger: simple and quiet, but it burns (Vin − Vbat) × Icharge as heat — about 1 W into an empty cell at 1 A. That's why the chip gets warm; it's supposed to (it thermally self-limits).

Exposes: vin (5 V), batt (the cell, 4.2 V max), chrg (status), gnd.

⚠ Protected cells only, or add a protection circuit: this block charges correctly but does NOT protect against over-discharge or shorts on the battery side. Most bare 18650s need that protection; most pouch cells with a small PCB already include it.

Exposed nets

vinin · power · 4.5–5.5 V
gndin · gnd
battout · power · 4.2 V
chrgout · signal

Inside this block

U1
tp4056
the charge controller — runs the CC/CV profile: constant current into an empty cell, tapering to a constant 4.2 V as it fills
R1
1k
limits the CHRG status LED / signal current
R2
1.2k
programs the charge current: Icharge ≈ 1200 / R → 1 A
C1
10uF
input stability
C2
10uF
keeps the battery node stable while the loop regulates

Limits & gotchas

vin.max 6VAbs-max is ~8 V but the part runs hot fast above 5.5 V in — it's a LINEAR charger, burning (Vin − Vbat) × Icharge as heat. At 5 V in, 1 A into an empty cell ≈ 1 W on this little package.
icharge.max 1ASet by R2: Icharge ≈ 1200 / R(PROG). 1.2 kΩ → 1 A. Never set it above 1C of your cell (a 500 mAh cell wants ≤ 500 mA → 2.4 kΩ).
Use this block in a real design
Drop it on a canvas, wire it up, and watch the live checks — free, no card.
Start designing →
This page is generated from the block's source — the same content powers the editor's explanations and live checks.