Electronic – arduino – Advice for this P-Channel MOSFET Power Source Selector

arduinoarduino unocircuit analysismosfetpower supply

I know there are already questions and answers about P-Channel MOSFETs and power source selection, but I still find myself pretty confused, as many of those are more complex than my circuit or simply connected differently. I'll lay out my design and then list a few questions. Any thoughts would be greatly appreciated!

I'm powering an ATMEGA328P using approximately 5V (so it can run at 16MHz). Normally, it will run on 3 AAAs in series (4.5V total). When I connect a 5V FTDI USB-to-serial board to program it, I'd like power from the battery to be cut to keep from damaging the battery (I don't want to have to put a diode there). I'm planning to use a logic-level P-Channel MOSFET. I expect to draw about 50mA max, but may plan for 100mA just to be safe.

schematic

simulate this circuit – Schematic created using CircuitLab

Analysis:

Vusb range: [4.75V, 5.25V] (per USB standards)
Vbat range: [3.8V, 4.8V] (min needed for 16MHz and max from 1.6V AAA estimated max voltage)

USB Connected:

Vusb    Vbat    Vgs    Expected MOSFET State
--------------------------------------------
4.75V   3.8V    0.95V  OFF
4.75V   4.8V   -0.05V  OFF
5.25V   3.8V    1.45V  OFF
5.25V   4.8V    0.45V  OFF

USB Disconnected:

Vusb    Vbat    Vgs    Expected MOSFET State
--------------------------------------------
0V      3.8V   -3.8V   ON
0V      4.8V   -4.8V   ON

Questions:

  • Are there any glaring mistakes with this design?
  • What's the best way to keep the MOSFET from accidentally opening? I've tied the gate to ground through R1, which seems correct.
  • I've connected Vusb (gate) to VCC (drain), then added a diode to keep the MOSFET from always being open. Is this a correct assumption?
  • Do I need any other diodes on the two power lines? I'd rather not have their voltage drop (otherwise I'd just use a simple ORing diode circuit to get what I want). What circumstances would produce backfeed current into either the battery or USB?
  • I've often seen P-Channel MOSFETs connected the other way around, with the load connected to the source rather than the drain. What's the deal with that? Can current flow both directions? Which is most conventional?
  • I'm planning to maybe use FQP27P06, though it seems most logic-level ones have a compatible Vgs(th) range. Have any better/cheaper suggestions?

Thanks again! I've asked multiple questions on this forum and y'all are always so helpful.

Best Answer

I was close, but this seems to be a working circuit, based on this app note for a load-sharing circuit and this SO question. Essentially, I needed to reverse which side of the MOSFET the load goes on. See below:

schematic

simulate this circuit – Schematic created using CircuitLab

Analyzing this circuit...

When USB is connected, Vs = Vg - Vf1 ==> Vg - Vs = Vf1 = Vgs, where Vf1 is the forward voltage drop across D1. Then D1 can be selected such that its forward voltage falls under the Vgs(th) of the MOSFET, keeping it open. If Vgs(th) is about -2V to -4V (based on a typical logic-level P-Channel MOSFET), then we just need a diode with a drop of less than 2V, which is very easy. We also need to maintain as close to 5V as possible for the ATMEGA chip, so a schottky is best, as it can provide less than 1V drop.

When the USB is disconnected, Vg is pulled to 0V, and Vs = Vcc = Vbat - Rds(on)*50mA (for an approximate 50mA current). Thus Vs is close to 4.5V and Vgs ~= -4.5V, and the MOSFET will conduct. Selecting a MOSFET with a low Rds(on) will keep from losing too much voltage. The D1 diode keeps the gate Vg from being equal to Vs at this point, as it will be reverse biased.

Lingering questions...

  • One part that I'm not totally certain of is the scenario when the USB is disconnected: How can I assume that the MOSFET is conducting? It seems that if I start with that assumption, I don't run into any contradictions. Yet, if I assume that the MOSFET is open and Vs = Vg = 0V, then I don't really run into contradictions either. What would Vs be when in this second case? Perhaps someone can clarify? Otherwise, I'll assume that the folks who wrote the app note I'm referring to know what they're doing.

    UPDATE - Answer: When USB is unplugged, Vg = 0V and Vs = Vd - Vf where Vd = Vbat and Vf is the MOSFET's body diode forward voltage drop, usually around 0.65V (note this is typically specified as Vsd on a datasheet and is usually given as a negative number). This puts Vs ~= 3.85V, resulting in Vgs = Vg - Vs = -3.85V. For a P-Channel MOSFET with a Vgs(th) of -2V to -4V, this will activate the MOSFET and cause it to conduct. Once the MOSFET has turned on, the voltage drop from the body diode goes away, and is replaced by the voltage drop from the internal resistance, called Rds(on), so Vs = Vd - Rds(on)*i where i is the expected current through the MOSFET.

    Side Note: Don't be confused by the fact that Vgs(th) is often a range on datasheets rather than a single value. It's totally fine and often desired to be more negative than the "max" for range (e.g. -4V in our case), within the datasheet's absolute max ratings, of course.

  • Is D2 necessary? If I understand correctly, it keeps current from backfeeding into the battery. The app note pictures it and mentions you can buy the MOSFET with it built-in (schottky). I manually added it to my schematic, but is it already assumed? i.e. is it the same or different from the parasitic body diode?

    UPDATE - Answer: It is the same as the body diode of the MOSFET and is not required as an "extra" diode. That said, some have recommended against using it as the only backward-current protection diode.