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.
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.