# Switching Between Two Voltage Supplies

I have been trying to work out a circuit something like the following: simulate this circuit – Schematic created using CircuitLab

I want VOUT to be 3V when the switch is open and 5V when the switch is closed. The simulation seems to give me what I want when the switch is open, but not when it's closed. What am I doing wrong? Is there a better way to do this? I was avoiding a common cathode diode pair to avoid the forward voltage drop.

• Are you limited in the switch you are using? a single pole dual throw switch would easily swap between the two supplies Apr 21, 2013 at 5:28
• @Gorloth... the switch exists for the purposes of simulation only. It's meant to simulate the attaching and detatching of 5V power from the circuit. I don't want a mechanical switch ultimately. Apr 21, 2013 at 5:40
• what exactly is it doing when the switch is closed? what's the voltage at vout? Apr 21, 2013 at 5:50
• @Gorloth when the switch is closed VOUT should be 5V, when the switch is open VOUT should be 3V. Apr 21, 2013 at 7:04
• YOu say the desired behaviour of 3v or 5v at vout, but you also say when simulated it does not work when the switch is closed, but you specify how it's not working, if you are getting a vout that is ~3.6v then sounds liek a body diode issue that Brian mentions in his answer below Apr 21, 2013 at 19:06

I came up with the following circuit that does what you ask: 5 volts from the "SWITCH" source will turn on M1 and M2, connecting the 3 volt rail to the load, and pulling current out of the right hand transistor of the differential pair Q3 and Q4. This turns off Q2 and shuts down the 5 volt rail. When Q1 turns off by applying 0 volts to "SWITCH", Q4 is biased on by the voltage divider comprised of R7 and R8, which turns on Q2 and the 5 volt rail. R2 then pulls up the gates of M2 and M1, shutting the 3 volt rail off. The arrangement of M1 and M2 prevents conduction from the 5 volt rail into the 3 volt rail when the 5 volt rail is connected.

In a real circuit there should probably be stopper resistors on the MOSFET gates.

Another way, in response to the "too many components" criticism: If you don't want to use discretes, you can do it with a cross-coupled dual comparator. One IC and 4 resistors, plus the switches.

• that is a crapload of components... Apr 22, 2013 at 14:43
• circuit in the update is more pallatable :) Apr 24, 2013 at 19:29

Measure currents around the 3V MOSFET M2 when the switch is closed. I have a feeling that 5V on its drain is forward biassing the body diode and limiting VOUT to 3.6V (or some value dictated by M6's ON resistance. You may need a pair of MOSFETs there, in series, (usually with their sources connected together) to provide isolation in both directions.

(Edit: add schematic) Remember this is speculation, I haven't tested it : but the basic idea is this simulate this circuit – Schematic created using CircuitLab

When on, (SW4 open) both transistors M2,M7 conduct.

When off, both transistors are off; their body diodes conduct in opposite directions, so neither conducts.

But I would welcome correction or improvements to the design

• could you show what you're describing in a schematic? Apr 21, 2013 at 19:18
• I get VOUT = 1.372V in your circuit when SW4 is open.... Apr 21, 2013 at 19:48
• Count my circuit as a fail then. But you still haven't described what happens in the original circuit when SW4 is closed. Apr 21, 2013 at 20:00
• SW4 closed => VOUT = 4.375V, SW4 open => VOUT = 1.987V Apr 22, 2013 at 14:50