Home » Battery Cut off Switch Diagrams » Designing a Customized Battery Charger Circuit
Designing a Customized Battery Charger Circuit

Designing a Customized Battery Charger Circuit

I have designed and published a variety of battery charger circuits in this website, however the readers often get confused while selecting the right battery charger circuit for their individual applications. And I have to explicitly explain each of the readers regarding how to customize the given battery charger circuit for their specific needs.

This becomes quite time consuming, since it's the same thing that I have to explain to each of the readers from time to time.

This compelled me to publish this post where I have tried to explain a standard battery charger design and how to customize it in several ways to suit individual preferences in terms of voltage, current, auto-cut-off or semi-automatic operations.

Charging Battery Correctly is Crucial

The three fundamental parameters that all batteries require in order to get charged optimally and safely are:

  1. Constant Voltage.
  2. Constant Current.
  3. Auto-cutoff .

So basically, these are the three fundamental things one needs to apply to successfully charge a battery and also make sure that the life of the battery is not affected in the process.

A few enhanced and optional conditions are:

Thermal management. 

and Step charging.

The above two criteria are especially recommended for Li-ion batteries, while these may not be so crucial for lead acid batteries (although there's' no harm in implementing it for the same)

Let's figure out the above conditions step wise and see how one may be able to customize the requirements as per the following instructions:

Importance of Constant Voltage:

All batteries are recommended to be charged at a voltage that may be approximately 17 to 18% higher than the printed battery voltage, and this level must not be increased or fluctuated by much.

Therefore for a 12V battery, the value comes to around 14.3V which should not be increased by much.

This requirement is referred to as the constant voltage requirement.

With the availability of a number voltage regulator ICs today, making a constant voltage charger is a matter of minutes.

The most popular among these ICs are the LM317 (1.5 amps), LM338 (5amps), LM396 (10 amps). All these are variable voltage regulator ICs, and allow the user to set any desired constant voltage anywhere from 1.25 to 32V (not for LM396).

You can use the IC LM338 which is suitable for most of the batteries for achieving a constant voltage.

Here's an example circuit which can be used for charging any battery between 1.25 and 32V with a constant voltage.

Constant Voltage Battery Charger Schematic

Varying the 5k pot enables setting of any desired constant voltage across the C2 capacitor (Vout) which can be used for charging a connected battery across these points.

For fixed voltage you could replace R2 with a fixed resistor, using this formula:

VO = VREF (1 + R2 / R1) + (IADJ × R2)

Where VREF is = 1.25

Since  IADJ is too small it can be ignored

Although a constant voltage may be necessary, in places where the voltage from an input AC mains does not vary too much (a 5% up/down is quite acceptable) one may entirely eliminate the above circuit and forget about the constant voltage factor.

This implies that we can simply use a correctly rated transformer for charging a battery without considering a constant voltage condition, provided the mains input is fairly dependable in terms of its fluctuations.

Today with the advent of SMPS devices, the above issue completely becomes immaterial since SMPS are all constant voltage power supplies and are highly reliable with their specs, so if an SMPS is available, the above LM338 circuit can be definitely eliminated.

But commonly an SMPS comes with a fixed voltage, so in that case customizing it for a particular battery might become an issue and you may have to opt for the versatile LM338 circuit as explained above.... or if you still want to avoid this, you may simply modify the SMPS circuit itself for acquiring the desired charging voltage.

The following section will explain the designing of a customized current control circuit for a specific, selected battery charger unit.

Adding a Constant Current

Just like the "constant voltage" parameter, the recommended charging current for a particular battery should not be increased or fluctuated by much.

For lead acid batteries, the charging rate should be approximately 1/10th or 2/10th of the printed AH (Ampere Hour) value of the battery. meaning if the battery is rated at say 100AH, then its charging current (amp) rate is recommended to be at 100/10 = 10 Ampere minimum or (100 x 2)/10 = 200/10 = 20 amp maximum, this figure should not be increased preferably to maintain healthy conditions for the battery.

However for Li-ion or Lipo batteries the criterion is entirely different, for these batteries the charging rate could be as high as their AH rate, meaning if the AH spec of a Li-ion battery is 2.2 AH then it's possible to charge it at the same level that is at 2.2 ampere rate Here you don't have to divide anything or indulge in any kind of calculations.

For implementing a constant current feature, again a LM338 becomes useful and can be configured for achieving the parameter with a high degree of accuracy.

