Pages: [1]   Go Down
Author Topic: Automatic switching between two power sources  (Read 1455 times)
0 Members and 1 Guest are viewing this topic.
Brisbane, Australia
Offline Offline
Edison Member
*
Karma: 33
Posts: 1120
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

Hi

I have a project which gets its power from a car battery or a 12V wall wart.  What I'd like to do is have both of these wired in, but when the mains power is present, have the battery no longer supplying.  The battery and the mains supply are going to be kept independent, so no charging occurs, and I'd like to make it automatic so the battery can kick in almost as a UPS.

Is this as simple as using a P channel MOSFET with the wall-wart output into the gate to turn off the battery supply, and adding a diode at both supplies so neither can feed power into the other?  Or are there other issues I need consider?  Presumably since a MOSFET is switched by voltage I can put a large value resistor before the gate to ensure low power consumption for this switching?  Also, the 12V is split to run some devices directly, but a microcontroller and supporting ICs via a switched mode 12-5V DC-DC converter - is there any issue with one of those interfering with this concept?

Thanks in advance for your advice,
Geoff
Logged

"There is no problem so bad you can't make it worse"
- retired astronaut Chris Hadfield

Illinois, USA
Offline Offline
Full Member
***
Karma: 0
Posts: 124
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

It sounds like you have already ruled out just diode ORing them together. A relay, powered by the wall wart would be easiest. An opto-isolator could control a FET, or maybe even switch the battery off, if the current isn't too high. A protected high side load switch would be easy to control with the wall wart voltage, something like this (http://www.fairchildsemi.com/ds/FD/FDC6324L.pdf) though many others make similar parts.
Logged

Brisbane, Australia
Offline Offline
Edison Member
*
Karma: 33
Posts: 1120
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

Hi and thanks for the advice. That's certainly given me something to think about - I'd not considered the car battery might be too powerful to switch completely off with the FET.
It sounds like you have already ruled out just diode ORing them together.
I was just looking for a way to ensure the battery didn't contribute at all when it doesn't need to.  The wall wart should always take precedence.  Am I right in thinking the Diode OR would just share the load between the two?
Logged

"There is no problem so bad you can't make it worse"
- retired astronaut Chris Hadfield

Offline Offline
Edison Member
*
Karma: 3
Posts: 1001
Arduino rocks
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

I have a project which gets its power from a car battery or a 12V wall wart.  What I'd like to do is have both of these wired in, but when the mains power is present, have the battery no longer supplying.  The battery and the mains supply are going to be kept independent, so no charging occurs, and I'd like to make it automatic so the battery can kick in almost as a UPS.
The common solution to this challenge is to use the mains regulated DC supply as a battery charger. With mains present, the DC supply will maintain/charge the battery and power connected peripherals at the same time. You need to regulate the DC supply output voltage to match the battery maintenance-charge level (about 13.7V). At this level, you can leave it connected/powered at all times. Switchover is instant as this is a hot standby connection.
Logged

South Texas
Offline Offline
Edison Member
*
Karma: 8
Posts: 1024
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

Unless both devices are tied to the power connection you will have a problem if the mains power fails. A relay will have some switching time with no power output.

You could use a power supply with a higher voltage than the battery, both the battery and the power supply have their own diode feeding the Arduino. As long as the mains are good the higher voltage will block the current from the battery. When the mains fail the battery will have a higher voltage and provide power through its diode.

How are you going to charge the battery?

Easier to have power supply charge the battery to a proper voltage and if the power supply/charger fails you would run off only the battery.
Logged

Brisbane, Australia
Offline Offline
Edison Member
*
Karma: 33
Posts: 1120
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

Thanks so much for putting some brain-cycles to this.  Like most things tried for the first time there are always aspects those with more experience will think of.  In this case the switchover time was something I completely hadn't thought of.
Quote
How are you going to charge the battery?
In this case the battery and taking it on tour is actually a bit of an afterthought - I have a donor 12V wall wart already grafted in, so at the minute it's tied to the house and was going to be a semi-permanent.  This is a bench worklight, using 4.8m of LED strip-lighting, cut to 24cm strips with brightness controlled by switching different patterns of them through TPIC6B595 shift registers via an iR remote controlled by an ATtiny85. 

There are a few places where it could be used if I added battery power though.  Remotely, the battery would be the primary source of power and it's charged by the vehicle, or a solar panel, or on a boat by the outboard.  At home where mains is available there really isn't a need for a battery.  In contrast, remotely some occasions both are present, for example for the hours when a generator is running at a campsite, or mains power is available to the site.

I think a version 2.0 designed from the start with mains charging the battery is probably the go.

This community is awesome as ever, thanks !
Geoff
Logged

"There is no problem so bad you can't make it worse"
- retired astronaut Chris Hadfield

United Kingdom
Offline Offline
Tesla Member
***
Karma: 223
Posts: 6593
Hofstadter's Law: It always takes longer than you expect, even when you take into account Hofstadter's Law.
View Profile
WWW
 Bigger Bigger  Smaller Smaller  Reset Reset

Easiest way is to use diode OR'ing and to arrange that the wall wart as a higher output voltage than the battery, say 15v instead of 12v. That will ensure that the wall wart supplies the power as long as it has a mains supply.

In fact, if the wall wart is unregulated, then you don't need a diode on the output of the wall wart, just one on the battery output. If in addition the load is well below the rated current of the wall wart, then you will probably find that the wall wart produces a bit more than its nominal output. This, together with the diode in series with the car battery, means that a 12v wall wart will probably work just fine in this arrangement.
« Last Edit: April 22, 2012, 11:58:39 am by dc42 » Logged

Formal verification of safety-critical software, software development, and electronic design and prototyping. See http://www.eschertech.com. Please do not ask for unpaid help via PM, use the forum.

Pages: [1]   Go Up
Jump to: