go away spammer

Author Topic: Troubleshooting a Battery Charger  (Read 4491 times)

0 Members and 1 Guest are viewing this topic.

Offline KerryTopic starter

  • Jr. Member
  • **
  • Posts: 30
  • Helpful? 0
Troubleshooting a Battery Charger
« on: September 30, 2009, 09:07:41 PM »
Hello all,

I recently finished making an "intelligent battery charger" very closely following the information found here:
http://www.angelfire.com/electronic/hayles/charge1.html

I made only a few changes:
-ATmega8 AVR instead of PIC16C711
-LM350 instead of LM317 variable voltage regulator (as far as I can tell, these are exactly the same, with the exception of the current rating)
-0.62 Ohm, 5W power resistor on output from LM350 (top RH corner of schematic)
-Adjusted the resistors in the voltage divider to get my battery voltage (6V nominal) to make use of the entire 5V ADC input range

I wrote code and (I think) was able to get it working pretty much as described at the above link.  Self test, wait for batter, cool down, soft charge, etc.

No problems with the oscillator, ADC, PWM output, or getting the LEDs working (might not sound too impressive, but this was the first time I've done most of these things, so I was pretty excited :-)).  Still one problem - the battery doesn't charge.  The MCU goes through all the proper steps, fast charges for ~1.5 hours and then switches to trickle mode (so I assume that it also detected a drop in battery voltage after the peak, but I have no way to verify this - I'm assuming my code is working properly).

Measuring the voltage output from the LM350, I can see the PWM bringing the output voltage to near zero volts when the PWM signal is high.  As far as I know, this is correct... but I don't see how the voltage output from the LM350 is being properly adjusted to 1.25 V above the battery voltage - there is a diode between the battery and the LM350 to prevent draining the battery, but this would also keep the LM350 from seeing the battery voltage, right?  So the LM350 is adjusting the output voltage to 1.25 V above ground, not above the positive terminal of the battery?

The datasheet for the LM350 has the attached diagram and this equation:
Vout = 1.25 V * (1 + R2/R1) + Iadj * R2

It also says that Iadj is small so that term can usually be neglected.  So when the PWM signal is high, the transistor grounds the Adj pin on the LM350.  This is like saying R2 = 0, so Vout = 1.25 V.  When the PWM signal is low, the transistor does not allow any current through, and Vout should jump to its maximum for the LM350 (or to the supply voltage, which in my case is ~15 VDC).  In either case, the voltage is not simply 1.25 V above the battery voltage.

Any ideas for things to try?  Please let me know if you need more information, want to see the code - whatever.  I'm trying to understand this circuit better so I can figure out what to expect and what needs to be corrected.

Thanks,

Kerry

Offline KerryTopic starter

  • Jr. Member
  • **
  • Posts: 30
  • Helpful? 0
Re: Troubleshooting a Battery Charger
« Reply #1 on: October 01, 2009, 05:05:01 PM »
Further down in the LM350 data sheet is the image below.  This one seems a bit more relevant, since this appears to be more like the usage in the schematic.

I think I can paraphrase everything in my previous post with one question:
Is the Iout the only thing that matters, or must we also have a higher potential at Vout than we have at the positive terminal of the battery?

I'm trying to trace the path the current takes and this is what I'm coming up with:
-When PWM is high, Adjust pin is at close to 0 voltage.  Vout is at 1.25 V (confirmed this with measurement), so as far as I can tell, there is still close to 1.25/0.62 = 2 A through the power resistor.  Is all of this going to ground through the transistor?  My gut says this is a lot for a transistor, but I'm not sure.  Can't seem to find anything clear-cut on the data sheet regarding this, or maybe I just don't understand transistors very well.
- When PWM is low, Adjust pin should reach close to the supply voltage (adjust voltage will be close to Vout, which will in turn make Vout higher, etc etc until it is saturated).  I measure this voltage at close to 6V without a battery present (~7V with a battery present), even though my supply is close to 15V.

Thanks for the help!

-Kerry

Offline Soeren

  • Supreme Robot
  • *****
  • Posts: 4,672
  • Helpful? 227
  • Mind Reading: 0.0
Re: Troubleshooting a Battery Charger
« Reply #2 on: October 01, 2009, 08:09:40 PM »
Hi,


Quote from: Kerry
[...] but I don't see how the voltage output from the LM350 is being properly adjusted to 1.25 V above the battery voltage
It ain't!
The LM350 is used as a constant current generator.


Quote from: Kerry
- there is a diode between the battery and the LM350 to prevent draining the battery, but this would also keep the LM350 from seeing the battery voltage, right? 
Yes.


Quote from: Kerry
So the LM350 is adjusting the output voltage to 1.25 V above ground, not above the positive terminal of the battery?
When the Adjust terminal is grounded yes.


Quote from: Kerry
The datasheet for the LM350 has the attached diagram and this equation:
Vout = 1.25 V * (1 + R2/R1) + Iadj * R2
Doesn't matter, as the low output is isolated by the diode.


Quote from: Kerry
It also says that Iadj is small so that term can usually be neglected.  So when the PWM signal is high, the transistor grounds the Adj pin on the LM350.  This is like saying R2 = 0, so Vout = 1.25 V. 
I_adj is of no consequence at all in that situation.


Quote from: Kerry
When the PWM signal is low, the transistor does not allow any current through, and Vout should jump to its maximum for the LM350 (or to the supply voltage, which in my case is ~15 VDC). 
It should show a voltage somewhat below your input voltage... That is, if the battery is not connected.
When the battery is connected, the output of the LM350 should be one diode drop plus (R_limit * I_charge) above the battery terminal voltage.


Quote from: Kerry
In either case, the voltage is not simply 1.25 V above the battery voltage.
No, it depends on the charging current.


Quote from: Kerry
Any ideas for things to try?  Please let me know if you need more information, want to see the code - whatever. 
I'm trying to understand this circuit better so I can figure out what to expect and what needs to be corrected.
If you remove the BC548 from the circuit and it still don't charge the battery, either the LM350 or the 1N5404 is dead.

How do you determine that the battery isn't charging?


Quote from: Kerry
-When PWM is high, Adjust pin is at close to 0 voltage.  Vout is at 1.25 V (confirmed this with measurement), so as far as I can tell, there is still close to 1.25/0.62 = 2 A through the power resistor. 
Is all of this going to ground through the transistor? 
Nope, when there's nothing to suck the current, no current is being drawn.


Quote from: Kerry
- When PWM is low, Adjust pin should reach close to the supply voltage (adjust voltage will be close to Vout, which will in turn make Vout higher, etc etc until it is saturated). 
No, it will allow the current generator to function with a high enough voltage for the battery to charge.


Quote from: Kerry
I measure this voltage at close to 6V without a battery present (~7V with a battery present), even though my supply is close to 15V.
With no battery, it should go to a few volts below supply, with battery connected, it should be as stated above.
Regards,
Søren

A rather fast and fairly heavy robot with quite large wheels needs what? A lot of power?
Please remember...
Engineering is based on numbers - not adjectives

Offline KerryTopic starter

  • Jr. Member
  • **
  • Posts: 30
  • Helpful? 0
Re: Troubleshooting a Battery Charger
« Reply #3 on: October 02, 2009, 07:55:45 AM »
Wow, thanks for the reply, Soren  :)

I'm pretty sure the battery isn't charging because when I plug it into my $50 robot, it only lasts ~30 seconds before the servos grind to a halt and the MCU resets.

I'll do some more testing, I guess.  Thanks for the help.

-Kerry

Offline KerryTopic starter

  • Jr. Member
  • **
  • Posts: 30
  • Helpful? 0
Re: Troubleshooting a Battery Charger
« Reply #4 on: December 22, 2009, 08:43:35 PM »
I've had some time to experiment and to think about the circuit some more, and I have some more questions.  I put a power resistor between the diode and the positive terminal of the battery, and measured the voltage drop across it thinking that this would be an indication of the current flowing into the battery.  Is this valid?  I know this isn't usually the way it works, but the current regulator is confusing me.  I don't have an ammeter that will work in the range I need.

The voltage drop across the 10 Ohm resistor was only ~0.02 V.  This works out to 0.002 A, which is about 1000 times less than I was expecting.

Can someone explain the constant current source?  In the datasheet for the LM350 there is a schematic (see a couple of posts above) showing a resistor between the Adj and Out pins on the LM350, which provides a constant current.  In my schematic, there is an additional 1000KOhm resistor between where I need the constant current source and the Adj pin.  Does this explain the factor of 1000 that my current was off?  I don't know how to analyze the circuit with the LM350 in the loop - the sum of the currents at the junctions between the power resistor and the diode gets confusing...

What exactly is happening when the PWM toggles the transistor?  I provided some thoughts in a previous post, but now I'm not sure they were correct.  If the PWM signal is high, is this "almost grounding" the Adj pin of the LM350?  Does any of the current provided by the constant current source get routed through the transistor to ground?

And then when the PWM signal is low, it functions just as if the transistor isn't there?  Just the constant current source as shown in the datasheet?

Or maybe this is the wrong way to think about it, since the PWM is really approximating an analog signal, it's more like applying some analog signal to the transistor?

Maybe someone can recommend some reading material that would help clarify?

Thanks in advance!

-Kerry

Offline Soeren

  • Supreme Robot
  • *****
  • Posts: 4,672
  • Helpful? 227
  • Mind Reading: 0.0
Re: Troubleshooting a Battery Charger
« Reply #5 on: December 27, 2009, 07:37:07 AM »
Hi,

I put a power resistor between the diode and the positive terminal of the battery, and measured the voltage drop across it thinking that this would be an indication of the current flowing into the battery.  Is this valid?
If selected right, yes.


The voltage drop across the 10 Ohm resistor was only ~0.02 V.  This works out to 0.002 A, which is about 1000 times less than I was expecting.
Basic Ohms Law. If you want 2A flowing through a 10 Ohm resistor, you need to drop 20V (added to the voltage you need without it).
If you wanna use a shunt (which it is called in this function), you need the least possible voltage drop which still will get you the needed readings.
You shouldn't use anything above 0.1 Ohm for 100mV/1A and 0.01 Ohm (10 mOhm) for 10mV/1A is better.


Can someone explain the constant current source?  In the datasheet for the LM350 there is a schematic (see a couple of posts above) showing a resistor between the Adj and Out pins on the LM350, which provides a constant current.  In my schematic, there is an additional 1000KOhm resistor between where I need the constant current source and the Adj pin.  Does this explain the factor of 1000 that my current was off?  I don't know how to analyze the circuit with the LM350 in the loop - the sum of the currents at the junctions between the power resistor and the diode gets confusing...
The regulator will try to maintain a voltage of 1.25V between Out and Adjust pins. If you use a resistor of 0.68 Ohm, it will put out:
  1.25V/0.68 Ohm = 1.84A.
It will adjust its output voltage to accomplish this (as far as the supply allows).
The 1 kOhm (not 1000 kOhm!) resistor doesn't interfere with the normal function, since the adjust currents are small, but allow the transistor to ground the Adjust pin without shorting the main power to the battery.
You know that when the transistor shorts Adjust to ground it is close to 0V and you know that the regulators Output is 1.25V above Adjust, so the output voltage will be about 1.2V to 1.5V when the transistor is open.


What exactly is happening when the PWM toggles the transistor?  I provided some thoughts in a previous post, but now I'm not sure they were correct.  If the PWM signal is high, is this "almost grounding" the Adj pin of the LM350?  Does any of the current provided by the constant current source get routed through the transistor to ground?
As explained above, the output voltage will be around 1.5V and since there is a diode between the output and the positive terminal of the battery, no current will flow.


And then when the PWM signal is low, it functions just as if the transistor isn't there?  Just the constant current source as shown in the datasheet?
Exactly.


Or maybe this is the wrong way to think about it, since the PWM is really approximating an analog signal, it's more like applying some analog signal to the transistor?
Nope, it's purely ON/OFF.
Regards,
Søren

A rather fast and fairly heavy robot with quite large wheels needs what? A lot of power?
Please remember...
Engineering is based on numbers - not adjectives

 


Get Your Ad Here