Electronic – Using MOSFET to switch device

microcontrollermosfetswitches

Will my circuit work for the following goal?

  • When INPUT_N is HIGH (i.e. micro is not driving it and it is pulled up to 3.3V), VCC pin on device will have 24V.
  • When the microcontroller drives INPUT_N to be LOW, VCC pin is at 0V (so device is off).

Should circuit below work as intended?

schematic diagram

Best Answer

No, that won't work. P-channel mosfets require the Gate voltage to be lower than the source voltage by some threshold in order to "turn on".

The Mosfet will still conduct through the body diode so the device will receive a small voltage, not the 0V/24V of an on/off switch.

However, even if you did get the mosfet to act like a "short circuit", you're shorting the device VCC to ground which is wasting a good amount of power to turn off the device.

A better way would be to put the P-channel mosfet in directly inline with the device closer to the 24V source.

This would require the pullup voltage to go up to ~24V (minus the turn on threshold) to turn the mosfet off, so you'll most likely have to add some other circuitry to the MCU pin so it doesn't fry. A potential solution might be to use a second N-Channel mosfet to drive the P-channel mosfet gate pin to ground, then use a pullup resistor to the 24V rail.

Something like this:

enter image description here

VG1 is directly driven by the microcontroller (high voltage is on, low voltage is off). R2 is the load circuitry. T1 is a P-channel mosfet and T2 is an N-channel mosfet. R1 is a pull-up resistor to the 24V rail.

There might be a simpler way to do it, this was just the first thing I thought of.

edit:

If you can have a low-side switch, the switching circuitry will be much simpler: just a single N-channel mosfet with the drain tied to the load, the source tied to ground, and the gate tied to the microcontroller with high voltage being on and low voltage being off.