# Building a Battery Charger with an LM317

I was told that i could make a simple battery charger from a LM317 and a resistor to charge some Ni-MH Batteries. Can someone just expand on this a little such as how it works as I don't really understand it. Some more information is that there are 12 AAA batteries that hold a charge of 1000mAh and 1.2v per cell.

This page apparently describes a LM317-based charger with auto-shutoff, though it has a few more parts than a resistor.

At the most crude, you can use an LM317 and resistor to form a regulated current source, which is how NiMH/NiCd's should be charged. See "Precision Current Limiter" (p. 19) on the LM317 datasheet. The regulator functions as a current source by attempting to supply as much current as possible to have Vout - Vadj be 1.25 V.

Note that there is nothing inherent in the LM317 to shut off a charge, so if the batteries are fast-charged (~C/2 or higher), they will fail if you do not terminate the charge at the appropriate time. With a trickle-charge (C/20), you "can" leave them alone with no ill-effect.

So in your specific case, the 2-part charger would be a LM317 and a resistor to charge the pack at C/20.

• Charge rate: 1000 mA·h @ C/20 => 50 mA
• Resistor value: 1.25 V / 50 mA = 25 Ω

You need to provide a voltage to Vin at least 2.0 V (dropout voltage) + 1.25 V (reference voltage) = 3.25 V greater than the maximum charging voltage. The resistor would be connected between Vout and Adj, and your load is connected to Adj (not Vout)

• Shouldn't the Charge rate be equal to the total of all the batteries to 12000? As they are connected in series to give me a voltage of 12 volts. – Dean Nov 10 '10 at 18:47
• @Dean - No, your battery's capacity is 1200 mAh @ 12 V. Assembled in parallel, the current capacity increases, in series, only the voltage increases. By your logic the power contained in a battery increases with the square of the number of cells (your voltage and current capacity increased by 10x, yielding 100x the energy.) If you build this charger, let me reemphasize that the "LM317 + 1 resistor charger" is more of an academic curiosity, not something to be used for everyday use. – Nick T Nov 10 '10 at 18:54
• Yes i know i'm just implementing it in to my project so i don't have to take out 12 batteries and charge them i can just plug it in to my power supply and let it charge. – Dean Nov 10 '10 at 18:57

A good tutorial using a microcontroler to automatically disconnect the charger when the battery is full is available on http://www.shapely.asia/charge1.html

You can use this for simple trickle charge. Use the resistor to ensure that the charge delivered to the battery is less then C/10 (capacity of battery divided by ten, ie. 1200mAH batter gets 120mA or less). Most NiMH batteries can handle this for quite a while.

There are some pretty cool designs out there for this. As long as you keep your charge current low you can accidentally leave the battery on the charger for many hours past the point of full charge without having to worry about overcharge damage, the downside being that they will take 12 or 15 hours to charge in general.

NiMH have very interesting charge characteristics. They need to be changed very intelligently to stop from possibly shortening their life. If you want something that charges in a time like 4 or 5 hours from fully dead you need an intelligent controller.

• Pretty much the same idea I was going with but with some useful additions. All the parts besides R1 and the 317 are "optional"; D1, T1, R2 just provide a charging indicator, C1 for some basic filtering. – Nick T Nov 10 '10 at 15:59
• I was having internet issues. Sorry, did not see yours. They have similarities, but I was focused on giving a simple solution while you focused on a general explanation of the problem, +1 to you also! – Kortuk Nov 10 '10 at 16:18
• I understand that. They also note that most people are doing trickle charge for months. I specified you can get away with a few extra hours. They suggest never ever trickle charging for extended periods, and I agree. – Kortuk Nov 10 '10 at 17:41

Quoting Russell from the PIClist: "AA cells of over 2000 or so mAh from reputable manufacturers recommend NO trickle charge or low AND extremely short duration trickle charge." Low capacity cells (e.g, 800 mAh AA) are OK with trickle charge.

You are definitely into high-capacity cells with 1000 mAh AAAs. Check the manufacturer's datasheet before charging them with the indefinite-trickle method. However reputable manufacturers place a catalyst that will handle small amounts of excess trickle charging and will be able to handle a few extra hours of C/40 or less charge rate after charged.

The most dependable smart chargers(in relation to ensuring full charge) must use overcharge heating to detect overheating. It is almost unavoidable.