Simple DC UPS Circuit for Modem/Router

The following explained circuit of a DC UPS can be used for providing back up power to modems or routers during mains failures, so that the  broadband/WiFi connection never gets interrupted. The idea was requested by Mr. Galive.

The Circuit Request

bro I need a circuit like,
I have two 12v dc adapter(600mA and 2A).
When input Mains is present, with the 600ma adapter i want to charge the battery(7.5AH) and with the 2A adapter i want to use my wifi router.
when the AC mains fails the battery will backup my wifi router without UPS.
MY modem is rated as 12V 2.0A. That is why i want to use two 12v dc adapter.

The Circuit Design

Two adapters actually are not required for the proposed application. A single adapter, probably the one which is being used for charging the laptop battery may be used for charging the external battery also.

Looking at the given DC modem UPS circuit diagram we can see a simple yet interesting configuration involving a couple of diodes D1, D2, and resistor R1.

Normally a laptop charger is specified with 18V, so for charging a 12V battery this needs to be lowered to 14V. This is easily done using a transistor zener stage.

When mains is present, the voltage at D1 cathode is more positive than D2, which keeps D2 reverse biassed. This allows only D1 to conduct, supplying the voltage from the adapter to the modem.

D2 being switched OFF, the connected battery starts receiving the required charging voltage via R1 and begins getting charged in the process.

In an event AC mains fails, D1 gets switched OFF, and therefore allows D2 to conduct, enabling the battery voltage to instantly reach the modem without causing any interruptions to the network.

R1 must be selected depending upon the charging current rate of the attached battery.

A much better and improved version of the above is shown in the following diagram:


