Designing a Customized Battery Charger Circuit: Part 3

In our previous tutorials we learned how to customize a constant voltage while building a battery charger, while in the next section we understood how to add a customized constant current to the design for assuring a safe charging for the connected battery.

How to Add an Auto-Cut 0ff in Battery Charger

In this section we'll discover how an auto cut-off may be added to a battery charger which is one of the most crucial aspects in such circuits.

A simple auto cut-off stage can be included and customized in a selected battery charger circuit by incorporating an opamp comparator.

An opamp may be positioned to detect a rising battery voltage while it's being charged and cut off the charging voltage as soon as the voltage reaches the full charge level of the battery.

You might have already seen this implementation in most of the automatic battery charger circuits so far published in this blog.

The concept may be thoroughly understood with the help of the following explanation and the shown circuit GIF simulation:

In the above simulation effect we can see that an opamp is been configured as a battery voltage sensor for detecting the over charge threshold, and cutting off the supply to the battery as soon as this is detected.

The preset at pin (+) of the IC is adjusted such that at full battery voltage (14.3V here), the pin#3 acquires a shade higher potential than the pin (-) of the IC which is fixed with a reference voltage of 4.7V with a zener diode.

The previously explained "constant voltage" and "constant current" supply is connected to the circuit, and the battery via the N/C contact of the relay.

Initially the supply voltage and the battery both are switched off from the circuit.

First, the discharged battery is allowed to be connected to the circuit, as soon as this is done, the opamp detects a potential that's lower (10.5V as assumed here) than the full charge level, and due to this the RED LED comes ON, indicating that the battery is below the full charge level.

Next, the 14.3V input charging supply is switched ON.

As soon as this is done, the input instantly sinks down to the battery voltage, and attains the 10.5V level.

The charging procedure now gets initiated and the battery begins getting charged.

As the battery terminal voltage increases in the course of the charging, the pin (+) voltage also correspondingly increases.

And the moment the battery voltage reaches the full input level that is the 14.3V level, the pin (+) also proportionately attains a 4.8V which is just higher than the pin (-) voltage.

This instantly forces the opamp output to go high.

The RED LED now switches OFF, and the green LED illuminates, indicating the changeover action and also that the battery is fully charged.

However what may happen after this is not shown in the above simulation. We'll learn it through the following explanation:

As soon as the relay trips the battery terminal voltage will quickly tend to drop and restore to some lower level since a 12V battery will never hold a 14V level consistently and will try to attain a 12.8V mark approximately.

Now, due to this condition, the pin (+) voltage will again experience a drop below the reference level set by pin (-), which will yet again prompt the relay to switch OFF, and the charging process will be again initiated.

This ON/OFF toggling of the relay will keep on cycling making an undesirable "clicking" sound from the relay.

To avoid this it becomes imperative to add a hysteresis to the circuit.

This is done by introducing a high value resistor across the output and the (+) pin of the IC as shown below:


Adding Hysteresis

The addition of the above indicated hysteresis resistor prevents the relay oscillating ON/OFF at the threshold levels and latches the relay up to a certain period of time (until the battery voltage drops below the sustainable limit of this resistor value).

Higher value resistors provide lower latching periods while lower resistor provide higher hysteresis or higher latching period.

Thus from the above discussion we can understand how a correctly configured automatic battery cut-off circuit may be designed and customized by any hobbyist for his preferred battery charging specs.

Now lets see how the entire battery charger design may look including the constant voltage/current set up along with the above cut-off configuration:

So here's the completed customized battery charger circuit which can be used for charging any desired battery after setting it up as explained in our entire tutorial:

  • The opamp can be a IC 741
  • The preset = 10k preset
  • both zener diodes can be = 4.7V, 1/2 watt
  • zener resistor = 10k
  • LED and transistor resistors can be also = 10k
  • Transistor = BC547
  • relay diode = 1N4007
  • relay = select match the battery voltage.


