Electrical – mosfet switch power (N or P channel)

diodesmosfetpower supplyswitches

I think this a simple question but I can't find the answer ! I try but … that don't came out !

I have an USB connector. In one case, I want to powering myself with my batterie (if I use it with a device and I'm the host). In the other case, I will have Vbus powering by an external host (so I want to cut the power by the battery) -> So the schematic case

I don't want to use a power switch CI.

I found a solution with a simple diode but I lose some voltage power … I wanted to use a Mosfet for switching power. I can command this mosfet with an MCU. So when I detect vbus power 5V, I cut the battery power …

How i can do this with a mosfet ? (P or N …) ?

schematic

simulate this circuit – Schematic created using CircuitLab

Thanks you very much

Best Answer

You can eliminate the diode voltage drop using a P-channel MOSFET, but there are some subtleties that could catch you out:-

  1. The MOSFET has an internal 'body' diode connected between the Source and Drain. This can perform the same function as your diode, but to get the diode pointing in the right direction the Drain/Source polarity must be reversed.

  2. If the MCU only outputs 3.3V then the MOSFET's Gate voltage must be raised up to meet the Source voltage. This level shifting can be done with another FET or bipolar transistor, which can also conveniently invert the signal so the FET turns on when the MCU's digital output is high.

The circuit looks like this:-

schematic

simulate this circuit – Schematic created using CircuitLab

So far so good. However this scheme has a problem - if external USB power is applied while the FET is turned on then current will flow from the USB port into the battery until the MCU switches the FET off. Also the difference between internal and external USB power is then quite small (~4.5V vs 5V) so the MCU might have trouble determining when external USB power is present.

If you add a booster to get 5V from the battery then the voltage difference could be so small that it is impossible to tell whether external power is present. One solution might be to feed both battery and USB power through the booster, with diodes in series with each source to isolate them from each other. You can then measure USB input voltage without interference from the battery, while the booster produces a full +5V from both power sources.

schematic

simulate this circuit

In this scheme you would have one USB port to get power from as a device, and another to put power onto as a host. If you want to do both jobs with a single USB port then you are creating something similar to USB On-The-Go, so it might be easier to use a dedicated OTG controller chip.