I have a 5V logic signal coming from a pin on my microcontroller. I would like to use this to turn on and off another circuit which also runs at 5V. i. e. the logic level is the same, but I need to switch more current than the microcontroller pin can source.
I started with this circuit by Jon Watte, for using a P-channel MOSFET as a high-side switch for 12V:
I tried using this same circuit, but running it at 5V instead of 12V. It worked, but when I started to draw more than a few mA of current, the voltage starts to sag towards 4V and even lower.
So, I tried replacing the IRF9530 with a NDP6020P, which has a drive voltage of 4.5V. I thought that ought to fix the problem:
However, that did not fix the problem. The voltage doesn't sag quite as much quite as quickly as with the IRF9530, but it still gets lower than I would like. (The voltage drops to 4.3V at 150 mA.)
Why didn't this work the way I thought it should? What are the "engineering calculations" I need to perform to choose a MOSFET that will make this circuit behave properly as a switch?
Edit: Here is how I'm performing measurements:
I've connected the output to a SparkFun Variable Load. The variable load acts as an electronically-controlled variable resistor. It also measures the current going through the resistor (
MES3), and measures the voltage across the terminals (
MES2). I also have a separate voltmeter connected directly across the power supply (
The 5V supply, depicted as a battery in the schematic, is actually a 5V, 2A USB wall adapter.
As the load increases, the voltage measured at the output (
MES2) decreases. However, the voltage measured at the power supply (
MES1) also decreases. This would seem to suggest the power supply can't handle the current.
However, if I connect the variable load directly to the power supply, I can draw significantly more current without the voltage sagging by any significant amount.
So that would suggest there is not an issue with the power supply. This seems very weird.
Conclusion: I never did figure out what was wrong. But I rebuilt the same circuit on a new breadboard, and it seems to work as expected now. So obviously I messed something up before, but the design itself seems to work.