I have discussed the subject comprehensively in one of my previous post named universal current limiter circuit.

The below given circuits show how the IC may be configured for implementing a current controlled battery charger.

Schematic for CC and CV Controlled Battery Charger


As discussed in the previous section, in case your input mains is fairly constant, then you can ignore the right hand side LM338 section, and simply use the left side current limiter circuit with either a transformer or an SMPS, as shown below:


In the above design, the transformer voltage may be rated at the battery voltage level, but after rectification it might yield a little above the specified battery charging voltage.

This issue can be neglected because the attached current control feature will force the voltage to automatically sink the excess voltage to the safe battery charging voltage level.

R1 can be customized as per the needs, by following the instructions furnished HERE

The diodes must be appropriately rated depending on the charging current, and preferably should be much higher than the specified charging current level.

Customizing current for charging a battery

In the above circuits the referred IC LM338 is rated to handle at the most 5 amps, which makes it suitable only for batteries upto 50 AH, however you may have much higher rated batteries in the order of 100 AH, 200 AH or even 500 AH.

These might require charging at the respective higher current rates which a single LM338 might not be able to suffice.

To remedy this one can upgrade or enhance the IC with more ICs in parallel as shown in the following example article:

25 amp charger circuit 

In the above example, the configuration looks little complicated due to the inclusion of an opamp, however a little tinkering shows that actually the ICs can be directly added in parallel for multiplying the current output, provided that all the ICs are mounted over a common heatsink, see the below diagram:



Any number of ICs may be added in the shown format for achieving any desired current limit, however two things must be ensured in order to get an optimal response from the design:

All the ICs must be mounted over a common heatsink, and all the current limiting resistors (R1) must be fixed with a precisely matching value, both the parameters are required to enable an uniform heat sharing among the ICs and hence equal current distribution across the output for the connected battery.

So far we have learned regarding how to customize constant voltage and constant current for a specific battery charger application.

However without an auto cut-off a battery charger circuit may be just incomplete and quite unsafe.

So far in our battery charging tutorials we learned how to customize constant voltage parameter while building a battery charger, in the following sections we will try to understand how to implement a full charge auto cut off for assuring a safe charging for the connected battery.

Adding 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.

How to Charge a Battery without any of the Above Facilities

If you are wondering whether it is possible to charge a battery without associating any of the above mentioned complex circuits and parts? The answer is yes, you can charge any battery safely and optimally even if you do not have any of the above mentioned circuits and parts.

Before proceeding it would be important to know the few crucial things a battery requires to charge safely and the things that make "auto cut off" "constant voltage" and "constant current" parameters so important.

These features become important when you want your battery to be charged with extreme efficiency and quickly. In such cases you may want your charger to be equipped with many advanced features as suggested above.

However if you are willing to accept the full charge level of your battery slightly lower than optimal, and if you willing to provide a few hours more for the charging to finish, then certainly you wouldn't require any of the recommended features such as constant current, constant voltage or auto cut off, you can forget all these.

Basically a battery should not be charged with supplies having higher rating than the battery's printed rating, it is as simple as that.

Meaning suppose your battery is rated at 12V/7Ah, ideally you must never exceed the full charge rate above 14.4V, and current over 7/10 = 0.7 amps. If these two rates are correctly maintained, you can rest assured that your battery is in safe hands, and will never get harmed regardless of any circumstances.

Therefore in order to ensure the above mentioned criteria and to charge the battery without involving complex circuits, just make sure the input supply that you are using are rated accordingly.

For example if you charging a 12V/7Ah battery, select a transformer which produces around 14V after rectification and filtration, and its current is rated at around 0.7 ampere. The same rule may be applied for other batteries also, proportionately.

The basic idea here is to keep the charging parameters slightly lower than the maximum permissible rating. For example a 12V battery may be recommended to be charged upto 20% higher than its printed value, that is 12 x 20% = 2.4V higher than 12V = 12 + 2.4 = 14.4V.

Therefore we make sure to keep this slightly lower at 14V, which may not charge the battery to its optimal point, but will be just good for anything, in fact keeping the value slightly lower will enhance the battery life allowing many more charge/discharge cycles in the long run.

Similarly, keeping the charging current at 1/10th of the printed Ah value makes sure that the battery is charged with minimum stress and dissipation, rendering a longer life to the battery.

The Final Setup

basic battery charger circuit using transformer and rectifier

