LM317 Lithium Ion Battery Charger

 Posted by:   Posted on:   Updated on:  2020-01-03T14:28:17Z

Build this simple yet versatile charger for Lithium Ion cells with LM317 or LM338 and TL431

Even though I have some TP4056 modules for charging Li-Ion cells, those small PCBs generate a lot of heat and the charging current decreases with temperature increase. Since I have parallel pairs of cells from notebook batteries, I would like to charge them with a higher current. Another limitation of those modules would be that the maximum charge current cannot be changed unless I replace a small SMD resistor. Therefore I'll build my own Li-Ion battery charger, with LM317 (LM338). Using a linear regulator does not solve the heat production issue, but at least I can put it on a heatsink.

Li-Ion cells need to be charged in a two-step process. First, until they reach a threshold voltage the charger behaves as a constant current supply. This current is cell-specific, but usually the supplied energy (in Ah) should be less than 80 percent of battery capacity (Ah). When the voltage increases enough, the charger should switch to constant voltage mode, maintaining a stable 4.2 V (or 4.1 V for some cells) until current drops.

LM317 Lithium Ion Battery Charger

My circuit does not attempt to replace a TP4056 module. These are well suited for charging Li-Ion from 5V USB ports. Their small size is also an important reason to use them. The following circuit is big and it is not suitable for portable devices. It is more of a workbench charger. There are two presets for charging current (the actual currents will depend on the value of some resistors). It can also be used to charge two series cells (depending on the value of other two resistors). LM317 can be replaced with LM338 if you need a charging current up to 5 A. Be careful to replace the other parts that will have to carry a higher current (we'll see later).

Schematic of LM317/LM338 Li-Ion charger

Schematic of LM317/LM338 Li-Ion charger

R2 and D4 make a simple current indicator. The 1N5404 diode has a forward voltage drop that increases with current. This drop is used to turn on Q1 transistor which drives an LED and the cooling fan for the regulator. At low currents, R2 creates a path for current that determines an even lower voltage drop, ensuring the transistor is no longer biased. The exact point at which this happens depends on both diode and parallel resistor. This is just a rudimentary current indicator which may require some experimenting with different parts to get it working properly. The diode may be replaced only with other rectifier type diodes. Do not use Schottky diodes. R2 resistor value may be reduced down to 3.9 ohms. With this weak biasing, the transistor cannot drive high current loads. I tested with a small 40 mm fan with only 80 mA current draw.

The rest of the circuit is just a current limited LM317 power supply set to 4.1-4.2 V output. U2 (TL431) is used as voltage reference to set output. With R5, R6, R8 and SW1 charging current can be set as follows. The maximum available output current is 1.5 A for LM317 and 5 A for LM338. With the equivalent resistance between the output of the regulator and load you can limit this current: I = 1.25/R. THe circuit uses SW1 to switch between two charging currents. It's important to know that R6 and R8 should never be both on this circuit. With R5 and R8 the switch can select between R5+R8 and R5. In this case I1 = 1.25/(R5+R8) (small current mode), while I2 = 1.25/R5 (high current mode). SW1 in this situation can be a single pole 2 pin switch whose purpose is to short R8.

You can have R5 and R6 resistors. In this case I1 = 1.25/R5, while I2 = 1.25/R6. Resistor values from schematic have been selected for 1.25 A high current and 0.57 A low current. Use whatever values you want while keeping in mind that the dissipated power is P = I2R. Chose resistors with proper wattage rating (usually double than what is needed will be fine).

R9, R10 and RV1 set the voltage. This is the maximum voltage that the battery can reach when fully charged. For Li-Ion cells this is 4.1 V or 4.2 V (read your cell specifications). The values from schematic are suitable for a single cell or parallel cells pack. With no load, adjust RV1 until output voltage is 4.1 or 4.2 V. If you charge two series cells, R9 should be 22 kiloohms and no load output voltage set to 8.2 or 8.4 volts. Remember to use a balancing circuit for the cells. Even three series cells may be charged with R9 = 39 k and properly rated capacitors/LED series resistors/fan.

PCB layout of Li-Ion charger

PCB layout of Li-Ion charger

With LM338, higher charging currents may be set with the same resistors. It's important to replace D4 and F1 with parts that can handle the current. PCB tracks are not quite suitable for high currents. The red tracks in the above drawing should be tinned to increase their cross section and current capability. Use your soldering iron to add solder over those tracks.

The PCB is 7.2 by 7 cm in size, single sided. A wire jumper has to be added on the top side (have a look at the silkscreen). The minimum input voltage for this circuit is as follows. Keep it as close to these values to reduce heat dissipation but not smaller. Make sure the SMPS/transformer can supply sufficient current.

AC/DC 1 cell / parallel pack 2 series cells 3 series cells
AC at J1 7.4 V AC 10.3 V AC 13.3 V AC
DC at J2 8.4 V DC 12.6 V DC 16.8 V DC
Bottom side of PCB with holes for air flow

Bottom side of PCB with holes for air flow

During usage D4, U1, R5, R6 and R8 will get hot. This is normal. If charging with high currents and LM338, you may disable the charging indicator by replacing D4 with a wire jumper. In this way you will remove a part that heats. If you leave the cell connected to the charger while not powered, PWR LED will stay on to remind you to disconnect the cell.

Warning! Do not place Li-Ion cells too close to this circuit because it heats during usage. Avoid heating Li-Ion cells. It is recommended to put the charger and batteries in a safe place and keep an eye on them during charging. An improper built charger and/or damaged cells may result in cells catching fire.



  1. z-matrix. Simplest DIY Li-Polymer Charger Schematic (2006) on RC Groups Forum.
  2. Simple Lithium-ion / Lipo Battery Charger on Electronics DIY (the same circuit from [1]).
  3. 3.6V Lithium Ion Battery Charging Circuit LM317 on 320 Volt.

No comments :

Post a Comment

Please read the comments policy before publishing your comment.