# P channel mosfet as a switch different setups for USB and battery switching

Recently I came across the below 2 examples of using a p-mosfet as a switch. Running a simulation leads to the following observations.

Circuit 1

Circuit 2

• Used this design in some previous circuits
• OUTPUT2 is 4.379

The output needs to be 5v is 5v is available. If 5v is disconnected, the output has the be the voltage of the battery that is connected.

Could someone please explain the difference in both the circuits. simulate this circuit – Schematic created using CircuitLab

• Circuit 1 won't give you 4.951V at the output if you put any more of a load than a voltmeter on it ... – brhans Oct 30 '17 at 17:43
• Added a 0.750A load. Now the output is the same. – user2967920 Oct 30 '17 at 18:12
• Circuit 2 will overload your USB power supply when the battery voltage is less than about 3.6V. That's because M2 is the wrong way around so its body diode will conduct when the output voltage of the circuit is higher than the battery voltage plus a diode drop. It also lacks a pull-down resistor on M2's gate. So only circuit 1 works properly. I'll try to come up with a circuit that gives the full 5V on its output. – Jonathan S. Oct 30 '17 at 18:33

## 2 Answers

This circuit should give the full 5V on its output when the 5V power supply is connected at the cost of about 1mA idle supply current when it's operating on battery. simulate this circuit – Schematic created using CircuitLab

The circuit compares the voltage of the power supply to that of the battery. If the power supply has a higher voltage than the battery, it switches on M1, otherwise it switches on M2.

Assuming you made a mistake in the 2nd circuit with how the mosfet is facing, there is no real difference except for R1. It is a pull down to make sure that the mosfet turns on when 5V isn't there. At 100 ohms it's pretty big, 50 mA load. A 1k would work just fine.

The c1 and r2 are there for smoothing. Though 6.6 ohms is incredibly large load too.

As for the voltage drop, that is because of the diode you are using. Common Silicon diodes have a Forward voltage drop of 0.7 volts to 1 volt based on current/load and type. Replace it with a simple germanium diode for a 0.2 to 0.3V drop instead, paired with a usb power supply of 5.3V for the closest 5V source.