Electronic – Switching between two power sources

dualmosfetpower supplyswitches

I am designing a circuit, which can use either 5V from USB, or some higher voltage (7-12V) from a battery. If both power sources are connected at the same time, I want some kind of electrical switch, that would disconnect the battery and power the circuit just from the 5V USB. But the circuit still has to work, when only one of the sources is present. I tried to design a switch using two mosfets, but I was not able to figure out a working circuit.

Can such a circuit be build by only using two mosfets? Also, do not worry about the voltage regulation, that is taken care of.

Best Answer

There are dedicated chips that you can get which will do this but doing it with discrete parts would look something like this:


simulate this circuit – Schematic created using CircuitLab

All part numbers are the defaults rather than recommended parts.

Without the USB disconnected R1 ensures M3 is off. R5 turns M2 off and R2 turns M1 on. The end result is that the output is connected to the battery.

With USB powered M3 turns on. This pulls the gate of M2 down turning it on which in turn pulls the gate of M1 high and turns it off. Power then flows through D1 (which should be a schottky diode) and to the output.

D1 also protects the USB from over voltage while the voltage on C1 drops to USB levels. Note, if the battery is under the USB voltage then the body diode of M1 will feed power into the battery. This is outside of your stated operating range but if it is a possibility add a diode to prevent it.

C1 should be sufficiently large to prevent the output voltage dipping too far during switch over.

And now I wait for everyone else to point out the problems with this circuit (or point out how to do it with half the parts) since I'm sure I've overlooked something...