I think I'm understanding this now, thank you!!!
Lets me run the numbers and see if I'm understanding it correctly. Sounds like you are right in that the battery voltage CANNOT be significantly higher than the mains supply;
[update: might've got a bit mixed up, check the updated answer at end of post]
Example 1: Battery voltage NOT significantly higher than mains
Mains voltage = +5V
Battery voltage = +5.4V (1.8V lithium * 3)
Mosfet used in diagram (DMP1045U) has VGS(th) max of -1V.
P-FET Mosfet is turned on when VGS(th) > VG - VS
Battery is connected to drain, and exits at source, and has a small voltage drop (1v typical), so drain = 5.4V and source = (5.4 – 1) = 4.4V
- When mains power is ON
- Gate is +5V
- Source is + 4.4V
- Vgs = VG - VS = 5 – 4.4V = +0.6V
-
0.6V (Vgs) > -1V (vgs threshold max), so mosfet is OFF.
(also note that the minimum vgs(th) is -0.3 for the DMP1045U, so we are 0.9V away from the mosfet beginning to turn on)
- When mains power is OFF
- Gate pulled to GND, so Gate = 0V
- Source = + 4.4V
- Vgs = Vg - VS = 0 – 4.4V = -4.4V
- -4.4V < -1V, so Mosfet is turned ON
Example 2 when battery voltage is higher than mains voltage:
Mains voltage = +5V
Battery voltage = +8V
The source will equal to 8V - 1V(diode drop) = +7V
- When mains power is ON
- Gate is +5V
- Source is +7V
- Vgs = Vg - VS = 5 – 7V = -2V
-
-2V (Vgs) < -1V (vgs threshold), so mosfet is ON (battery is draining when mains is ON and circuit doesn't work).
Now, to account for the battery drain over time, it sounds like I should be using a mosfet with a low Vgs(th), as when the battery loses voltage, the source gets closer to the VGS(th), correct?
The NDP6020Pseems like a pretty common through hole one, with a vgs(th) max of 1V. Plenty of amperage too (24A);
The one in your diagram though (DMP1045U) seems a lot more appropriate though, as max amperage is 6A. My application shouldn't exceed 2 amps I'm guessing
Thanks again
[updated answer]
based on this stackexchange answer; arduino - Advice for this P-Channel MOSFET Power Source Selector - Electrical Engineering Stack Exchange
Example 1: Battery voltage NOT significantly higher than mains
Mains voltage = +5V
Battery voltage = +5.4V (1.8V lithium * 3)
When 5V mains is connected:
-
VG = 5V from mains
-
vs = vg - vf1 (diode drop of SB220 is 500mV) = 5V - 0.5V = 4.5V.
-
vgs = vg - vs = 5v - 4.5v = 0.5v
-
VGS(th) of mosfet in your diagram is -1V (maxium, i.e. fully on), -0.3V (minimum i.e. just starting to turn on)
-
VGS > VGS(th) = 0.5V > -0.3
result; VGS is NOT lower than threshold voltage VGS(th) minimum, so mosfet is OFF
When 5V mains is disconnected:
-
VG = 0V, as it's pulled to ground
-
vs = vd - vf (where vd is voltage of battery and vf is voltage drop of mosfet (Vsd is on datasheet) )
-
vsd on datasheet is -0.6V
thus,
-
vs = vd - vf = 5.4V - 0.6V = 4.8V
-
resulting in Vgs = Vg - Vs = 0 - 4.8 = -4.8
-
Vgs(th) > Vgs = -1 > -4.8
result; vgs(th) threshold (Max) is higher than vgs, so Mosfet is turned ON. And it is fully turned on because it's well below the maximum Vgs(th) of -1
[Further updates]
After mosfet is turned on and battery takes over;
Once mosfet is turned on, voltage drop from body diode goes away and now the voltage drop from internal resistance takes over. Voltage drop is now;
Vs = Vd - Rds(on) * current
my application will probably be no more than 1.5AMPS, so;
Vs = 5.4 - 31mΩ * 1.5 = 5.35V min
-
vgs = vg - vs = 0v - 5.35v = -5.35v
What happens if mains power returns (according to ShermanP's reply);
If the battery bas been powering the MOSFET and the mains of 5V returns back to normal, then the source voltage is still the battery voltage of 5.35 to 5.4 V, since the mosfet is initially on. The mains power is 5V and battery is 5.4V minimum, so gate-source voltage (vgs) is -0.4, which is actually lower than the minimum -0.3V vgs(th) . Therefore there's a chance the battery is still powering the Mosfet a little bit.
-
vgs = vg - vs = 5v - 5.4v = -0.4v
- **vgs < vgs(th) = -0.4 < -0.3, which means slightly on.
However, batery voltage will probably actually be more like 1.7, so battery voltage adjusted to 1.7*3 = 5.1, so;
-
vgs = vg - vs = 5v - 5.1v = -0.1v
-
vgs > vgs(th) = -0.1 > -0.3, which means MOSFET is now OFF. And we have to also account for the fact that the minimum vgs(th) is probably greater than -0.3V