will this "smart" battery charger work?

Ok this is to charge a lead acid 12v 1.2ah battery. My bulk charge is 20% of capacity (240mA) and my float charge voltage is 14.2.

The schematic bellow is what I want to test but I need input as to if it will work or not, and if not why?

The power supply is either 32v or 16v. I think I will need to use 32v because the dropout voltage of the LM317's will be too much. Ok for the bulk charge transistor X is off. Thus two constant current sources are in series, which is 2 LM317's with a 5ohm resistor going to the adjustment pins. So I get a 250mA current. The arduino switches transistor Y off (which cuts the charging circuit) every minute or so to measure the battery voltage. When the battery voltage reaches 14.1v the arduino turns transistor X on. Now it's a constant voltage source of 14.1v and a constant current source of 250MA. After this point I will need to measure current some how and then switch transistor Y off again when I'm happy that the battery is charged fully.

So will this work? Thank for any help. Sorry about the schematic, I drew it in pencil, u might have to zoom abit

Are you using LM317 in a steel can mounted to a really big heat sink with thermal paste and possibly a cooling fan?

That's the only way its going to survive dissipating (32V - 14.2V) * 0.24A of power dissipation.
I think you'd be better off with a switching regulator.

What it "looks" like he's doing it using multiple lm317 to drop the voltages in steps vs just one large drop. But wired incorrectly, the second lm317 needs another resistor to set the regulation voltage and be grounded. If you want 12V use a 7812, and ground it.

The X npn looks like a switch to turn on the regulators? The Y npn, looks like another on/off switch but more direct, both will have a similar effect if wired correctly.

Why is the + side of the battery shorted to ground?
I think what your doing is trying to measure the voltage of the battery and dividing it so you can read it from the arduino. You can move the wire connected to batteries - and connect it to the batteries + but must remove that connection between the + and the 5.4K .

JohnLincoln:
I think you have multiple errors:

The transistor (y) won't work with it's collector connected to the -ve supply.

I'm not sure that changing the left hand regulator from a constant current source to a voltage source will work as you anticipate, when there is an unknown voltage across the right hand regulator.

Look at your ground connections:
The emitter of each transistor is grounded, but the emitter of transistor (x) is connected to the collector of transistor (y)......
so transistor (y) has both it's emitter and collector grounded.
The battery has both it's positive and negative terminals grounded!

Thank you for your input. I barely understand why my transistors are wrong but some of it makes sense so I will just agree with you. I will need to re position my transistors for this to then work properly. However if I replace the transistors with just normal mechanical switches, will the charging circuit work? Forget the atmega chip now, I just want to understand if my idea will work disregarding the transistors now.

CrossRoads:
Are you using LM317 in a steel can mounted to a really big heat sink with thermal paste and possibly a cooling fan?
http://www.digikey.com/product-detail/en/LM317K%20STEEL%2FNOPB/LM317K%20STEEL%2FNOPB-ND/6176
That's the only way its going to survive dissipating (32V - 14.2V) * 0.24A of power dissipation.
I think you'd be better off with a switching regulator.

Thank you Cross roads that's something I missed. I do have large aluminium heat sinks. The only problem is I only have LM317's at the moment. I do not have other components. The power supply can also output 16v but I am afraid the dropout voltage of 2 LM317's will be too much to give me 14.1v in the end

harddrive123:
What it "looks" like he's doing it using multiple lm317 to drop the voltages in steps vs just one large drop. But wired incorrectly, the second lm317 needs another resistor to set the regulation voltage and be grounded. If you want 12V use a 7812, and ground it.

The X npn looks like a switch to turn on the regulators? The Y npn, looks like another on/off switch but more direct, both will have a similar effect if wired correctly.

Why is the + side of the battery shorted to ground?
I think what your doing is trying to measure the voltage of the battery and dividing it so you can read it from the arduino. You can move the wire connected to batteries - and connect it to the batteries + but must remove that connection between the + and the 5.4K .

No I am not trying to drop the voltage in two steps, the first LM317 will drop the voltage in 1 step. The second LM317 is just there to limit current to a maximum of 240mA

According to the spec sheet I found.
No heat sink, it will be in thermal shut down in less then a minute. 4.2W65C/W(J-A) = 273C
With a proper heat sink, 4.2W
5C/W (J-C)= 21C

Random chunks of steel would be better then no heat sink but far worse then the 50 cents it would cost you to get the correct one.

So are you guys telling me I cannot use LM317's to charge a 12v battery?

Yes you almost certainly can, you just need to keep in mind operating temperature of the regulator. They all stop working at ~150C.

There are ways to calculate this from the spec sheet values.

Operating temperature = (deg(C)/W) * (Power dissipated W) - this assumes a room temperature of 25C

The thermal conduction will depend on your setup and who made the the LM317. If you calculate a value greater the 120C, you need to change something, be that a better heat sink, or reducing the power dissipated on the regulator.

I suspect that you need a heat sink of some sort but just remember that a properly designed sink will outperform a chunk of steel several times over.

3200 by 1800 pixels. Please resample to a more reasonable size, like 800 to 1000 pixels across, max.

You need to use standard symbols for your parts.

harddrive123:
What it "looks" like he's doing it using multiple lm317 to drop the voltages in steps vs just one large drop.

The 2nd Lm317 is in current regulation mode, the first instance was creating a constant voltage.

the 2nd transistor to turn off the charging circuit looks problematic.....

calvingloster:
So are you guys telling me I cannot use LM317's to charge a 12v battery?

Basically, "Yes".

I mean, it could be made to work but you probably won't be happy with the result.

It will be much easier/cheaper/safer to just get a battery charger, eg.: http://www.ebay.com/itm/371059092051

fungus:

calvingloster:
So are you guys telling me I cannot use LM317's to charge a 12v battery?

Basically, "Yes".

I mean, it could be made to work but you probably won't be happy with the result.

It will be much easier/cheaper/safer to just get a battery charger, eg.: http://www.ebay.com/itm/371059092051

I'm sorry but that answer is just un acceptable. An LM317 can supply the voltage and current required to charge a 12v battery easily. With some microcontroller logic and transistor you can switch from a constant voltage source to a constant current source. This is a forum where people discuss how to MAKE things. And then u go and recommend I buy a battery charger? I'm sorry that's just not acceptable.

I don't like the choice of an LM317 as that is lossy and would get hot.
I've been using "buck pwm 1 A" circuit boards from ebay with a screw turned to get 14V output from any >15V input.
I'd tend to choose 13.2V rather than 14V for a Pb battery, as the extra volt does not stay stored for very long.

I did not follow the rest of your circuit diagram, but suggest that if you got a $3 buck pwm, that would maintain 14V without needing the additional controller. Your spare arduino could then be used as a datalogger ( 1/3 (battery-zener) voltage for example by inserting a zener from your 5k/10k divider to your battery+) and you look like you want to set it doing some switching. You could choose to set the arduino a/d reference to fixed 1.1 or 2.56 volts instead of the somewhat variable 5V default.

I've had a go at making a "smart battery load" controller with a 100V 80A rated power fet. Be sure to have good heatsinking if you do anything like that. A piece of scrap aluminium 2 inch right angle bar is good to have for cutting up to make heatsinks.

I think you should ditch the LM317's and go for an LM723 with a pass transistor. It would make it much easier to program all the behaviors you want.

Again I do not have the privilege of just ordering components like you guys. I must make due with what I have

I think you should stick with one thread per subject.