A simple set up shown above can be universally used for charging any battery safely and quite optimally, provided you allow sufficient charging time or until you find the needle of the ammeter dropping down to almost zero.

Have further doubts? Do not hesitate to express them through your comments.

Source: battery charging


About the Author

I am an electronic engineer (dipIETE ), hobbyist, inventor, schematic/PCB designer, manufacturer. I am also the founder of the website: https://www.homemade-circuits.com/, where I love sharing my innovative circuit ideas and tutorials. If you have any circuit related query, you may interact through comments, I'll be most happy to help!

41 thoughts on “Designing a Customized Battery Charger Circuit”

  1. Howdy, Friend! Interested to Learn Circuit Designing? Let's Start Discussing below!
  2. Hi swag..
    I have 12v 6ah and 5amp trasnformer along with lm317 set to 14.2v
    How to know if the battrery is fully charged?

  3. Hello,
    I am planning to charge a 12V lead acid battery with your circuit.
    I have tried your circuit in a bread board ,but it had some problems.
    First off all,what is the value of hysteris resistor i need to again start auto charging when the battery charge becomes, say 30%.??
    And as shown in the above simulation the red led doesnot light up. Only the green lights up all the time.
    And at what value should i set the 10k preset to charge 12V lead acid battery.?

    • hysteresis resistor will need to be found through trial and error by experimenting with different resistors and increasing or decreasing the values proportionately until the right cut off is achieved.

      you can change the LED positions as shown in the following diagram for correct response, because IC 741 is not an efficient opamp and has a large offset voltage which may keep the green LED permanently On,


      initially keep the 10K preset at pin#3 of the opamp to ground, switch ON input power, adjust the the LM338 pot to 14.3V, and finally next adjust the 10K preset until the green LED just lights up, this will set the upper full charge cut off.
      remember to remove the green LED from the shown position and place in series with the transistor base or you can also replace it with the base zener of the transistor

  4. sir thanks for cheering your precious time with me, but is 3amps enough for the gate of a 600v 1200 amps igbt assuming i use the tip31 and tip32 you recommended for me sir for switching the igbt on and off fast or sir can you direct me to any efficient and simple igbt gate driver for novice like me

    • Abioye, IGBT gates do not require high current to operate, just like mosfets they too can work with minimal current across their gate/emitter, but they are better than mosfets because they can be operated with minimal voltages also, and have lower On time resistance than mosfets

  5. sir i have a cpu power stage that i tweak it setting to produce (+18v %-18 volt ) instead of (+12v & -12 volt) but i want the negative output to be (-9 volt ) in stead of (-18 volt) please can you kindly refer me to a circiut i to use it as a dc to dc converter for the gate driver circiut to drive igbt for electric car

    And sir i think BD140 and BD139 is capable of 3 or 2amps is there any transistor that that as the similarities of BD140 and BD139 but can give up to 6 or 5amps

  6. Hello sir swagatam , i made the circuit but when i connect my battery to the circuit it does not charging showing but voltage across battery terminal is same as applied , i did not decrease .
    1. what does it mean?
    2. Is my ciruit wrong ? If it is then what should it do to correct it? and
    3.Iam unable increase my voltage regulator output to applied voltage
    i.e.,if i apply 12v at input iam getting maximum of 7 volts output (by changing the 5k pot).

    • Hello Kranthi,

      Please use a 10K pot, and set the output to 14V, and for this you will need an input of at least 18V.
      Please do this and check the response again.
      When you connect the output with your battery, the voltage must immediately drop to the battery’s existing voltage level, and then begin rising slowly as the battery charges.
      and Make sure to select the current control resistor correctly.

      If you are using a transformer or the input supply source with a current rating 1/10th of your battery Ah, in that case the current control stage can be eliminated….

  7. Hello sir Swagatam,
    Thank you so much for the published article. I have few questions:
    I want to use the schematic to charge four 7AH batteries connected in parallel, which gives a total of 28AH.
    1. How do I set R1 to match the correct output current which is about 2.8A? If I want use fixed resistor for R1, how do I make the calculation?
    2. If I want use a fixed resistor for R2, how do I make the calculation in order to achieve 14.8V, which is the required voltage for charging?
    3. What is the function and value of the zener diode connected to BC547?
    4. Can I use LM358N as the opamp?
    5. Will the two LM338 require heat sinks for the said purpose?
    6. How do I calculate the value of the hysteresis resistor for the said purpose?
    Anticipating your usual prompt response. Thank you sir.

    • Thanks Godson, for a 28 AH battery, you can set

      R1 = 1.25 / 3 = 0.41 ohme, 5 watts
      for R2 you can try the following software


      the zener is used to prevent leakage voltage from opamp output to get into the transistor base, instead of zener you can use a 1K resistor across base/emitter

      you can use any other opamp, all will work, LM321 can also be tried

      for calculating hysteresis resistor you can study the following article


      • Hello sir Swagatam,
        Thanks a lot for the reply. Regarding using fixed resistors for R2, what will be the power rating of the resistor? What will be the power rating of the 120ohm resistor connected between the “output” and the “adjust” pins of th LM338?

          • Hello sir Swagatam,
            Thanks a lot for the reply. Please I would like you to help me with the following info:
            1. If I want to obtain 12V from a 12V transformer based power supply, can I simply connect a 12V zener diode across the filter capacitor? I want to use it to run the cooling fan for my inverter which is rated 12V DC.
            2. I need a schematic diagram of a transformerless power supply that can conveniently run an IC and can deliver between 100mA and 200mA.
            Your reply will be appreciated sir.

            • Hello Godson,

              the zener will burn and create a short circuit if the input is from a transformer because the transformer will have much higher current than the zener rating, a series resistor can be used with the supply to prevent but that would also reduce the current output to a very low level, insufficient for the fan.

              the correct way would eb to use a 7812 IC, or a transformerless power supply will also work, but will not be isolated from mains and may cause fatal electric shock if touched in powered condition.

              you can try the following design:

              use 5uF/400V for C1, use 5 watt zener (1N5349B) for the zener, and replace the 50 ohm with a 22 ohm resistor

  8. Hello

    I would like know if is possible regulate voltage and current just with one lm317.
    Example. I would like 4.2V just with 150mA.
    I cant to place 2 regulator because cost project will be stay very heigh. So for me is very import know if this is possible.

    Best Regards

  9. Hello

    I would like know, if I can do a charger circuit for battery lipo just with a CI LM337 with current constant.
    and a AMPOP, how voltage comparator para turn off when to be 4.2V

    I would like let my circuit without voltage constant because i know that only current constant the CI lM317 do this to work voltage regulator for the current.

    I would like know if is possible charger battery lipo this way ?

    Best Regard

    congratulation for blog perfect in subject.

      • Thank you for the answer.

        Just for confirm your answer. I have a littel doubet that cause a confusion in my understand.

        When you say adjust output for 4.1V, you say adjust the LM317 for this output or adjust the cut AMPOP for 4.1V.

        Because always in circuit when seen in internet is build with current and voltage constant. Setuping first LM317 how constant current and second LM317 how constant voltage.

        I would like eliminet the second LM317 with constant output, and let this job all to the first LM317 that control current e voltage. And who will control the cut output is AMPOP.

        thank you

        • 4.1 V should be adjusted using the LM317 preset to get a constant 4.1V out for the battery, please see the first diagram in the link which I referred, it has only a single LM317 IC based design, with a BC547 stage for the current control

  10. HI sir,
    i want to ask that some other topic’s question.”To get 2amp power output can i use two lm7805 in parallel in circuit?”

  11. Dear Sir,
    I have recently purchased 2pcs of 6V 4.5Ah SLA and 1pc of 12V 12Ah battery but currently i am not using them.

    I will be using them in the near future as and when i need them.

    I don't want the newly purchased batteries to self discharge, so i wish to keep them on continuous charging system i.e., 24Hrs non-stop.

    What i wanted to know was how much current and at what voltage should i need to apply continuously on the batteries?

    Also is a continuous charging system dangerous to the battery OR one can implement it freely without any issues?

    • Hi Sherwin,

      to keep the battery healthy you can keep it trickle charged using an automatic battery charger.

      you can charge it at a constant current rate which may be at 1/10th of its AH rating and then float charge it with a 1/50th AH rate…. this figure is not too critical but lower current is preferred for the float charge.

  12. Hi sir,
    Your blog is very much interesting.
    Sir I need some help to build CONSTANT VOLTAGE OUTPUT,
    As I have 1kw alternator, It gives 0-50vdc output, but it's fluctuating & will be varied from 0 to 50vdc….I need constant voltage for battery charger, so that I can connect FAST BATTERY CHARGER CIRCUIT to that output…..Can I use LM338?………Please suggest me. Your help will be very HELPFUL.

Leave a Comment

Do NOT follow this link or you will be banned from the site!