Connect with us

12V Battery Charger Schematic

Discussion in 'Power Electronics' started by guitarnoob123, Mar 5, 2014.

  1. guitarnoob123


    Feb 25, 2014
    Hello can anyone explain to me how the battery is charged in this circuit?

    This is from the LM338 datasheet

    [Moderator's note: I've incorporated the schematic into the post for the convenience of everyone. guitarnoob123, you should do this yourself. -- KrisBlueNZ]


    Things I don't understand
    1. Why the 500 ohms resistor at across the regulator's input and output?
    2. Why is the small signal diode 1N457 oriented that way?
    3. Purpose of the 1000pF capacitor at the negative rail of the op amp?
    4. I think the voltage and current are sensed/limited in a way but I can't find the limiting values

    Thanks in advance!

    Attached Files:

    Last edited by a moderator: Mar 9, 2014
  2. Arouse1973

    Arouse1973 Adam

    Dec 18, 2013
    The 500R can be replaced by a diode reversed biased. It is used to discharge the circuit when power is removed.

    The diode is used to turn the transistor and LED on when the output is low indicating charging in progress I guess. If it was not there then it would interfere with the circuit when in float mode.

    The capacitor is to prevent the op-amp from oscillating.

    It's only the current which is sensed and this is the 0.2R resistor and a the reference for this comes from the 15R.

    This circuit will switch to float charge when the current is below a certain value set but the 0.2R and the 15R.

    I think that's right?
  3. KrisBlueNZ

    KrisBlueNZ Sadly passed away in 2015

    Nov 28, 2011
    The circuit uses the LM338 to regulate the output voltage and current to the battery.

    The LM338's output voltage is determined by the voltage at its Adjust pin (the one shown at the bottom). Specifically, the output voltage is 1.24V (nominal) higher than the Adjust pin voltage. This 1.24V difference is generated inside the LM338 and is called Vref, the reference voltage.

    The output voltage is affected by two circuit paths. The voltage divider made from R2+R3 and R1 sets the maximum output voltage. This can be calculated as Vout(max) = Vref + (R1 * (Vref / (R2 + R3))). For the values given, this is:
    Vout(max) = 1.24 + (3000 * (1.24 / (15 + 230)))
    = 1.24 + (3000 * (1.24 / 245))
    = 1.24 + (3000 * 0.00506)
    = 1.24 + 15.1837
    = 16.4237V.

    This is the maximum output voltage from the LM338.

    Its output voltage is also affected by current through R4.

    When the op-amp's output pulls to 0V, R4 is connected almost in parallel with R1. It's not exactly in parallel, because the op-amp output doesn't pull all the way down, and there is voltage lost across the diode, but it's fairly close.

    If R4 was in parallel with R1, their combined resistance would be 2500 ohms, which would give an output voltage of:
    Vout(min) = Vref + ((R1 || R4) * (Vref / (R2 + R3))).
    In that formula, the "||" symbol means "in parallel with". Plugging the values into that formula gives:
    Vout(min) = 1.24 + (2500 * (1.24 / (245)))
    = 1.24 + (2500 * 0.00506)
    = 13.9V.

    So the voltage at the output of the LM338 ranges from 16.4V maximum, if the op-amp's output voltage is high, down to 13.9V (actually a bit higher because of voltage drops) if the op-amp's output voltage is low.

    13.8V is the nominal terminal voltage for a "12V" battery of the kind that this circuit is designed to charge.

    The output current is regulated by the op-amp, which drives its output low to reduce the output voltage if the output current is too high, to stabilise the circuit at the output voltage that produces the desired amount of current flow into the battery.

    R2 and R3 form a voltage divider across the reference voltage, which leaves 76 mV across R2. In other words, the op-amp's non-inverting ("+") input is set to 76 mV less than the voltage at the LM338's output.

    The op-amp compares this voltage with the voltage at the right hand end of R6. When the output current is high enough that 76 mV is dropped across R6 (this occurs at an output current of 380 mA), the op-amp starts to pull its output low.

    This reduces the output voltage, which will cause the current drawn by the battery to drop. The circuit reaches an equilibrium where the output voltage is just right to cause about 380 mA of current to flow into the battery.

    The designer chose an LM301 op-amp for that position because the LM301 has an NPN input stage that is able to compare input voltages all the way up to the positive supply (pin 7). Many op-amps cannot do this, so you really do need to use an LM301 in this circuit.

    As the battery terminal voltage increases, the charging current falls off, and the op-amp's output voltage rises, increasing the LM338's output voltage to compensate for the increasing battery terminal voltage.

    As this happens, the amount of voltage across R5 and the LED falls, and the LED will get dimmer. (The LED is driven by Q1, which is connected as a PNP emitter follower.)

    I don't know how the START pushbutton works, if at all. Forcing pin 1 of the op-amp to 0V will probably force its output either high or low (I don't know which), but I don't see how this would "start" the charge process. The circuit will start charging when a battery is connected and starts drawing current.

    So the circuit is a current and voltage regulator that limits the charging current to about 380 mA by controlling the output voltage. The minimum output voltage is about 13.8V (13.9V minus the 76 mV dropped across R6) and the maximum output voltage is about 16.4V. This is too high, even for a 13.8V lead-acid-type battery.

    I would reduce both R4 and R1, to give lower minimum and maximum output voltages. Assuming you are charging a lead-acid battery to 13.8V, I would limit the maximum output voltage to about 14V. The minimum output voltage should be around 10V because that's the minimum terminal voltage for a fairly discharged battery.

    The charging current could be increased from 380 mA by reducing R6 and/or changing the ratio of R2 to R3.

    If you want specific advice on modifying the circuit to your application, tell us the details of the application.


    In answer to your specific questions:

    I don't know why the designer put a 500 ohm resistor across the regulator. It will have the effect of ensuring a trickle charge, but the main section of the regulator will also trickle-charge the battery at a significant current, because with the values given for R1 and R4, it doesn't stop charging until the terminal voltage reaches 16.4V, which will not normally happen!

    The diode is connected like that so that the op-amp can force the output voltage lower (by pulling its output low, which causes current to flow through R4 and through the diode) but the op-amp does not affect the maximum output voltage. If the diode wasn't there, when the op-amp's output went high it would pull the regulator's output voltage upwards as well. With the diode there, the maximum output is set by R1 (in conjunction with R2 and R3) and is not affected by the op-amp.

    The 1 nF capacitor between pins 1 and 8 of the op-amp is a compensation capacitor. It slows the op-amp's response and keeps the loop stable. It is not related to the "START" pushbutton. It is needed for stability.

    I've explained how the voltage and current limits can be calculated.
    Last edited: Mar 6, 2014
  4. guitarnoob123


    Feb 25, 2014
    That cleared things up.
    Final questions
    Can I omit the push button START? Do I replace it with a wire (short it to ground) or do I leave it as it is (open)?
    Q1, R5 and the LED are not necessary in the charging right?

    Thanks a lot!
  5. KrisBlueNZ

    KrisBlueNZ Sadly passed away in 2015

    Nov 28, 2011
    AFAIK you can omit it. Leave it open.
  6. KrisBlueNZ

    KrisBlueNZ Sadly passed away in 2015

    Nov 28, 2011
    This message is in reply to guitarnoob123's post on a related thread:

    I think we are going to abandon the designs in that thread and continue with this thread.

    OK but how do you determine when a lead-acid is "fully charged"? There is no clear demarcation point, the way there is with other chemistries (NiCd and NiMH will start to heat up quite quickly when fully charged).

    This charger is specifically designed to charge lead-acid batteries. The charging current ramps down as the terminal voltage approaches the maximum regulator output voltage. This is the voltage that I suggest should be reduced from 16.3V to around 13.9V.

    As the battery charges up and its terminal voltage rises, the LM338's output voltage eventually reaches its voltage-limited maximum. The voltage across the current shunt resistor starts to drop, and the current limiting part of the circuit no longer does anything, because the current is now being limited by the lack of voltage drop across the current shunt resistor.

    As the battery terminal voltage approaches the LM338 output voltage, the voltage drop across the shunt resistor, and therefore the charging current, approaches zero. It will never reach zero because the battery has some inherent leakage, so that circuit will trickle-charge it forever. This is a common approach. The whole circuit will draw perhaps 30 mA from the incoming supply, depending on the condition of the battery.

    If you actually want that charger to shut down at some point, you have to define that point. You can do this with (a) a high terminal voltage threshold, (b) a high terminal voltage threshold plus a fixed delay, (c) a low charging current threshold, (d) a low charging current threshold plus a fixed delay, (e) a total charging period timeout, or some combination of those. Personally I would use charge current and timeout, perhaps with a warning that the charge current didn't drop low enough to terminate the charge and the timeout had to kick in, since this tells you that the battery's leakage current is too high because it's getting old - or that you need to increase the low current threshold.

    Current detection could be done with a second LM301 using a lower threshold voltage (split R2 into two) but watch out for the input offset voltage; you might need to null it out. There doesn't seem to be a dual or quad op-amp with inputs that go right to the positive rail like the LM301 - the traditional types (containing the numbers 158, 258, 358, 124, 224, 324, 1458, 4558, 2902, 2904, 3303, 3403 and 3503) don't do it. So you would need two ICs.

    You would also need a latch to keep the regulator turned OFF, and probably some way to prevent significant current drain from the battery - a MOSFET might do it, but watch out for the body diode!

    Have a think about these suggestions and let me know if you want some schematic ideas.
  7. guitarnoob123


    Feb 25, 2014
    I'm sorry but where is the current shunt resistor in the schematic?

    Oh I see. I kind of remember this from a lecture. But how much more efficient it is if I disconnect the charger from the battery instead of trickle charging? I wouldn't bother if I will only save a few watts by adding unnecessary components

    However I'm curious about these techniques

    How do I detect low current using a second LM301? Can I see some diagrams?
    Can't the resistor R6 in the schematic detect it? Or R6 is just used for setting the maximum current?
  8. KrisBlueNZ

    KrisBlueNZ Sadly passed away in 2015

    Nov 28, 2011
    It's R6.
    Efficient? Right, it will only save a few watts. If you want to leave the thing plugged in all the time, you might find it worthwhile to put a relay contact in series with the AC mains supply to the power supply that powers the charger circuit. Put a "START" pushbutton across the contact to start the charger, which will pull the relay in to keep it going. Then when the target is reached, the circuit would let the relay drop out and the whole system would disconnect from the mains, so power consumption would drop to zero.

    This would be a lot tidier if you include the power supply inside the case with the charger circuit in it, rather than having the power supply as an external unit. If you use an external unit, you might as well leave it running all the time; it will draw a few watts continuously at the end of charge, and a bit less when no battery is connected.

    R6 converts the output current into a voltage difference. The voltage across R6 is related to the output (charging) current according to Ohm's Law, which rearranges to V = I R where I is the charging current in amps and R is the resistance in ohms (0.2). The op-amp compares this voltage against the voltage across R2 and reduces the regulator's output voltage to keep the current less than the current limit. See the paragraphs around the middle of post #3 for an explanation.

    The changes needed to detect the termination condition and stop the charger are quite significant, and even with the charger disabled, the power supply that you power it from will still draw a few watts. If low standby power is really important, let me know, and I can draw up a design with a relay to kill the whole thing. It will add a lot of components though.
  9. guitarnoob123


    Feb 25, 2014
    Yes I got the part that R6 adjusts the current and voltage (and vice versa). I'm curious about sensing the current with this : "Current detection could be done with a second LM301 using a lower threshold voltage (split R2 into two) but watch out for the input offset voltage; you might need to null it out."
    How is it different from sensing with R6? Are they different currents?

    Can you provide me a rough sketch? I like to look and appreciate how complex circuits work.

    I think I will follow this latest diagram. I'll just recompute for the components and rate them right.

    One more thing: The application is for an emergency alarm that will work even when there is no power i.e. it will only run maybe once in a blue moon and it should not fail to run when there is no mains.
    What considerations should I make with this given circumstance?
    And am I right to assume that when there is no current drawn by a load there is no power consumed? Because I think linear regulators are not satisfactory even in standby
  10. guitarnoob123


    Feb 25, 2014

    Calculations (output of regulator part):
    Current = 3 amps = Vmax x (R1/(R1+R2+R4))/R5 --> 3.1 amps using standard values
    Vmax = 14 volts = 1.24 x (1 + R4/(R1+R2)) --> 14.117 volts using standard values
    Vmin = 10 volts = 1.24 x (1 + (R4||R3)/(R1+R2)) - VR5
    VR5 = 3 amps x 0.2 ohms = 0.6 *0.2 ohms for current sense resistor, 0.62 volts using standard values
    R1 + R2 = 260 *chosen arbitrarily

    Resistor values with power ratings (standard values):
    R1 = R2 = 130 ohms 1/4 watts
    R3 = 7.5 Kohms 1/4 watts
    R4 = 2.7 Kohms 1/4 watts
    R5 = 0.2 ohms 1 watt each (4 resistors)

    Diodes D2, D3, D4: I used 3 amps diodes but I am not sure if 3 amps will flow on breakdown/low current path of capacitor discharge

    Attached Files:

    Last edited: Mar 10, 2014
  11. KrisBlueNZ

    KrisBlueNZ Sadly passed away in 2015

    Nov 28, 2011
    I don't think you do understand. I've redrawn the schematic with a few points labelled, so I can explain it again.

    I've corrected an error that was present in the original schematic in the data sheet, and is present in your version. The op-amp inputs are reversed. The connection from downstream of R6 needs to connect to the non-inverting ("+") input of the op-amp.

    I've also added a second op-amp and another resistor, R7. R2 in the original schematic was 15 ohms; it is now separated into R7 (3 ohms) and R2 (12 ohms).


    Charging current flows from the LM338, through point A, through R6, through point B, and into the battery. This current flow causes a proportional voltage to be dropped across R6, according to Ohm's Law with R = 0.2 ohms. For example, 100 mA of current causes 20 mV to be dropped across R6. In other words, the voltage at point B is 20 mV lower than the voltage at point A.

    The circuit consisting of R7, R2, R3 and R1 sets the maximum output voltage of the regulator. The regulator internally generates a reference voltage of 1.24V (nominal) and adjusts its output voltage so that the voltage between point A and point E is equal to that reference voltage. The current flow into the ADJ pin is quite small, so we can make an approximation and say that the currents through R7, R2, R3 and R1 are all the same.

    The regulator ensures there is 1.24V across (R7+R2+R3). This means the current in those resistors is I = V / R = 1.24 / 245 = about 0.00506A, or 5.06 mA. The same current must flow through R1, and with the value I've used, 2500 ohms, this will produce a voltage drop of V = I R = 0.00506 * 2500 = 12.653V. This is the voltage at point E if the effect of U2 is ignored. The voltage at point A will be 1.24V higher, i.e. about 13.9V.

    The current (5.06 mA) flowing through R7, R2 and R3 causes voltage drops across them that are proportional to their resistances (because V = I R). This means that the voltages at points C and D will be lower than the voltage at point A by fixed amounts. Point C is 15.2 mV lower than point A, and point D is 75.9 mV lower than point A.

    As explained in the first paragraph, the voltage at point B is also lower than point A, by an amount that's proportional to the output (charging) current. The op-amps are used to compare the voltage at point B to the voltages at points C and D. So the voltage drops across R7 and across (R7+R2) are thresholds, to which the voltage drop across R6 is compared.

    U2 is the current regulator stage. It acts to reduce the LM338's output voltage to limit the charge current. It does this by comparing the voltage across R6 (the shunt voltage) to the voltage across (R7+R2) (the reference voltage). When the shunt voltage is greater than the reference voltage, U2 pulls its output towards 0V, which pulls point E downwards and reduces the LM338's output voltage. The circuit reaches an equilibrium and the current is limited to the current calculated using Ohm's Law with V = 75.9 mV (the reference voltage) and R = 0.2 ohms (the shunt resistance), which is I = V / R = 0.0759 / 0.2 = 380 mA.

    I've added U3. It compares the voltage across the shunt resistor to a different reference voltage: the voltage across R7, which is 15.2 mV. This translates to an output current of I = V / R = 0.0152 / 0.2 = 0.076 = 76 mA.

    When the charger is actively charging the battery, and the charge current is somewhere between 76 mA and 380 mA, the voltage at point B will be lower than the voltage at point C, and U2's output will be low. As the battery reaches full charge and the regulator output voltage levels off at 13.9V, the voltage across R6 starts to drop as the charging current drops. When the charging current goes below 76 mA, U3's output goes high. This could be used (with a simple R-C delay to avoid false tripping, and/or a top-up charge delay) to control a flip-flop that cuts off the charge path when the charge current has levelled off.

    The LM301A has a worst case input offset voltage of 7.5 mV at 25 degrees Celsius, and 10 mV over the full temperature range. This is a significant proportion of the voltage differences being detected - for U2, detecting 76 mV, it's 13%, and for U3, detecting 15.2 mA, it's as much as 66%. Therefore you should null the offset voltage using the circuit shown in the LM301A data sheet.

    I don't know. When you choose your battery, look on the manufacturer's web site for application notes on float charging and standby applications to see what they recommend.

    Regulators (linear and switching) will draw some current all the time, even if the output current is zero.

    BTW your design still has two problems that I mentioned on the other thread, in relation to Q1, your P-channel MOSFET that's in series with the load. It won't switch OFF when the input supply disappears, because the voltage from the battery will back-feed to the input through D2. You need a separate diode between the input of the circuit and the input of the regulator to prevent this. Also you should add gate protection to Q1 - a series resistor (e.g. 3k3) and a zener diode from gate to source (cathode to source, for a P-channel MOSFET). Thirdly, there's no path from the input supply to the load when the charger is charging, because Q1 will be OFF. I suggest you use a separate regulator for this, with two Schottky diodes (or a double diode in a single package) to diode-OR the battery and the regulator output together.

    Attached Files:

  12. guitarnoob123


    Feb 25, 2014
    How about this
    The lower threshold I made for the current is approx 1 amps


    Attached Files:

    Last edited: Mar 23, 2014
  13. KrisBlueNZ

    KrisBlueNZ Sadly passed away in 2015

    Nov 28, 2011
    That's looking a lot better.

    1. Personally I like to show the body diode in all MOSFETs. In this design, Q1's body diode is essential to ensure that battery backup takes over as soon as the second regulator's voltage starts to fall, before the input voltage has fallen low enough to turn Q1 ON. Since the body diode is essential to the proper operation of the circuit, I think it is especially important to show it. If you don't have a MOSFET symbol that includes the body diode, I would draw in a separate diode and mark it "Q1 BODY DIODE".

    2. You should put a load resistor across the power source to ensure that it goes to zero within a reasonable amount of time. During the time that it is falling but hasn't fallen far enough for Q1 to turn ON, the load will be supplied from the battery through Q1's body diode, which has a much higher voltage drop than Q1's channel resistance when forward-biased. Therefore the voltage to the load will be lower, and the power dissipation in Q1 will be higher, during that time. That's why that voltage should drop reasonably quickly.

    3. The low current detector, X4, cannot have its output connected to the output of X2; they will fight each other, causing excessive power dissipation and possible damage to both ICs, and the resulting voltage won't be well-defined.

    In any case, X4's output needs to trigger a latch that shuts down the charger and is reset to start a new charge cycle. I'm not sure how the circuit should make this decision; obviously, when the power source comes up after being OFF, a new charge cycle should be initiated, but the battery must also be recharged periodically, unless you float charge it.

    To float charge it, you need to ensure a certain minimum constant charging current. If it's a lead-acid type of battery, this can be done by simply leaving the charger running all the time; as the battery reaches the target terminal voltage (13.9V or thereabouts), the charging current falls off, and eventually it levels off at a lowish constant value that corresponds to the battery's leakage; this is what trickle-charging means.

    Have a look at the data sheet and application guidelines for the battery you're going to use, to see whether it's better to trickle-charge it or to periodically give it a charge cycle. If trickle-charging is recommended, you don't need X4 and you don't need to shut down the charger at all.

    4. D3 doesn't need to be a Schottky diode; D10 isn't needed; D9 isn't needed; D2 isn't needed. If you think any of them are needed, please explain why.

    5. The shunt resistor doesn't have to be exactly 0.2 ohms. This is just the suggested value from the authors of the applications section of the data sheet. You can avoid the two 2 ohm resistors and make it 0.25 ohms; just adjust the voltage thresholds set by R1, R2, and R14 (if used) accordingly.

    6. It's normal to show the input power source, and the load, at the far ends of the schematic.

    7. Why did you specify an LM307 instead of an LM301? I think the LM307 is obsolete now. The LM301 is ancient too, but it's probably more easy to find.
    Last edited: Mar 23, 2014
  14. guitarnoob123


    Feb 25, 2014
    I don't understand how a resistor can make the source drop faster. What is the theory behind this?

    I made D3 a Schottky diode because I understand that a higher accuracy can be obtained from the parallel combination of R3 and R4 if the diode drop is less. Can I replace it with an 1n4148? I have not used a Schottky diode before so I don't its price versus 1n4148, which is very cheap

    For D9 (same as D2) and D10 (same as D7) ...
    From the LM317 datasheet (I'll be using LM338 though) edited for my schematic "Diode D9/D2 protects against capacitor C3/C1, discharging through the IC during an output short circuit"
    As for D10/D7, I think its for protection too, for the output. I can't remember where I saw it

    Well 0.2 ohms is a good value for a low voltage drop. And the reason I used 4 resistors is to increase the overall power rating of the shunt resistor.

    There is no model for LM301 in my simulator. But I'll use LM301 in the actual implementation
  15. KrisBlueNZ

    KrisBlueNZ Sadly passed away in 2015

    Nov 28, 2011
    I assume that power source comes from the AC mains? In that case it will have capacitors for smoothing, and if you disconnect the load then remove the input power from it, its output voltage will not drop to zero instantly. The time it takes to drop to the point where the pass MOSFET turns ON properly could be one second, ten seconds, even a minute. During that time, the pass MOSFET is conducting the battery backup current through its body diode, so it will have more voltage across it and will therefore dissipate more power.

    That's why I suggest the resistor. But it will waste power. Another option would be a resistor that's enabled (via a transistor) only when the input voltage has already dropped below, say, the battery voltage. But you can try without it, if you don't mind the output voltage dipping about 0.8V below the battery voltage for a while during the changeover.
    No, that's not true.
    Yes, I would use a 1N914/4148.
    Fair enough.
    I don't think it's necessary, but it doesn't hurt.
    Sure, but each 0.5 ohm resistor will dissipate four times as much as each 2 ohm resistor. It seems untidy to me. It's extra items in the bill of material and extra components on the board, for only a small reduction in the power dissipated by the 0.5 ohm resistors. But whatever!

    Edit: How about a single 0.22 ohm resistor. Maximum continuous output current is 1.5A, right? Dissipation is I^2 R = 1.5 * 1.5 * 0.22 = 0.5W. A single 0.22 ohm 1W resistor would be my choice. Here are some examples:

    0.22 ohm, 1W, 5%, flameproof, metal film: USD 0.48
    0.2 ohm, 2W, 5%, flameproof, wirewound: USD 0.51
    0.18 ohm, 1W, 5%, flameproof, wirewound: USD 0.56

    OK. The LM307 seems to have the same feature as the 301 - inputs can go all the way up to the positive supply.
    Last edited: Mar 24, 2014
Ask a Question
Want to reply to this thread or ask your own question?
You'll need to choose a username for the site, which only take a couple of moments (here). After that, you can post your question and our members will help you out.
Similar Threads
There are no similar threads yet.
Electronics Point Logo
Continue to site
Quote of the day