If you further doubts, you may feel free to express them through your comments.

70 thoughts on “Designing a Customized Battery Charger Circuit: Part 3

  1. Have questions? Please feel free to post them through comments! Comments will be moderated and solved ASAP.
  2. Hello Swagatam,

    Your name itself welcomes your visitors!

    This is great explanation of the battery chargers, especially to one like me who is not an electronics guy at all!

    I want to charge a car battery using the 12v output of computer SMPS which provides great amp as high as 16A. How can I use the output pin of the SMPS connectors to do the task? Can the SMPS output of regulated 12v be sufficient to charge the battery?


  3. Sir. Thanks for ur great effort.. Let me place my doubt hr . . While charging the battery relay coil volt has to be that of same a battery voltage. So 12 V coil gets 14v across it for long time. In my practical experience it will make relay coil heat and soon a burn out condition occurs.. My square wave inverter charger relay is same type and burns frequently.. Is possible to put any voltsge regulation to relay say 7812?

    • moonlite, a 14V supply will make a 12V relay coil only slightly warm, it will never burn the relay coil, moreover the 14V in a battery charger will reach only gradually and when the battery is fully charged.

      In your case the relay contacts might have burned, not the coil…

      but anyway you can use a 7812 for the relay coil, but that's unnecessary according to me…or alternatively you can add a a few 1N4007 diodes in series with the relay coil for dropping a few volts across it.

    • Thank u sir.. I will try this..sir. I have one 7 Segment display dc volt meter using Pic16f676,, can u make changed on the c program to get it as a battery % level indicator by sensing the battery voltage., That is 0to 100% should not display more than 100,, Hope that u may help me.. Plz provide ur mail id

  4. Hello Sir
    Very good and simple circuit. I have one doubt
    1) when 14.3v output from the lm338 regulator is connected to the auto cut off circuit when the 10.5v battery has been connected, is it certain that the input voltage will sink down to the battery voltage.
    I thought the input voltage will supersede the battery voltage and force the voltage to be at 14.3v while charging.? Maybe am wrong
    2) sir I dont want to use a step down trafo as I want to go transformer less, I will be careful to insulate dangerous parts
    a) I want to employ resistor divider that will take input of 220v to 240v and
    directly and step it down to appropriate smaller AC voltage before being rectified to about 30VDC which is a good input for the lm338.
    B) the resistor divider should be able to handle the rated current of 30A max.
    C) I know a transformer provides isolation from mains in case of Hugh sudden rise in electricity voltage and all that so the input to the resistor should have something like a properly rated fuse protection or something so the should the mains electricity go haywire it destroys the fuse and protects the main circuit.
    I don't want to use my inverter transformer as charger so that it will last and I don't want to use another extra transformer as it increases bulkiness.
    Would appreciate your input.

    • Hello Michael,


      1) If the input supply voltage does not comply with the connected discharge level of the battery, then it would lead to a boiling of the battery electrolyte and possibly an explosion.

      Therefore the input voltage has to settle down to the battery voltage and initiate the expected 10 hour long charging procedure (gradual rise in the voltage level).

      and to implement the above correctly, we strictly incorporate an input current that's 5 to 10 times smaller than the battery AH rating.

      If you don't want to use a step down transformer then you must employ an SMPS…a resistor divider is out of question as resistors would drop huge amounts currents.

      Transformer is not just for isolation, it's specifically for allowing optimal current (amp) to the load…. which can be replaced only with an smps,although an smps could be much costlier.

      for a 24V supply you can change the opamp with any 32V opam such as a LM321

    • Thanks Abu-Hafss,

      I know the article is not entirely complete and can accommodate more info regarding the subject, due to lack of time I could not include everything, if possible in my free time I'll try to update the requested info.

  5. The concepts are very well written, consice and clear. Thank you so much for the deep coverage of the charging subject. Have you encountered the need to charge several identical lipo packs regularly? I have that very need, it is time consuming to recharge 6 high power packs containing 4 cells each every few days. I propose a single cell charger that scans all cells via the balance plugs and serves up the requirement per need during a partitioned interval of the scan period. Arduino sketch, shift registers, descreet coupling and a plan to stitch it together… there is where I bid you to guide me to a viable implementation. If you'd be so kind?

    • Thank you Mr. Schindler, I read your comment on forum page but could not publish and respond because the comments that have exceeded 200 on "pages" do not open or show up.

      That's an interesting topic to investigate, actually I have already tried to design this but could not succeed due to the fact that the cells in a Lipo batt are in series and I could not figure out how a single charger circuit could be used to sense and cut off the individual cells which are all in series.

      However the scanning method looks interesting to me and I feel this could be achievable even through a discrete circuit.

      Due to lack of time I am yet to master Arduino and therefore using this software could be difficult for me..I'll see if it's feasible using only opamps and other relevant parts and try to post it soon…cheers!

  6. hi swagatam sir,
    Plz go through the following link,

    given circuit i am referring from this same blog,
    and i think given circuit is may be previous version of this battery charging circuit
    basically i am trying "linked " circuit for 9 volt ni-mh battery charging,
    and the same what you have explain in this circuit about hysteresis and battery vtg drop also relay toggling is observed even though there is 100 k of hysteresis resistor .

    is that 100k resistor is hysteresis resistor(in linked ckt )?
    should i use this circuit for 9 volt battery charge.

    • Hi Nikhil,

      yes you are right, that's positioned for the hysteresis effect.

      you can use it for charging a 9V battery also, but make sure that input is 12V, and the amp is 5 to 10 times less than that of the battery mAH rating

    • hi sir,
      i am referring:-Designing a Customized Battery Charger Circuit: Part 3 circuit

      1)i am charging 9 volt /300mah (6F22) battery ,for this what should be the relay voltage rating .currently i am using 12 volt suger cube relay?
      2)for this circuit , hysteresis resistor i am using is 100k .
      3) i am getting the same toggling effect of relay,does it due to following reason
      relay voltage rating >battery voltage (i.e.12 V)
      4)plz if possible ,if you are having circuit for 9 volt nimh battery "automatic charge",suggest us.


    • Hi Nikhil,

      what is "same toggling effect"?…do you mean the relay is not holding for too long after the full charge is reached and when the battery voltage is dropping immediately??

      please clarify……or try using a 9V relay.

  7. hi sir,
    some hoe i could manage to get o/p,
    the observations are as given below,

    in interval of 2-3 min, charging and discharging of battery is what i seen.
    does it degrade battery performance ?

    • Hi Nikhil

      the interval can be customized as per your requirement to any limits, so it should not be so difficult.

      If you decrease the value of the hysteresis resistor, you'll be able to get more delay for the intervals.

      the delay interval will not have any affect on the battery, it's perfectly safe.

  8. i have built the circuit but have a problem with the upper and lower settings 12-13,8v is what i am working on
    it switches off at 13.8 but comes on at 13.5 instead of 12 volt
    i have tried everything but can not find the problem

    • what exactly did you try??

      use the "hysteresis" resistor method, and add a diode in series with the resistor, and see the effect, anode will be towards the pin6

      by the way the relay will switch ON at the high cut-off (13.8V in your case), and switch OFF at the lower cut off

  9. hi
    tried the diode but it just makes the difference between 12 and 13,8 smaller
    i am using a 20k resistor for hysteresis maybe you can suggest a better one to stop relay chattering
    i have added a 100nf cap on pin 4 to ground and it is working 98% now

  10. got it working now with a 37k hysteresis resistor without the cap and diode
    maybe you know of a better value for the resistor that will work better as it makes a big difference for the on and off time

    • the diode is only to make sure that the voltage passes from pin6 to pin3…it is noway related to changing the cut off point.

      I cannot see any capacitor in the design which cap are you referring to?

      you can replace the resistor with a 100k pot and optimize the best result as per your requirement

      it's all about holding the pin3 voltage above pin2 until the desired lower threshold is reached, and this voltage is determined by the value of the hysteresis resistor and the existing high cut-off setting of the pin3 preset.

  11. Based on this charger I would like to see this used on a Camper,motorhome situation.
    Most campers/motorhomes have a 120Volt to 12Volt converter.
    When you connect to shore power, the converter runs all 12 volt appliances… so no battery is needed…however we should consider disconnecting the battery from the camper's 12 volt circuit to establish a charge analysis, since the 120 volt to 12 volt converter is running all 12 volt circuits, the battery is not needed. So a power relay arrangement using your modified circuit, would be to disconnect the battery… isolating it to use your charger.
    When battery is in a floating charge state, the charger then waits for the converter to be disconnected for whatever reason.
    then the relays change state and connect the battery to the 12 volt system for use.

    Just a possible enhancement consideration..

  12. Hi sir, I am really sorry to disturb you with many questions. But since I was really confused and u're the only person who can help with my intern project, please let me clear my doubts. I have already read through your designing a customized charger part 1,2,3. My project is mainly to create a charger circuit with auto cut off feature and used to charge different type of batteries having different voltages and current. But they told me that the range of the voltages are from 3-30V and the current is within 0-5A for the batteries.

    (1) Since my input is coming from the DC power supply source which I can set the voltage and current accordingly, I dont need to do the constant voltage and current part from what I understand . Pls correct me ?
    (2) The most important for me is to make sure that the auto cut off is working when it is fully charged. How do I design this without a relay ? And what are other modifications needed according to my specs ?

    Since I'm still a student, troubleshoot the circuit by myself is quite a difficult part. I only know soldering and prototype the circuit according to the schematic. So, please understand me and thanks again for ur patience 😀


    • Hi Chaw, yes you can eliminate the LM338 section completely if you already have a power source with the required adjustable features.

      if you want to remove the relay and charge the battery with a BJT or mosfet, still the cut=off setting up procedures would be the same, as for a relay…the only difference being the battery connections, which would be as explained in our earlier discussed 6V 4 AH charger circuit from this blog.

      you can also try a dual opamp cut off circuit which eliminates the use of of the difficult hysteresis resistor adjustments and the low/high thresholds can be adjusted with individual presets as explained here:

    • Does it mean I can simply apply the cut off part from 6V 4Ah charger circuit ? Without using a relay is more convenient for me because I am trying to charge battery with different voltages and it's a bit difficult to change the suitable relay every time. So, the circuit design will modify into following steps.
      (1) Eliminate LM317 part up to 1N5408 diode connection
      (2) Follow the circuit connection behind
      (3) Those connecting with + of battery goes to + of power supply
      (4) Collector pin of TIP122 and those connecting with – of battery will go to ground accordingly
      Am I correct ? The setting will only be adjusting the 10k preset to get 20% of voltage higher than the battery printed value at the terminals and also give an input of that value right ? Just to clarfiy, will 100k feedback hytherisis resistor can be used for charging from all 3-30V batteries without modifying ?

    • Yes you are correct, except a few points.

      4) the collector of TIP122 will go to the battery negative diode anode and whatever may be associated at that point.

      the 20% higher will be supplied by the charger power supply…the 10k preset at opamp pin#3 needs to be adjusted only for setting up the cut-off level for the TIP122 (at the specified full charge point)

      the 100k feedback resistor will need to be appropriately calculated so that the opamp restores back in its earlier at the given lower threshold value.

    • Noted. I have finished prototyping the circuit u have referred. Let's say I'm going to charge 3.7V 4000mA li-on battery. I will adjust my DC power supply to charge at 4.44V and 2A. Since I am eliminating LM317 part, do I need to adjust 4.44V at the battery terminals also or do I just simply adjust the 10k preset so that the two LEDs do the filp/flop. In my case, which LED is supposed to illuminate when adjusting 10k preset ? Can I remove the 100k feedback resistor and charge the different type of batteries. There could be no issue right ?

    • yes adjust the voltage to exactly 4.2V across the open points which are supposed to be connected to the battery terminals (do this without the batt connected).

      adjust the preset to flip flop the LED to check its response, and then set it such that the LED connected across the opamp out and positive shuts off, while the other LED across ground stays illuminated. that means at 4,2V full charge the positive side LED would illuminate while the ground side would shut off.

      you can eliminate the feed back resistor, but that would cause the LEDs to flip flop at the full charge threshold, causing the charging to initiate as soon as the batt voltage dropped to 4.1V and vice versa.

    • Thanks sir. In your words, u have mentioned that positive side LED and ground side LED. If i refer to the schematic, the positive side LED means the charging status LED and groud side means the full charging status LED. When it reach 4.2V, isnt that the ground side LED must illuminate and the charging status LED shut off ?? So, what is the LED supposed to illuminate when adjusting the 10k pot to set ? From wht I can understand, isnt that charging status LED (positive side) ??

    • Hi Chaw, since a transistor is used for switching instead of a relay, the situation becomes opposite, also you may see that pin#2 is now connected with the preset instead of pin#3 which is opposite to what is normally done with a relay based switching….you can refer to the other diagram on the same page

      remember the transistor here needs to switch ON to charge the battery and switch OFF to stop charging, therefore while its ON, pin6 of the opamp must be ON, which implies that the ground LED must be ON.

    • Sir, I want to ask you more after I tried out my prototype.
      (1) Since i eliminate LM317 part, I dont need to set the output voltage at the battery terminals right?
      (2) Adjusting 10k preset is only to check the LED response and set the cut off, there is nothing to do with the voltage at battery terminals right ? Cuz I can see that when i give 8V input and adjust my 10k preset, mulitmeter shows 7.81 when i turn left and 7.85 when I turn right. Same goes for 12V input, the output is 11 point something.
      (3) I can see the two LEDs make a flip flop. According to what u say, I set the time when the ground LED(red) illuminate and the other shut off. But the positive LED(green) never shuts off completely but giving a dim light. Why is it so ? Do you have any idea sir think its not working for me. All I need is mainly to cut off the battery charging with the voltages ranging from 3-30V and current from 0-5A. And it is more convenient for me if I didnt need to change the components when the battery wanted to charge was changed after one another.

    • And let's say if i wanted to move onto this circuit u referred,
      (1) Can I use IC741 instead of A1 and A2 ?
      (2) Can I design this circuit by simply remove the relay ?
      (4) If so, is there any changes in connection ?
      (3) What does it mean by 6A4x 2nos and load ?
      (4) Is TIP122 or BC547 can replace instead of 2N22222 ?
      (5) Can i use 3V or 5.6V zenor diode instead of 4.7V zenor ?
      (6) Can i replace 1N4148 or 1N5408 instead of 1N4007?
      I am sorry for asking too many question sir. Cus my deadline is nearer and any of the circuit is not successful yet 🙁

    • Hi Chaw,

      the opamp function is limited to supplying the cut-off triggers to the transistor, that's all, it has nothing to do with the charging voltage, a slight drop that you are seeing is normal and will happen even if you connect just a 1k resistor across the supply rails.

      the LeDs may be dimly ON due to leakage voltage from the opamp output….you can connect a 3V zener diode at the opamp output to rectify this issue.

      use 10K resistor for the input reference pin of the opamp and the 10k for the preset, with this set up you can use the circuit for all the batts between 3 and 30V

    • yes IC 741 will do for A1, A2.
      you can remove the relay, and replace the BC547 with TIP127 and connect the battery between its collector and ground
      6A4 = 6amp diode
      where's TIP122? no it cannot be replaced with 2N2222
      5.6V will work instead of 4.7V
      1N4007 will work for 1N4148 but 1N5408 would be bulky and an overkill

    • Hi, sir. I am back !! I was almost done with this project. U know that i am eliminating LM317 part since i have a DC power supply and i am using a relay circuit u have mentioned from 6V 4ah battery charging post. I do the setting as u said: turn the preset and set the time when the ground(red) LED illuminate means its charging and the transistor is on ? so far, the problem is that after the setting, whenever I charge the battery, the positive(green) LED nvr light up. To troubleshoot this, I connect the multimeter across the battery + and + terminal where the battery should be connect and check. I can witness when I turn the preset and illuminate red LED, there is some value of current passing through. When I turn to illuminate green LED, the multimeter shows 0.01 or 0.00 which means the current is cut off. So, it seems to be working properly. But when i charge, the green led didnt light up and the value of current seems to be settled about some point. What is the possible error and how do I troubleshoot sir, thanks 🙂

    • Hi Chaw, No my explanation was not like what you have mentioned above.

      First of all, the battery should not be connected while setting up the preset.

      Next, you must apply the "correct" full charge level to the circuit through a variable supply and then set the preset such that the LED which is assigned for full charge indication lights up at this voltage.

      This concludes the setting up procedure….if green is the LED which indicates full charge then make sure the green LED lights up in the above procedures

      Once this is done you simply need to switch OFF the input power…connect the battery at the relevant points and then switch ON the input supply.

      As soon as the supply is switched ON, you would find the red LED illuminating indicating the batt is charging….and gradually once the battery reaches the full charge level the opamp can be seen reverting its output and switching off the relay (and latching itself through the feedback resistor)

      the green could then be seen illuminated.

      It is as simple as that!

    • sorry sir, i said wrongly. Correction : I am using transistor circuit and yes, i have applied the input voltage to the circuit for now i am using 12V 1.5A adapter currently to charge 7.2V nimh batteries. But the problem is as what i have mentioned above. Am i correct that the red led is the one to illuminate while setting the cut off point and green illuminate when its full charge ?

    • Chaw, since the pin#2 (-) of the opamp input pin is connected to the preset in the transistorized circuit from the following article, it means that when the battery voltage reaches the full level, opamp output would become 0V, which further implies that the LED connected across the positive line will illuminate in this situation… and vice versa.:

      Therefore at the full charge level the positive side LED must illuminate and otherwise the ground side LeD should remain illuminated until the full charge is reached.

  13. Hi Swagatam,

    Thanks for your article, it's very well explained !

    I have a question for you. I have a power supply of 5V and 2 rechargeable batteries of 3.7V. How can I recharge them both with the same power supply ? I guess I can't just put them in parallel and need to recharge them one by one, but then, I will need something to switch from one to another.

    Thank you in advance !

  14. Hi Swagatam,

    When I connect the Pack with 12V the Orange LED is lit and
    battery is charging for a long time without cutting OFF
    danger to overcharge and destroy the battery).
    Normally when battery is fully charged, Orange LED must be OFF and
    Green LED must be ON for stop charging.
    I designed with a program the circuit and send it to you for help.
    The Orange LED is continuously ON and Green LED don't light at all.
    Also it has a Relay 12V DC and is in NC position and doesn't go in NO
    I think that Relay must go in NO position for the Green LED to be light
    through R2=1,2K.
    In what component I must search (by your opinion) for the fault and how this
    circuit is working.
    Let's explain to me with a few words if you have no much time.

    Thanks a lot

    • Christ, which ciruit are you erferring to… if it is for the opamp circuit above Did you adjust the opamp preset as per the instructions prior to connecting the battery? if you do everything as per the instructions, the relay will surely cut off at the upper threshold and vice versa.

  15. Hi
    Nice work!
    I would like know if i could to use a MOSFET for switch supply power instead relay?
    My equipament can not to use relay because noise that happen is very hight. Do you have some other solution for this switching the supply power?

    Thank you

Leave a Comment