# Standard LM317 Charger for 9V NiMh Batteries



## Syzygies

This is a "by the book" charging circuit for NiMh 9V batteries, as found on its datasheet and as used in Tangent's TPM schematic. I am following standard advice by separately charging each cell, which is a good thing because at the moment they are at very different charge levels. There is nothing novel about this circuit; I am documenting it to make life easier for newcomers, as we are a friendly tribe.

 I've been using NiMh 9V batteries in my Altoids CMoy amp, but I don't have a 9V charger handy, so I built one:







 Power comes in from the right, and two separate 9V battery snaps for charging leave at the bottom. The right pin of each LM317 is "in", the middle pin is "out", and the LM317 controls the current flow through "out" to keep the left pin "adj" exactly 1.25 volts lower than the output. Across a 100 ohm resistor, that current is 12.5 mA, which is what I want. The diode keeps "backflooding" from damaging the LM317, e.g. if I were to short the power supply wires while a battery was hooked up.

 The metal body of the LM317 is also "out", so don't let it short against a metal enclosure. If you like this layout but don't want each LM317 hanging off the edge (not an issue in my recycled enclosure), bend them forward so they face-plant over the rest of the circuit. If you do this, the board can be cut down further.

 Before building this, figure out how the circuit works, and stare at my layout until you believe that I have implemented it correctly. This will come in handy later, when you'll know where to stick multimeter probes while observing the circuit in use.

 To yield a 12.5 mA charging current, the parts list consists of

 2 LM317T linear regulators
 2 100 ohm resistors
 2 1N4001 diodes

 The protoboard is half of a RadioShack 276-150 Multipurpose PC Board, scored and snapped in half as described in Tangent's CMoy Assembling the Amplifier directions. I then sand the cut edge to clean it up.

 My 9V batteries have a capacity of 170 mAh, so a trickle charge of 12.5 mA _nominally_ takes 13.6 hours to fully charge an empty battery. This is called a "C/13.6" charge rate. Generally, anything between C/10 and C/20 is viewed as an acceptable rate for trickle charging, with C/10 so fast that you don't want to forget and leave the batteries charging all week, and C/20 so slow that the batteries might not fully charge. I can live with this rate, in between.

 To test the circuit, I first scanned the underside at 2400 dpi and stared at my solder work. I realized that I was having a really bad day (notice how your handwriting varies?) but there were no shorts. I then tested the circuit using a test cable I had previously made, that lets two multimeters measure volts and amps as the circuit works:






 The LM317 needs an overhead of at least 1.6 volts to function ideally. (Like all circuits, it does _something_ predictable otherwise, but perhaps not what you wanted.) The resistor inserts a drop of 1.25V, and the diode inserts a drop of 0.7V. This adds up to 3.55 volts.

 My 9V batteries are 8.4V nominal, or seven 1.2V cells in series. As these cells reach full charge the voltage difference across the battery will approach roughly 7*1.5 = 10.5V. (My 9V batteries go to a bit higher voltage than I've seen for AA cells; Tangent uses a value of 1.55V per cell, which is conservative but good design.) Add the overhead, we need a power supply that yields a voltage of 14 volts or more at a current of 25 mA. Go a bit under, the charge slows down at the end. Go more than a bit under, the batteries will never fully charge.

 One of my iPod power supplies measures 12.93V when hooked up to this circuit. This is not enough. It is instructive to understand what happens to the circuit under these circumstances: The missing volts get taken out of the 1.25V voltage drop between the "out" and "adj" pins, which collapses to a drop of 0.7V. Predictably, this yield a charging current of 7 mA, not what we wanted.

 My other iPod power supply measures 14.34V when hooked up to this circuit. Using this power supply I'm getting 12.52 mA and 12.53 mA from the two chargers, pretty close to perfect. LM317's are amazing jellybeans. A generic 15V wall wart would work well here.

 It's fun to run these numbers through Tangent's Configuration Calculator for his NiMh Battery Board. He makes different assumptions for a different circuit, but the results are close.

 The easiest way to save about 0.35 volts is to substitute a Schottky diode. I figured out how to also get rid of most of the 1.25V resistor drop using four resistors per LM317; if anyone else is keen to use their iPod power supply but can't do so without finding this last volt somewhere, let me know and I'll document the circuit:






 Update: For a good, cheap wall wart for powering such circuits, consider the wall wart described in the thread $5 18V RadioShack trickle charger


----------



## JHouser

This would be a good Sticky...


----------



## Nisbeth

Quote:


  Originally Posted by *JHouser* 
_This would be a good Sticky..._

 

How about a sub-forum for this sort of "diy-tutorial"? IMHO there are more than enough stickies already... 
	

	
	
		
		

		
		
	


	





 /U.


----------



## Syzygies

Quote:


  Originally Posted by *Nisbeth* 
_IMHO there are more than enough_

 

Agreed. My plan was to let it get buried in the avalanche that is our active forum, then link to it each time someone asked about charging, which has come up often lately.


----------



## randytsuch

Good explanation.
 One other thing you could have done is use 2 317's per circuit. Takes a bit more room and parts, but the parts are pretty cheap, so cost is not really a factor.

 One 317 would be a voltage regulator, and the other a current regulator. I did this to make a SLA battery charger, with the current regulator first, then the voltage regulator.

 For an NIMH charger, I would reverse that order, as you described. I would have the voltage regulator first, then the current regulator.

 Randy


----------



## __redruM

How does the amp fit in with this? Does it connect to the batteries? Also, are your batteries paralelle or in series? Do you still need two 317s if the batteries are in series?
 I've got the two 317 comming and will build this circut next week.


----------



## Syzygies

No, this is an separate outboard circuit, for charging 9V batteries from a mint tin amp. Unlike unscrewing a Hammond case, it's very easy to swap out batteries from an Altoids tin.

 There's no excuse other than educational for such a sprawling layout; redesign it! (I have half boards already cut, and I was reusing an enclosure because I was too lazy to drill and solder another power jack. My enclosure had the room.) Just as everyone should build a CMoy first, after knocking off one of these chargers, building chargers will be obvious, and you can design whatever you like.

 I've posted plenty in the past on where to go from here, e.g. a Dual charger amp on/off switch that separate two batteries for charging, and join them in series for powering an amp. Tell me what you want to do...

 Better yet, figure it out. Notice how the driver never gets car sick on winding roads? All these circuits look fussier or more complicated if someone else tells you what to do. We're all happy to kibitz if you want to run your designs by us.


----------



## Syzygies

Quote:


  Originally Posted by *__redruM* 
_How does the amp fit in with this?_

 

An obvious approach that I don't think has been explicitly stated, is to just put a jack on a tiny amp for charging the battery pack without removing it, and then use an _outboard_ charging circuit in a separate tiny enclosure. The circuit here is a fine outboard circuit. The amp goes in your pocket, the charger goes in your luggage, or knapsack, or gets left home, or whatever, have several at various locations, they're cheap.

 Now one can use a resistor charger when only the iPod power supply is handy, and a regulation LM317 charger when a higher voltage supply is handy.

 The jack attaches directly to the battery, just wire, no circuitry.

 As a bonus, if we're talking a beefy enough battery pack, e.g. AA cells or 1000 mAh AAA cells, then in desperation one could steal a charge through this jack for one's iPod. It's of course better to use separate batteries for each device, but try telling that to someone who's without music 30,000 feet over Kansas!

 There's an ergonomic issue: The trouble with this is that if someone tries to plug in a power supply directly, without going through a charger circuit, the battery will burst. This begs for a special connector, that your friends or customers or demented future self can only find on the end of the provided charging circuit.

 On the other hand, we all have thirty wall warts in our lives, and understand we're supposed to match them with the device, not plug them in willy-nilly. We've all fried some $100 part at some point in our lives by recabling our dens in too much of a hurry. Just using a RadioShack "N" power jack isn't adding an unfamiliar risk to the mix.

 I remember proposing once a DIN connector offering a variety of currents on its various pins, so one could plug in the MINT or the PIMETA in a drunken stupor and be at no risk of mixing them up. The hardware would choose automatically. But this is overkill; just label each charging circuit.


----------



## blip

Neat little circuit. It gives me all sorts of evil ideas about powering my new PIMETA.


----------



## Syzygies

I have a modification of this design that reduces the voltage overhead by a volt or so, while staying with the simple-to-use LM317. I'll post it when I get a chance; I keep roughing out designs where I could use that volt, e.g. 2x 8.4V nominal 9V batteries peak at 2*7*1.5V = 21V, leaving only 3V of overhead with a 24V supply. The above standard circuit wants 1.6+1.25+0.7 = 3.55V overhead. If your supply is generous, you're fine, but what if it isn't? Dropping just a volt of overhead is often what is needed.

 On the other hand, my first PIMETA is using 10 AAA cells, peaking at 15V while charging. I'll be charging it using my Apple laptop 24V supplies. However, it happens that 15V AC power adapters are very easily obtained, e.g. at RadioShack or Fry's.

 The *holy grail* for me would be a charging circuit with no more voltage overhead than is imposed by a silicon switch and a fractional-ohm resistor. I'm imagining a voltage-sensing circuit that runs _beside_ the charge path, not in its way, controlling a multiplex switch feeding resistors appropriate to the changing voltage drop between the charging battery pack and the power supply.

 Somehow this reminds me of the recent renewal of interest in digital stepped attenuators here; this is a similar problem. There's got to be a slicker, cheaper approach than this; what is it?


----------



## theabyss

Nice, thanks!

 But will the charger charging the battery up untill it is full and
 so tricklecharging it after?

 I have some difficulty to see the threshold between charging and
 trickle charging!


----------



## Syzygies

Quote:


  Originally Posted by *theabyss* 
_But will the charger charging the battery up until it is full and so tricklecharging it after?

 I have some difficulty to see the threshold between charging and
 trickle charging! 
	

	
	
		
		

		
		
	


	


_

 

The distinction is somewhat arbitrary. NiMH cells will charge up under a variety of rates, and having a circuit decide when to quit is subtle. Read tangent's NiMH Battery Board and Eveready's NiMH Application Manual to get a feeling for this.

 However, it is felt to be ok to leave NiMH cells charging at a C/10 to C/20 rate for longer that necessary; this also has the effect of "topping them off" with a little extra charge. Too close to C/10, you shouldn't really forget about them for the weekend, too close to C/20, might not be enough current to fully charge them.

 NiMH batteries are robust and fairly cheap; there are bound to be some parts casualties in an experimental hobby. (In New York City, we say that if you're not getting several parking tickets each year, you're not parking aggressively enough.) I wouldn't worry too much about all this; find out what experience teaches you.


----------



## Quacker

In tangnet's description of his fast charging board it seems like that part that controls the amount of voltage that is allowed to the batterys is the MC3334x would there be any way to aply this part or a part like this to a smaller version of his circut so it would be quicker to charge the battery and there wouldnt be any serious overcharging if you forgot it?

 I and kind of new to this so if I sound really dumb and stupid dont grill me on it


----------



## mono

Quote:


  Originally Posted by *Syzygies* 
_I have a modification of this design that reduces the voltage overhead by a volt or so, while staying with the simple-to-use LM317._

 

 Consider LM1085 Adj (adjustable version). They're pin-compatible with LM317 but only have ~ 0.7 voltage drop @ 100mA, sloping up it's still under 1.0V @ 1A. Cost more though, 'bout $1.85 @ Digikey. LM1086 is a little cheaper.


----------



## Syzygies

Thanks, I knew about the LM1086, but not the LM1085.

 The voltage drops from the regulator, resistor, and diode are independent, and can/need to be independently reduced.

 For the regulator, your suggestion is a great one. The "pin compatibility" with the LM317 includes the optional use of a few small caps, which I believe are less "optional" for the LM1085/6. No big deal, just use the caps.

 For the resistor, I figured out a different circuit that gets by with much less than a 1.25V drop across the resistor. The charge current as a function of battery voltage has a gentle slope down to its final value, rather than being a flat constant, but this is actually what I think I want, a "poor man's" fast charger.

 For the diode, Schottky diodes have smaller forward voltage drops. Check the spec sheets to make sure their reverse voltage specs are enough for the circuit.

 Put this together, one can build reasonable charging circuits with 0.7+0.5+0.3=1.5V overhead, rather than 1.6+1.25+0.65=3.5V overhead. That's less than half as much, a savings of two volts.


----------



## TheLaw

Anyone have the schematics exactly to this?


----------



## FallenAngel

http://www.head-fi.org/forum/thread/185377/trickle-chargers


----------

