0
\$\begingroup\$

I've seen this circuit used in several ESP32 designs (e.g. the Sparkfun ESP32 Thing) and in an answer on this site that allows a device to be powered by either 5V from a USB connection or a battery. V_OUT shown in the schematic usually goes to an LDO to convert 5V to 3.3V.

I'm clear on what happens when just the USB is connected: power goes from VBUS through D1 and out V_OUT. The p-channel MOSFET M1 is open.

When USB is not connected and a battery is, the 10K pulldown resistor pulls the MOSFET gate to 0V, and current flows from V_BATT through the MOSFET's body diode which causes the voltage at V_OUT to be higher than the gate, so the MOSFET channel closes and conducts (I hope this is the correct interpretation of events, please correct me if I'm wrong).

What I don't understand is what happens when both the USB and V_BATT are connected simultaneously. I expect the gate voltage to be high enough that the MOSFET channel doesn't conduct, but I also expect some current to flow through the body diode from drain to source. Is this what happens? Is this in some way bad or harmful to the circuit?

If I wanted to create a circuit to switch between one or the other supply exclusively, but prefer the supply tied to the gate (i.e. VBUS), is a p-channel enhancement mode MOSFET the correct part to use?

schematic

simulate this circuit – Schematic created using CircuitLab

\$\endgroup\$
5
  • 1
    \$\begingroup\$ Source tied to gate. Methinks you muddle and muddy your question by mentioning the (power) source and gate (of a MOSFET that also has a source pin). \$\endgroup\$
    – Andy aka
    Dec 14, 2021 at 8:40
  • \$\begingroup\$ @Andyaka Yep. Reworded for clarity. \$\endgroup\$
    – par
    Dec 15, 2021 at 3:25
  • 1
    \$\begingroup\$ M1's body diode is reversed bias when both USB and battery are connected. It requires 0.3V forward to conduct. \$\endgroup\$
    – DKNguyen
    Dec 15, 2021 at 3:27
  • \$\begingroup\$ @DKNguyen Of course! That makes a lot of sense. There are so many nuances to consider here. \$\endgroup\$
    – par
    Dec 15, 2021 at 3:40
  • 1
    \$\begingroup\$ @par My bad on the last sentence. D1 is the one that requires 0.3V because it is a Schottky. The body diode requires more so if D1 is conducting then body diode gets reverse biased. \$\endgroup\$
    – DKNguyen
    Dec 15, 2021 at 3:43

1 Answer 1

2
\$\begingroup\$

At V_OUT, you have two voltages join through two diodes. VBUS from USB through the diode after losing voltage on the said diode, and V_BATT through the body diode. The one with the higher voltage at that point will power the system, the other one will have no current. At the same time, even if VBUS from USB is higher, it will not go into V_BATT, because you need certain Vgs on the MOSFET, and gate and source of the MOSFET will be around equal (5V on gate and same-5V-minus-Vdiodedrop on source).

So the higher voltage that arrives to V_OUT will power the thing, while the other source will have no current pulled from it, because you can't have current from lower voltage to higher.

I take it D1 is schottky diode for lower voltage drop (~0.4V) and MOSFET's body diode will have some drop specified in the datasheet, could very well be higher than that. If that's the case, then VBUS will go to V_OUT, but it will be stopped from going into V_BATT by the closed (non-conducting, I mean, this word is very confusing when talking about mosfets) MOSFET, whose Vgs won't be enough to make it conduct (Vgs will be -Vd1drop).

\$\endgroup\$
1
  • \$\begingroup\$ Thank you, this is instructive. Yes D1 is a Schottky, I didn't realize I could show that in CircuitLab but now I've fixed it in the question. \$\endgroup\$
    – par
    Dec 15, 2021 at 3:08

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.