195 thoughts on “Simple DC UPS Circuit for Modem/Router

  1. Have questions? Please feel free to post them through comments! Comments will be moderated and solved ASAP.
  2. Just what I was looking for! But I'm a novice…

    Can you please give the list of the exact items needed to build this?

    What sould be the value of R1 if I need 100ma charge?

    I can't figure out the 220, 1 watt item, is it a resisotr?


    • You may eliminate the transistor TIP122, the 14v zener, and the 220 ohms resistor, these are not required.

      Connect the adapter input directly across the R1/D1 input junction and ground.

      D1, D2 = 1N5402
      R1 = 100 ohms, 2 watt
      battery = as per need, prefeably 12V/7AH
      adapter = 14V/2amp

  3. Hi,
    Actually I am very (really very 🙂 ) new in electronics but I have ability to understand detailed instructions 🙂

    Actually I didn't understand few things in this circuit:

    1. Which 12v adapter used on this system ? laptop adapter or just another 12v adapter (from market)?

    2. I have 1 DSL'r modem (12v – 1A) and one 150 MBPS Router (9V – 0.6A. can I use this circuit ? can you please confirm that this will not damage any device (modem and router)?

    3. if here laptop charger used can I use my laptop charger? (its 18.5v – 3.5A) HP 65W charger.

    4. If I use the laptop charge is not this damage the charger ? because of its extended duty ?? to charge the external battery ?

    5. How much Efficiency in this circuit/ system ?

    6. I need to run just the modem and the router mentioned up and this need to be give me backup 1 hour 30 min avg after each 3-5 hour. (load-shedding occurs after each 3-5 hours for about 1 hour).

    I respect your kind information and help… With best regards, I am awaiting to know the answer/information from you.

    I will be very happy if you give me a proper direction/suggestion on my case and I believe here's almost all of my friends and next door neighbors suffers in this same issue.

    Please give the appropriate information/suggestion, Surely this will not only help me this will also help more than hundreds of people here and there.

    I am awaiting for your kind response.


    • I am suggesting the following as per my opinion, but I cannot confirm anything.

      Since you have two gadgets with different voltage specs, you will have to employ two separate adapters in conjunction with two separate circuits as shown above (the improved one).

      You can feed the two circuits through an existing 18V supply, but then you will have to introduce additional 7812 and 7809 regulator stages in between the output of the above circuit and the modems.

      efficiency will depend solely on the battery quality.

      Initially you can try with a 12V/4ah battery

  4. Good info. Thanks. Do you have a circuit diagram to detect fully charged battery and switch to floating charge?
    Eg For 12v 1 or 2Amp output Ups using a 50-100ah 12v AGM deep cycle battery, as I understand AGM batteries charge around 14.5+v and float charges arounds 13.5v.

  5. I have no 1N5402. Would it be possible to use a 4004 instead in this application? Forward voltage drop is only 1.1V (1V for the 5402), and allows for less amperes. If used with a low-draw modem, would such a replacement be correct?

    And if I want to power both a modem and a router from the same battery, different voltages, would I be able to use my DC booster to get the required 18V for the modem while keeping 12V for the router?

    • Thanks for your quick answer Swagatam. My goal is to re-use small 12V batteries I have to power the essentials: Modem and internet gear!

      I will be using the inverter in a car. Considering the hassle associated with building a homemade inverter (namely, hard-to-find transformer and costly radiators), I'd rather buy a ready-made one.

  6. Oh, and what wattage should R1 be? Charging current squared times number of ohms calculated?

    I am a bit afraid that this DC UPS, having no charging regulation, reduces the battery life.

    • In the second circuit which uses the IC 317, wattage of R1 will be 1.25 x battery AH/10, yes without an auto cut-off it wouldn't be the best of the chargers, however the inclusion of the 317 current controller stage would help to keep the battery safeguarded to a considerable extent.

  7. Hi Swagatam,
    This is a nice solution I have been looking for and very simple to implement, but I want to use it to power a monorail motherboard, that is rated for 12V, but a about 5A, what do I need to do to this circuit to help me deliver 12V, 6A, and what battery capacity do you recommend.

    • Thanks Elijah,

      for a 12V 6A load the recommended battery would be a 12V 40 ah, this would provide a back up of around a couple of hours max.
      For this you can simply eliminate the resistor R1 (in the second design) and use a LM338 IC in place of the IC 317.
      LM338 is specified for operating at maximum 5amps, so the battery would be always charged at the optimal rate of 5amps safely.

    • HI Swagatam,
      I appreciate your magnanimity at your replying me. I actually have implemented the circuit replacing Lm 317 with LM 338. It work quite well, but figured out that Diode D1, is getting very hot, I have to shut down. My guess was that the load (a monorail motherboard with other accessories are drawing a lot of current, while the battery is also charging. I changed the diode to 1N5408…thinking it should work, yet it is still very hot, though it worked well, I also eventually have to shut it down what do you advise, what am I doing wrong?
      And or what am I suppose to do?

      2- My adapter has a light by the side that lights up when its doing it job. I also discovered that despite taking the mains off, but battery is still connected to my board, the green light on the adapter still lights up/ Hope current is not flowing back from battery…..

    • Hi Elijah,

      Is the diode getting hot even without the load connected? If so then there could be some problem with the LM338 circuit. Otherwise its fine, you may put a couple of more1N5408 diodes in parallel to the existing one.

      To stop a reverse flow of current from the battery, put a diode at the input of the LM338, this will prevent the battery voltage from leaking back to the modem.

  8. Hello Swagatam,
    Thank you so very much on this, without Load, I have not experience the heat, but I will check again and observe. Do you have any recommended make of the 338.

    I will try to work on the leakage and feed you back.

  9. Am doing an additional follow up despite sending you an earlier one. The reverse current still flows, despite putting a diode, may be am putting it wrongly. Kindly help. This is the way I did it. Am using 1N5401 for this, this is the arrangement, the input positive power rail is connected to the anode of the diode and the cathode of the diode connects to the input of the LM 338…. Is that right?

    Secondly, I have also added 2 additional diodes in parallel to D1.

    Thanks for your support.

    • Elijah, that cannot be possible…a diode at the input of the LM338 will never allow an opposite flow of current,

      the suggested diode connection is correct.

      The band side of the diode is the cathode.

  10. Swagatam,
    everything works well, but am having problem with the diodes, I used 4 1N5401, but they are still getting warm…..what should I do with this diodes…..

  11. …with load connected, with smaller load no issues….smaller load of about .5A. At full load, Ammeter shows an average draw of 3.5A, sometimes it oscillates between 3.4 to 3.8A. what surprises me is that the 338 never even warm up talk less of very hot, I thought it will heat up initially, so I mounted it on a heat sink. Surprises, it never warms up even, its cold there…

    • that's strange…at 3.5Amps the IC should get very warm….I am not sure if everything's correct in the circuit,
      try different values for R1 and check the amp consumption, if it varies accordingly then you can assume it to be OK.

  12. hello Swagatam
    first of all i have to thank you very much for your nice work.
    i have a 12v.5A router, wireless phone "panasonic" 6v/0.5A , an acid battery with 100 amp and a 20A charger for the battery…
    1.i want this ups but without charging myu battery "because i have a chagrger"
    2. could i put 7806 regulator on output to run my wireless phone ?
    3. i have a 12v/1.25A and laptop charger 19v/3.5A.. which one should i use ??

    and thank you again

    • Thank you Ahmad.
      I did not quite understand how you are planning to use the above circuit.
      Do you mean you want the 20A charger in place of the adapter shown in the above circuit??
      2. yes 7806 can be used at the output
      3. If you intend to use it as the input source, you can use a 14V adapter, if the battery is rated 12V, but none of this would be able to charge a 100AH battery.

    • i like to build this circuit but without charging feature because i want to charge the battery manually
      i mean.. i will use an adapter 12v as main current but i dont want it to charge the battery… i want it only to be the main current…
      when the adapter power fail… the battery will give the current instead of the adapter…
      when i notice that the battery need to be charged.. i will connect my 20amp charger manually..
      hope u get my idea
      thank you again

  13. thank you very much for your advice
    i did what you told me… but i got a problem
    since i use a 12v adapter..when i connect it with diode it decrease to 11.5v and since i use a car battery.. most of time it gives 13.5-12.5v so its always above the adapter.. so its always take the lead.. and the adapter only work when i disconnect the battery.. (the circuits do the opposite of its purpose" 🙁
    so should i put some 7812 for the battery?? or use a higher volt adapter like 14v?? but am afraid for the router because its 12v only

    thank u again

    • yes, a 7812 with the battery output would solve the problem instantly.
      If possible use an adapter which has a feature of fine-tuning the output through a preset.

      This would allow you to increase the adapter voltage slightly, may be to 13V for getting a perfect response.

  14. Hello Swagatam,

    just made this circuit with a 1ohm resistor to provide a lower (thus safer) current to my 4.5Ah battery. I used it with a 12V adapter, but forgot that a 12V battery needs about 13V to charge properly, whereas there's only 10.5V on battery terminals. Is the circuit built with 9V batteries in mind by any chance?

  15. sir, i want to eliminate the charging system.
    I just want to connect the wifi router with battery when the AC(Main) fails.
    I have use a relay for desired operation but when the AC(main) fails the device restarts and wifi connections are disconnected.

  16. sir i want to construct a 14v and 10A transformer but i do not know about wire diameter, number of turns and aria of bobbin. so kindly guide me or send me any link that is helpful to beginners.

  17. hi Swagatam,
    i have a laptop charger "19v, 4.2amp" i build a voltage regulator lm338 to use it as a 12v battery charger..with variant resistor.. and i adjust it to get 14.5v to charge the battery.. but the output current had never crossed 1.7 amp.. even if the battery is fully discharged.. why?? you told me that lm338 output could reach 5amp.. so what is the problem?? why cant i get at least 4 amp??
    another question.. when the battery is fully charged.. the output current from charger is near 0.2amp.. does that mean the charging is stopped?? or this current will harm my lead acid battery??
    and thank you very much

    • Hi Ahmed,

      Either the input charger is not supplying 4 amps to the IC LM338 or the IC LM338 is faulty or duplicate….a good IC and a good charger will definitely allow full 5amp to the load….of course only if the load would be consuming this much current.

      By the way what is the AH rating of the battery??

      When the battery is fully charged it will naturally stop accepting current from the charger but that doesn't mean it's not being charged, the input will need to be switched off in order to avoid damage to the battery in this situation.

    • what do you mean by AH rating??
      and about the charger .. i tried to apply the charger directly on battery "with 19v" it gives 4.2amp.. but when i use the regulator it's never cross 1.7
      thanx again

    • AH means ampere/hour it can be seen printed on your battery body

      if you apply 19V to a 12V the battery it will get damaged quickly, so it's never recommended even for a short duration.

      Your ICLM338 is faulty for sure, a good IC will allow the full amp to be delivered to the battery depending on how the battery is pulling….

      test the battery charging amp with a different 14V source that will give a clearer idea regarding the consumption.

    • for a 70AH battery LM338 will not work anyway, because the batt will need around 8 to 10amp charging current and LM338 can provide max 5amp, better to use a 14V 10amp smps and charge the battery with it directly for 8 hours.

  18. Hi Swagatam,
    I want to use an external 3.6VDC 700mAh Lithium Battery as backup instead of charging it from main supply & want to drive a 5W light rather than modem/router will this work?

    • Hi Dipto, do you mean you don't want the LM317 or the TIP122 stage and want to use only the diodes for the changeover?

      Yes the above circuit can be used for your application too….but a 5 watt light will be too big for the mentioned battery, will drain it quickly

  19. Hi Swagatam,
    Can I use 3ah battery instead of the 7.5ah one? The suggested 14v adapter is not widely available on our market? If 12v one is used, will it not work? And if 15v adapter is used, will the router run a risk of burning out?

  20. hi sir…..appreciate your work
    actually i have a 12v and 30amps(not sure) and i wanna use it to power my 12v 1amp modem ….what changes should i made for that in this schematic that exactly fulfil my requirements and do not damage my modem ,…..i am waiting for your kind suggestions

  21. dear sir , i followed all your instructions for the above mentioned circuit but unfortunately i could not found the Lm338 and 1N5402 instead there is 1N4007 available i want to know if there is any way of connecting my modem directly to the battery and is it possible to use a 1A fuse in line …..2ndly can i charge my 12v 30Ah battery with 12v 1A charger which is at the same time powering the modem also???? any help will be appreciated pls help…. i'll be waiting for your ans from now

    • I am sorry mudassir, the diodes are the heart of the circuit, with no diodes the circuit would become meaningless, so you must find 1N5402 or iN5408 diodes for you particular application. 1N4007 will not do

      12v/1amp will not charge a 12V/30ah battery properly…the adapter should be rated at 14V/3amp minimum.

    • hello Swagatam majumdar ….i found an adopter and there is 5-13v 700mA stated on it will it charge 12v 30Ah battery ….if yes then it will take too long to charge fully what you say?

    • yahooo…. i did it easily with a simple way… i connect a 1A fuse inline and connet it with 12v 30Ah battery directly and it worked fine for me now i can use it for 25-28 hours continously powering my dsl without any problem i used a 2way switch between battery and 12v dc adaptor …..

  22. sir i have made this circuit but i am not sure whether the battery is charging or not because i have also used an ammeter in series with battery junction and its shows no current flowing into the battery while mains is available

    • Zainey, what is your battery Ah rating? and what is your input current range and what resistor have you used in series with the battery?…what is the FSD range of the ammeter that you have used?…specify all these I'll try to troubleshoot it.

    • relay is not required here, the diodes do the changeover automatically….for relay operation the diode set up won't be required, it may be done simply by using a single relay with the mains adapter supply and wire its N/O, N/C contacts with the load and the battery

  23. hello sir i want to make wifi ups for 5v 1a and mean to say that when the ac power is on the router is on the ac power and that time the battery will also on charging and when the ac power is off or cut router is on on the battery power when the ac is on the router will run on the ac power sorry for bad english and i hope you will help me plzz

  24. sir i have a battery 6v 4.5ah/20hr and i want to charge plz help me what voltage i use to charge the 6v battery
    and i have a 12v charger can i use 12v charger to charge the 6v battery plzz help me plzz

    • Syed, you must use 7V as the input for the battery at the rate of 500mA current for your battery.

      No, you should not use 12V for charging a 6V battery, it might damage the battery permanently or start internal gasing of the cells

    • ye, 8V/700mA will do, you can use it, if possible put a 1N4007 diode in series with the positive of the charger… this will drop the voltage to 7.4V…

  25. Hello Brother, I have a 12v 7ah battery. And I want to use it for backing up a 12v 0.5Amp modem. I want to run this setup continuously. Thus iam worried about overcharging of the battery. which circuit is preferable in this situation. 1st pic or 2nd pic ? and I also have a 24v wall adaptor could I use it on this setup ?

    • Hello black bird, you can use the first circuit for charging your battery continuously without worrying, just make sure the zener diode is not rated above 14V. R1 can be selected arbitrarily, may be a 1 ohm resistor will be just enough…24V adapter can be used with the first circuit

    • Thanks For the Reply 🙂 . Any way Could you please list the exact values of items that are included in the circuit. And is these items are easily available ? especially the Transistor TIP122 and 14v Zener ? Thanks again 🙂

    • D1, and D2 cab be 1N5408 diodes, rest everything is given in the diagram itself, yes all these are standard components and should be easily available in the market.

    • Sorry Brother One More Doubt 🙂 , The adapter that is with me now is rated 24v 0.5A . So could it provide sufficient current to charge a 12v 7Ah battery ? Iam a newbie in electronics . So please help me ?

    • Sorry to disturb You again , Iam getting 24v in between Modem out terminals , when using a 24 v power supply. and about 16v in between battery out terminals ? My modem is rated about 12v .? what to do ?

    • I am sorry blackbird, I just overlooked the fact that the 24V would get directly connected with your modem….please do the following change in the design…just disconnect the anode of D1 and connect it directly with the emitter of the TIP122….and entirely sure that the zener diode is rated at 14V or slightly lower, you can try connecting a 1K preset parallel with the zener diode for correcting the output voltage to the required precise levels

  26. hello Swagatam, I have Lead Acid battery with 6v 6Ah, laptop charger with 20V, 3.25mA. i want to use these thing to operate modem which operates on 12V, 800mA. Please help me to find the solution of this problem.

    • hello Athar, for operating a 12V modem with a 6v you'll require a boost converter circuit which could be quite difficult if you are a newcomer in the field of electronics.

  27. HI Swagatam nice explanaations and ideas, i need help on similar need, here are what i have at hand
    1.12 V 35 Amps exide battery
    2.7V/7AH Batery
    312 SMPS charger i am using to charge the exide battery
    4.12V/1 Amp Adapter for modem
    I wanted to have two circuits
    1.To use with Exide battery -UPS circuit ,Charging with existing SMPS charger, and powering the Modem on power fail switch to battery power

    2.To use with12V/7AH batter-UPS circuit charging the 12v 7Ah and powering the Modem on power fail switch to battery power
    i did a stupid thing connecting 12 V 35 amps Exide battery directly to modem thinking that it just 12V and my modem is in't working now, i just bought new modem and seek your help. Yes i can assemble circuits on experimental boards
    Kindly need your help, regards

    • Hi Chris, Thanks for posting your question!

      The circuits explained in the above article are perfectly suited for fulfilling your requirements.

      You can try the second circuit which is more sophisticated than the first one for both the needs..

      A 12V adapter might not charge a 12V battery…the adapter output needs to be at least 14V to implement this.

      If your modem is rated to operate at 12V, then I think you have done nothing stupid by connecting it to the 12V/35AH battery. Here the current is not important as long as the voltages are compatible…so it's quite OK to operate your 12V modem with any DC 12V source, even if it may be rated 1000 amp or 100000 amps

  28. Thanks for the reply, with the same idea that it 12 V battery I connected, does polarity make any difference in DC connections probably I did not take care of polarity.
    In that case, can i connect as following-> 12V SMPS charger to Battery terminals and From battery terminals to Modem Just like an on line UPS? do I have to incorporate any safety components from Terminals to Modem?
    ( they may calling it 12 V SMPS, but probably it is more than 12V it is actually used in UPS/Inverters for charging it is perfectly charging the exide battery)

    • yes, maintaining a correct polarity is definitely critical, a wrong polarity can instantly damage a particular device unless it may be protected with a diode.

      It's possible to connect the units the way you have suggested and no safety measures are essential except for a battery over charge cut off circuit…or if you want to avoid this you can use a13.5V input instead of a 14.3V, which will never allow the battery to get 100% charged and therefore can be used without the over charger protection feature.

      it would be advisable to measure the SMPS output volatge and make sure it's delivering above 13.5V

    • SMPS when not connected 13.70 When SMPS charging it is showing 13.35 , battery voltage is 12.80 when SMPS not connected ,Should we have any protection before the modem to limit it to 12 Volts/ I mean, is it necessary? if so what should we put there .

    • You can use two more diodes in series, meaning put two more diodes in series with D1, this will rectify the issue and drop around 1.2V from the adapter output for the modem

  29. Hi sir
    Just a simple question:
    What would happens if I replace battery with another 12 volt power supply ??
    Will it work as a redundant or standby power supply ??
    Thanks for your answer in advanced

    • Hi Shayan,

      sorry I could not understand the logic behind this…of course it would work like a battery would do…but what's the point in using two mains operated power supplies??

  30. Thank for your reply,
    The point is clear,there are many products which has 2 input for different power supply,for example one for noraml mains,one for generator or other mains,like servers,routers,and some critical equipment,we call it redundant power supplies

    I have an equipment wh consumes 3 amper in 12 volt dc,if I use 2 transfer with 12 volt,3 amp output which one take responsibility and which one is waiting for first loss?? Both are same on voltage and amperage,I don,t want them to work together,I want second power supply to be standby

    Thank you
    And if it's possible tell us about model of diode and other components for 12 volt 3 amper

    • OK understood, the above circuit can be used with two power supplies, but one of the supplies will need to be slightly higher than the other for ensuring that the diodes do not conduct together or randomly…the main power supply could be made slightly higher than the standby supply, may be by a volt, amperage won't be an issue.

      or in case the both the supplies are equal, the standby supply can have two diodes in series while the main supply may be provided with a single diode…. this will take care of the alternate switching of the diodes.

      for 3amp use 6A4 diodes

  31. Sir can you please make me circuit for 9v and 0.6 amps…and there is a POE also i want that also to backup …its is rated as 12V and 1amp also can do the job or 0.7 or 0.8 amp also…plz post ASAP sir i want to build it

    • Asif, you can use the same circuit as presented in the above article.

      just add 4 more diodes in series with the D1, D2 outputs and use it for the 9V load while the D1/D2 terminals can be used for the POE

    • D1, D2 junction can be used for your 12V load…and connect three mote diodes in series at the junction of D1/D2, and the end of this four diodes series can be used for powering the 9V load.

      D2 |————–>I—–>I——>I——->I——– = 9V

    • …sorry the above diagram did not publish correctly….but you can get the idea…D1, D2 ends are joined and connected with the 4 diode chain….the left end of this chain gives 12V, and the right end gives the 9V

  32. sir give me a circut diagrame.i have a bike battry 12v and dsl modem with chager.give me diagrame in which i connet these things.some qulity must b no need to disconncet battry when light in on and overcharge protection and off during light off

  33. Hi again sir ,

    i need to do the same with two 24 volt AC 5 Ampere adapter , i mean how can i make redundant power supply for AC adapters ?? and which diode or which technique should i use ?

    many thanks Swagatam

  34. Thanks for the nice tutorial of yours Mr. Majumdar!

    Here what I want to do is a bit different. I Have a UPS with 12v, 9AH (cycle use: 14.4 – 15.0v) battery inside and NO LOAD CUT OFF feature added which means it will charge the battery even if it is off but connected to the main outlet.

    And at the same time I have a DSLR router with 9v, 0.85A adapter. Now I want to connect the router to the battery directly without the need of adapter of course.

    What sort of circuit do you recommend for this purpose. Initially I want the router to be feed from UPS coming connections to the battery and when the main power fails the battery should feed the router?

    Thanks in advance

    • Thanks for the reply.

      One thing to make sure as the alternative power or 12V DC from UPS main is connected to battery terminals, so I should have the UPS mains (alternative power) and battery terminals (12V adapter) connected together, right? At this stage it will charge the battery and feed the router at the same time.

      And the 2nd thing that I need a 9v, 0.85A output, but the mentioned circuit is for 12v 3A I think. How should I adjust that?

    • I was a little confused here….so if that is the situation, then you won't need anything, rather you can simply connect your router directly across the battery terminal via a 7809 IC. just make sure the IC is fitted with sufficiently large heatsink.

  35. Hi there! Thank you for the schematic! For the second circuit i have a 2Ah (12v) battery. Im using a 12v 1amp charger. Witch is the value of R1? R1 = 1.25/1A = 1 Ohm?

    • Hi, if it's a lead acid battery then the charging current should be restricted to 2/10 = 200mA

      so R1 should be 1.25/.2 = 6.25 ohms

      if it's a Li-ion batt then your calculation results will work.

      the first circuit is more efficient in terms of voltage control so I recommend the first circuit

    • you can try adding an LED across R1 with a series 50 ohm resistor, and check the response, as long as it stays illuminated you can assume the battery to be getting charged.

  36. Dear Swagatam,

    I want to design a ups circuit with the following requirements:

    – Power supply AC/DC: 35W, 15VDC (
    – Battery: 12VDC
    – Operation: While the AC is OK, the battery will be charged (WITHOUT OVERCHARGING) and the output will be the power supply 15VDC. When the AC is NOT OK, the output will be the battery 12VDC.

    I think that a simple way to detect if the AC is OK or not could be to read the output voltage. If it's 15VDC i can consider that the AC is OK and if it's 12VDC it's not OK.

    To sum up: I need a circuit to charge the battery without overcharging and to provide me an output with 15VDC when AC is OK and 12VDC when AC is not OK.

    I have seen your experience with UPS, could you help me with that?

    Lots of thanks,

    • Dear Eudald,

      You can effectively use the first circuit shown in the above article, just eliminate D1 so that the full 15V is able to reach the output while mains is present. rest everything can be as is.

  37. Thanks for uploading your schematic circuit ,! I have some questions here.Could you please reply me soon ?.
    1.As far as i know ,the voltage for battery charging is about 13.6v -> ~ 15v (depending on your battery type).Your first circuit apply 12v adaptor ,does it work ?
    2.When the battery is full ,it is about 13.5~13.7 .The battery voltage is dominant ,leads it works continuously (at that time the circuit won't use adapter supply ,it will use the battery ).

    • For a 12V batt the input is supposed to b e 14.4V, the diagram shows a 12V adapter because we don't get 14.4V adapter, so readers are advised to handle such situation with discretion and logically.
      The batt voltage can never surpass the adapter voltage, therefore the adapter voltage will be always the dominant one as long as the mains is available.

  38. Sir Great Work but I some confusion there,I have 12v Battery 7.5aH & 1Ampere consuming Modem. As LM317 Regulator only gives 1.5ampere, so will this 1.5ampere regulator run modem & also charge battery efficiently. Another thing is that I got L78012CV Regulator, so can I use this regulator instead of LM317/TIP122 without changing something in circuit. Thanks in advance Sir

  39. Sir can I use a Transformer with bridge connected instead of 12v adapter and can I also just skip voltage regulator and directly connect through R1/D1 & which R1 resistor should I choose if I need 2.5~3.0ampere current for 12v battery. Thanks for your help & It is humble request to you please reply this message.

    • Adnan, yes you can do it in that way, but please note the battery charging section is crude therefore it's better to use a reduced charging rate.

      you can use 1/20th of the battery AH as the charging rate.

      Use Ohms law for R1, that is R = V/I, where I is the charging rate as described above, V is the supply voltage

  40. Hello, Swagatam.

    I want to power my router which requires 9 volt 1 amp but i have two 6 volt 4.5 Ah Lead Acid Battery. So, i want to use two 6 V batteries to power my router. Is it possible? I would be very thankful if you could help me.

    • Rusan, you did not ask me about the circuit selection therefore I did not suggest about it.

      both the circuits are correct and will work.

      you can use any of those as per your convenience..

      12V adapter will not charge 12V battery…so it must be set to 14.4V adapter

  41. Thanks a lot for nice and great information.
    Sir, I just want to know that what phenomena in the first circuit is to protect overcharging the battery, that is less current, voltage or anything else.
    Secondly if I want to charge my 9Ah AGM battery with 2 Amps for quicker charging what changes should I made in first cct, what will be the value of R1 and across it what will be the value of resister in series of Led to indicate charging.
    Thanks again.

    • Thanks Alis,
      in the first circuit, the transistor is wired in the emitter follower mode in which the transistor is simply not allowed to conduct or is "choked" as soon as the emitter voltage reaches the base voltage level or at a difference of 0.6V (close to it.)

      therefore assuming if the base zener voltage is 14.6V, then as soon the battery voltage reaches 14V, the transistor is unable to conduct any further, unless the battery drops to below 13.8V

      for 9V battery, you can use a 11V zener diode

    • R1 can be calculated by using ohm's law
      R = V/I

      9/0.5 = 18 ohms
      watt = 18 x I^2 = 4.5 watts or 5 watts

      if an LEd is connected in parallel to R1, then a 100 ohm resistor will be enough to safeguard it

  42. Dear Swagatam.
    I tried to make the above circuit, but I have come accross a certain issue.
    The amperage on one of the connection is very low and fluctuating.
    I am new to electronics, so could you please shed some light on this matter.
    The line connected to the laptop has the problem. The one going to the router is just fine.
    Thank you for your time

  43. Dear Swagatam.
    I tried to make the circuit according to the diagram, but i got an issue.
    The line going to the laptop has very low and fluctuating amperage although the voltage is fine. I am actually trying to power two routers and it works flawlessly on one router, but it only works with the mains connected in the second router. Once the mains is disconnected and battery is connected, the amps is too low and fluctuating. What could be the reason for this? Please give feedback

    • Dear Kailash,

      check your adapter specifications or change with a higher current adapter, I think it may be low in current and therefore not able to charge the external battery and the laptop together.

    • Dear Swagatam,
      Thank you for your prompt response.
      I bought the adapter just for this project according to the specs you had given on one of the comments.
      It is a 14 volts adapter with 2.37 amps current. I could not find the 3 amps one in the market so I got the 2.37 amps one.
      I cannot afford to buy another adapter at this moment, so is there anything that could be done for instance by adding transistors or any other parts in the same configuration.
      I would be very grateful if you could provide the solution.
      Thank you once again.

    • Dear Kailash, please try the new adapter and see how it performs.

      for a better response you can try connecting a 2200uF/25V cap across the D1/D2 junction and ground.

      • Dear Swagatam,
        I think that there has been some misunderstanding regarding my situation.
        The circiut works fine when the adapter is connected to the main line of 220 volts. Once I switch the main line off and the circuit is running on battery, It can power one of the routers, but the other fluctuates. I do not think that this is the issue with the adapter. I might have done some mistake with circuit itself. I am a bit confused with the final part of the circuit. From the d2 and d1 junction it goes to the +ve of the modem. What about the -ve of the modem?I have connected the negative of the adapter to the negative of the battery using a wire from which I have cut two areas which connect to the -ve of the modem and to the ground. Is this correct? I think that this could be the issue. Please shed some light on this.

        • Dear Kailash. yes I misunderstood and thought that the issue was when the mains was ON.

          The negative line shown with the earthing sign should be connected in common to all the negatives of the respective devices….

          If the voltage is not dropping then the current fluctuations can be ignored…please measure the voltages across the specific routers and confirm whether it's constant or not.

    • Dear Kailash,

      It's easy, solder the long lead of the capacitor with the D1/D2 junction, and the smaller lead with the bottom negative line or the earth line

  44. Thanks sir for your kind reply.
    Sir I got the idea of emitter follower cct for transistor but I forgot to mention in previous question that my battery is 12 volt.
    One thing more I want to ask that, does the formula R= 1.25/charging current apply on the second circuit only and Ohm's law apply on the first curcuit for the the value of R1. If yes then for the 1st cct, is the value of R1=12/2 = 6 Ohms or 14/2= 7 Ohms for 2 Amps of charging current. And what will be the wattage rating of other componants like zener diod for this charging current.

    • You got everything right Alis!

      the wattage can be calculated with the following formula

      P = R x I^2 = 6 x 2×2 = 6 x 4 = 24 watts

      By the way the current is supposed to be 1/10th of the battery AH…I am not sure what's 2 amp in your case.

  45. Not a electrical student. Have a wifi router. Adaptor says power output 18v/1a. Couldn't get a UPS for this router in market. Only 12v is available. Can you help me with this. Need to make my own ups.

    • you can buy a 0-12V transformer and connect a diode bridge rectifier to its output along with a filter capacitor, this will provide you an output of around 19V which can be used for driving your router.

  46. Hello sir,
    I need you help. This is what i m looking for. My router adapter rating is 9V 600mA. And i want to use 12V 7AH battery. which circuit will be batter in my case? How much backup i will get from this battery.

    Sorry for my english

    • Hello Rahul,

      sorry, none of the circuits will work because a 9V source can never charge a 12V battery….so you will have to procure a 14V adapter, or build a 14V adapter using a 0-12/1amp transformer along with a bridge rectifier/capacitor output network, for the application

  47. Hi there I was wondering if I'm charging the battery with an outside source charger I just need to add a diode to the positive line of the battery, so I don't get a feedback to the battery is that correct?

  48. good day sir

    i am using normal inverter at home. the modem also connected to the normal power supply at home.when a power failure ( mains ) happens the inverter take some micro secs to switch over to battery and viceversa . so in that period the modem restarts and will take time to function . i need a backup for modem to avoid this operation, modem using 9v dc supply.( i installed a 9v dc batery to overcome this in parallel with power supply but it didnt work out still modem restart during this small changeover time )

    can u help me to sort it out . (i dont want to install a separate full ups only for modem ).



    • good day john, a modem will not reset if the changeover is within microseconds…it will happen only if the delay lasts over 500ms approximately.

      you can probably try solving the issue by connecting a high value filter capacitor across the supply terminals of the modem. it should be at least a 6800uF/25V rated capacitor or above.

  49. HI, Not an electrical student but can understand circuits to an extent. My Dlink router is 12V 1.5A listed. I have a power backup for my apartment but it takes 2-3 minutes to resume the power and in calls, this is very annoying to connect again. Can you recommend a circuit that can be used with AA rechargeable batteries? Like I mentioned, I would need backup only for max 5 mins. I would like to assemble myself so appreciate your detailed response.

    • yes I understood your requirement, you can still use the above concepts, for the battery you can use 8 rechargeable AAA cells in series….rest can be as is.

      the first design looks more appropriate as it will not allow the batt to overcharge once the emitter side limit is correctly set.

      the circuit (diodes) will automatically disconnect the battery as soon as the power resumes from your apartment backup.

    • Thanks for your prompt response. Are you recommending the one with TIP 122 circuit? Will the ratings for diode and resistor remains what you have recommended elsewhere?

    • yes the first design using TIP122, the base resistor can be increased to 1K that's not very crucial, but the zener value should be selected such that the voltage at emitter is slightly higher than the battery voltage that is around 13.5V, rest can be as given in the design

      • I have found an old laptop charger which I would like to use. Its O/p is 19.75V 3.5A. Can I use your second circuit using LM317?

        1. I see the direct o/p in your diagram from 12v to 12 v but that will not be case for me. How do I step it down? Can I use LM7812 there for reducing the o/p from 19.5v to 12v? What will be my current in that case?

        2. While going through LM317 circuit, what should be value of R1? Can I use LM 7814 for charging the battery?

        My router is rated at 12v, 1.5A.

        • 1) yes you can use a 7812, the current will be limited to 1 amp.
          2) you can use 7814 in conjunction with the LM317 for charging the battery.
          3) R1 will be = 1.25 / charging current limit

          • Thanks for 1.5A, I was thinking of LM7912. Will that be ok as it outputs 1.5A?

            If using 7814 instead of LM317, the charging current will be 1A. Will that mean that I need R1 as 1.25 Ohm?

          • you can use 7912.

            the charging current is supposed to be extremely low, may be around 1/20 of the battery AH if it is an SMF type of batt.

            therefore R will need to be calculated as per this charging current rate

  50. I am still confused. If you recall, I will be using chargeable batteries (I am planning to use 3.7 V 18650*4) in series as I need just 2-3 mins of backup . If I use LM7815 (7814 not available) in place of LM317, I will get 15V charging voltage and 1A fixed. How can I reduce the current here for batteries charge?

    • I think you must use 3 cells in series and not 4…so the full charge level becomes 4.2 x 3 = 12.6V.
      even if you need 3,4 min backup the battery would be continuously charged by the system and therefore it would need some kind of limiter, the current actually won’t matter if the voltage is kept slightly below 12.6V… to implement this you can configure the LM317 as a voltage regulator instead of current limiter, and fine tune the output to may be around 12.3V, 7815 can be totally avoided

  51. Having 3 cells would actually give me less than 12v (3.7V * 3 = 11.1v) that’s why I was thinking for 4. Will that be an issue? Also, how will the charging be limited else batteries will be ruined in no time on continuous charging

    • 11.1V won’t be an issue for your modem…3 cells is the right number that you must use
      as I mentioned in the my previous comment if the 4.2V per cell is prevented then an auto cut off won’t be required, because the cells will never be able to reach their full charge levels and therefore be safe.

  52. HI Sir, my router requiere 12v 0.6A I want to plug it straight to car cigarette socket, do I need any protection or just an adequat fuse. thank you.

  53. Hi Swagatam,
    I have 1 switch [12V, 2A] & 1 router [12V, .5A], both of them needs a backup from 12V 7AH battery. So there will be 2 o/p from battery. I have following queries..
    1) Can I use D1 & D2 as 1N4007, so that it can limit to 12V, 1Amp output of the circuit and can be input for switch?
    2) How can I restrict the current to .5A [12V .5A] in another output, as an input of the router?


      • Thanks Swag.
        I need some more clarifications about the same. As router needs “.5A” current, I can use LM317 to restrict the current for that device input. For switch, hope I can directly connect through 1N5408 diode. Or in both scenario I should use LM317?

        In precision current limiter, to calculate R1, Vref used as 1.25V. But here my Battery is of 12V & device input voltage also 12V, so Vref is practically 0. So how should I define Vref to calculate R1?

        • Hi Sujay,

          actually current control is not required for any of the devices because if the voltage specs for the devices match with the battery voltage, current would be immaterial. You can safely connect the devices directly with the battery.

          as for the 1.25V ref, I don’t think it is dependent on the input supply, this reference will be available as long as the input supply is well over the 1.25V value

Leave a Comment