# Lithium Battery Charger using LM317

I have come across the following circuit in a datasheet for a battery charger: I have also seen a similar use of the charging circuit for use as a lithium battery charger, e.g http://shdesigns.org/pdf/lionchg.pdf

But is this circuit implementation actually suitable for a lithium battery? (I know the 6V circuit would require the voltage output of the LM317 (R1 and R2) to be set dependent on the attached lithium battery voltage.)

I have read that lithium batteries need the following order to charge safely and correctly (Assuming the battery is not below its discharge condition, in which case trickle charging is required first):

1. Constant Current (CC)
2. Constant Voltage (CV)

The constant current stage requires the battery to be charged at its max (fully charged) voltage with a fixed current. The max charge voltage is set by R1 and R2 in the top picture (Although would R3 affect the output voltage as it is in series with R2?). R3 and the BJT act as a current control.

The constant voltage stage requires the battery to be maintained at its max (fully charged) voltage, whilst the output current is steadily dropped. The battery is deemed "charged" when the output current is below a very small current limit, which is specific to the lithium battery. This stage initiates when the voltage across R3 gets close to around 0.6V the BJT starts the turn on, which shorts the adjust pin and drops the LM317 output voltage until it is stable at around 1.25V, which then reduces the output current to the battery?

Questions:

• Does R3 affect the LM317 output voltage as it's in series with R2?

• How does the BJT and resistor precisely work in this setup? Won't the battery initially try and draw as much current as it can, meaning 0.6V would develop across R3 before the battery is sufficiently charged to transition into the CV stage?

• Wouldn't the 0.6V developed across R3 mean that the potential "seen" by the battery is approx 6.3V? (6.9V LM317 output subtract 0.6V). Wouldn't this be insufficient to charge the battery fully?

• When the BJT turns on, the voltage output of the LM317 will drop to 1.25V as the adjust pin is shorted (which bypasses the resistors). Surely this is not suitable for the CV stage of charging, as the potential drops to way below the battery charging voltage? How is current output to the battery affected during this voltage drop?

• Is the BJT even required for the CV stage? If just the resistor was used to limit the current, wouldn't the current to the battery decrease as it reaches full charge anyway?

• "is this circuit implementation actually suitable for a lithium battery?" - depends on how good you need it to be. Charging batteries is a complex field (esp for non-nimh and lead-acid types). However, I have made a 'emergency' charger to just top up some batteries on the go with a LM317 in constant-current configuration, but when using it we have a voltage meter verifying we don't exceed cell voltages. The question is: Do you just want to use an LM317, or do you want to make a good charger? There are integrated charger ICs that do a lot of the heavy lifting for you. – Joren Vaes Jun 4 '20 at 10:56
• An LM317 isn't suitable. Lithium batteries require careful monitoring whilst charging. There are a wide range of suitable IC's and pre-assembled PCBs available. – scotty3785 Jun 4 '20 at 12:39
• The LM317 is like one of those great athletes of yesteryear. You can appreciate it for how good it was back then. But it is no longer competitive. Truth be told it is no longer suitable for anything, mainly because of the high dropout voltage. All of the circuits and app notes and whatnot are wonderful for learning, however. – mkeith Jun 4 '20 at 16:53

## 1 Answer

Does R3 affect the LM317 output voltage as it's in series with R2?

If the battery is not connected (or, equivalently, if there is only a negligible current through the battery), the circuit operates as a constant voltage source with an output voltage of $$\V_{0}=V_{ref}\cdot \left( 1 + \frac{R_2+R_3}{R_1}\right) + I_{Adj}\cdot (R_2+R_3)\$$. Since $$\R_3\$$ is typically much smaller than $$\R_2\$$, $$\R_3\$$ has only a negligible influence on $$\V_0\$$. On the other hand, if a battery is connected, as long as the battery voltage is lower than $$\V_0\$$, the circuit works as a constant current source and the current through the battery will be approximately $$\\frac{0.6V}{R_3}\$$. In this case, the voltage across the battery will automatically be adjusted such that the current remains constant. Once the battery voltage reaches $$\V_0\$$, the current can no longer be kept constant. In this case, the voltage across the battery will be constant, namely $$\V_0\$$, independent on the current that flows through the battery.

How does the BJT and resistor precisely work in this setup? Won't the battery initially try and draw as much current as it can, meaning 0.6v would develop across R3 before the battery is sufficiently charged to transition into the CV stage?

Yes, the battery will try to draw as much current as it can, but it will not succeed, because the higher the current through the battery, the higher the voltage across $$\R_3\$$. When this voltage reaches 0.6V, the transistor starts to conduct and the output voltage of the regulator will decrease. Therefore, the current through the battery is automatically limited to approximately $$\\frac{0.6V}{R_3}\$$.

Wouldn't the 0.6V developed across R3 mean that the potential "seen" by the battery is approx 6.3V? (6.9V LM317 output subtract 0.6V). Wouldn't this be insufficient to charge the battery fully?

Note that the battery is connected between the output of the voltage regulator and the base of the transistor, thus the voltage across $$\R_3\$$ has no influence on the battery voltage. The voltage regulator makes sure that the voltage across the battery will not exceed $$\V_0\$$.

When the BJT turns on, the voltage output of the LM317 will drop to 1.25V as the adjust pin is shorted (which bypasses the resistors). Surely this is not suitable for the CV stage of charging as the potential drops to way below the battery charging voltage? How is current output to the battery affected during this voltage drop?

The transistor will not conduct completely. The control loop ensures that the current through the transistor is just large enough to maintain a constant current. During charging with a constant current, the voltage of the battery will slowly increase. Once it reaches $$\V_{0}\$$ the current can no longer be kept constant and the voltage will remain at $$\V_{0}\$$.

However When charging lithium batteries, switching from CC to CV must take place at a precisely defined voltage. Therefore, $$\R_2\$$ should be made adjustable in order to set $$\V_0\$$ to the required level. This circuit is interesting to analyze and it might be a cheap solution, but there a integrated circuits that do a better job.

The simulation (using a rather crude battery model) shows the relationship between battery voltage (green) and current through the battery (blue). The constant current source does not show ideal behaviour. 