Li-ion CC/CV charger from an LM317
Li-ion cells must be charged at a limited current (CC) until they reach 4.2 V, then held at that voltage (CV) while the current tapers off. An LM317 sets the voltage; a sense resistor and one transistor steal its adjust current when the charge current tries to rise above 0.5 A.

Open this lesson in the labFree, in your browser, no account needed.
How it works
CV: V_OUT = 1.25 × (1 + R2 ÷ R1) = 1.25 × (1 + 560 ÷ 240) = 4.17 V.
CC: Q1 starts to conduct when the drop across R_sense reaches its V_BE (≈ 0.6 V), so I_max ≈ V_BE ÷ R_sense. Q1 only has to divert the few µA that keep ADJ from rising, so its V_BE is low, about 0.70 V: I_max ≈ 585 mA.
Unlike a TP4056 there is no cut-off: in CV the current tapers but never stops. Real chargers end the charge below C/10.
Try it on the bench
- Watch the cell voltage climb while the current holds steady.
- Change R_sense to 2.2 Ω: about 0.27 A, a gentler charge.
Parts on the bench
- Bench power supply
- LM317 / LM338 regulator
- 4 × Resistor
- 18650 Li-ion cell
- NPN transistor
In the course
Electronics Technician, module “Batteries, chargers and USB”.