Author Options:

Switch to battery power when mains power is lost ? Answered

Hey Guys & Girls

I need a circuit, if anyone can help me please.....

I have a 5.5v wall charger connected to a battery that charges the battery. This battery is used to power led's that i use when we have power outages. I would like to have a circuit where the battery is constantly plugged into the charger with something to divert the power or switch it off when the battery is fully charged, the other part of the circuit needs to "sense" when the mains power goes out and then automatically switch the led's on to run off of the battery.

anyone have a circuit for this lying around?

thanks in advance for any help :)


You are welcome
Since you have mentioned about your battery i thought to worth mentioning this also. Usually the type of cell with the protection board aka protected cells are just to make things extra safe in case any thing goes wrong. For most of the hobby projects people mostly rely on these buildin boards without a proper protection which only cost an extra dollar or so. These guys have an excuse that their projects are not full time plugged in for charging.
Your case is different since you are going to plugin full time.leaving everything on the build in borad is highly risky and these board could fail in lots of situation and is actually for a fancy and also we dont know what is its condition like in first place. Some manufatures also claims it has a buildin board but actually it don't. So definitely go for the additional protection for over discharge coz lipo cells once exploded could take down a house easily.

thanks, i will definitely incorporate an additional protection circuit. lol, the emergency lights won't be of much use under the bright light of the house burning down :o
safety first, right ;)
i'll put something on breadboard and post it here as soon as i have the time, so you can have a look before i think of even warming up the solder iron.

Sounds great. looking forward to see the circuit on the breadboard. For the relay part you could use a 5 v relay and I forgot to add a fly back diode (reverse parallel to pins A & B) in the previous schematic which I have attached. The diode is very important to avoid voltage spikes at the relay solenoid. I have corrected it in this new schematic which I have attached which this post.


There are electronics kits available to build your own battery voltage monitor.
Dirt simple stuff: The voltage is sensed and once too low (or too high for some modules) a relay is activated to disconnect and protect the battery.
You could use the same for both of your problems:
One monitor is set to just under your charging voltage - once mains power is gone it will be lower and the relay disconnects the charger and turns on the lights...
A second could be used between lights and battery to make sure it won't discharge too much.

thanks @ Downunder35m
A completely different approach, but just as interesting......i'll have to start experimenting.
Thank you very much for your response.

Thank you very much for the response adhith94, This along with the research (little as it is, due to time constraints) should take me to where i want to be. I have lipo and li ion batteries charging off of the same charger at different times, but the batteries themselves have over and under charge protection "built in" in the form of circuit boards attached to them. I don't need a huge light source either.....2 or 3 high bright led's will do the job just fine. We have a lot of power cuts in my area that last anything from 10min to 3hours at a time.....so all i need is something that i can place in strategic places to make things a bit easier for myself and the family when the power conks out.

Again Thanks a bunch. i think the circuit you provided will work just fine.

Hello GhengisKhan1981
Could you please give some info on the battery that you are using like is its Li ion or Lipo battery, is it a single cell or a group of cells together (battery pack), what kind of charging board are you using to charge it. with these info it would be easier to help you.
lets split you question into two to make explanation easy
my explanation is kind of lengthy to avoid confusion hope you don't mind
1) diverting the power or switch it off when the battery is fully charged
coming to the topic, normally the charging module for the battery should have some basic features like short circuit protection, under charge over charge protection etc. For your purpose the over charge protection is enough because the board is capable of stopping the charging process once the battery is fully charged but the problem is that you said it would be always plugged in (assuming full day) and this is not good for the charging boards since they are only meant to prevent overcharging and we can't fully push and rely these board to test its limits. If your are sure that you could switch off the wall charger around 1 or 2 hours after fully charged then its safe to move on with these charging board itself. If not, then you should use some additional circuit to prevent over charging. There are no of circuits for it that you could build cheaply at home itself with little amount of time. You could google for auto turn off battery charger to get an idea. Most of them are based on LM317 IC and its very simple however i never tested with these circuits so I cant guarantee the safety or the working of these circuit. A quick search on the net got my attention to this site,have a look

2)automatically switch the led's on to run off of the battery according to the main power
This can be easily achieved using relays. We have two kinds of them actually, mechanical and solid state relays. solid state refers to transistors which is very small and compact but before using it we should do some load calculation and thus the current flow through the transistor or else it could get fried. So I think we could set aside the calculations and move on to mechanical relays.
we don't need any calculations for it to fit your job. If you are new to relay do let me know, I'm assuming that you know it. I have made a relay circuit for your project have a look
Hope this post could help you, Good luck with your project