2
\$\begingroup\$

How a P-MOSFET works is clear, there is plenty of documentation on the web. But what's the standard circuit to use them as an ideal switch with an MCU is not that clear, in my opinion.

I saw there are a lot of circuits that use an upstream NPN transistor or a N-MOSFET to control a P-MOSFET's Gate. And how they work is very clear. However, every circuit of these have to switch a voltage higher than MCU's voltage.

Given this circuit:

enter image description here

It doesn't seem to me that this could work without an upstream component that will connect to GND the Gate, given that the Arduino's digital pin isn't an open-drain INPUT, but works like an OUT. In other words, voltage or no voltage. These are my considerations about this circuit, please help me and everyone to understand answering these points:

  1. The pull-up resistor function is to define the default state of the P-MOS Gate. The pull-up takes the Gate to +5V, in this case. So default state = OFF
  2. When the Arduino digital pin is +5V, the Gate still stays at +5V.
  3. When the Arduino digital pin is 0V, the Gate still will be +5V, given that the Arduino's pin isn't an open-drain pin. In other words, that pin doesn't connect to GND, letting the current flow and to take the pin to the 0 digital status.

Am I wrong?

\$\endgroup\$
4
  • 2
    \$\begingroup\$ Arduino's GPIO's are push-pull, so will switch to Vcc or to GND, unless configured as inputs. \$\endgroup\$
    – JimmyB
    Commented Apr 7, 2016 at 11:05
  • 1
    \$\begingroup\$ Related information here. \$\endgroup\$
    – bitsmack
    Commented Apr 7, 2016 at 16:03
  • \$\begingroup\$ Check the drain and source connections on your transistor. In which direction does current typically flow? \$\endgroup\$
    – Cuadue
    Commented Sep 29, 2017 at 18:47
  • \$\begingroup\$ Your schematic symbol has the D and S reversed! I also have to say that using common positive can be confusing when you later choose to drive the load with a different voltage. Plus P-channel MOSFETs typically have worse internal resistance. Thus use an N-channel MOSFET in the common negative. And remove the curent-limiting resistor. It's for bipolars only and shows how you don't know what you are doing. Make sure that your load isn't very demanding since 5V aren't optimal for turning on a MOSFET. \$\endgroup\$
    – Zdenek
    Commented Nov 10, 2017 at 19:43

3 Answers 3

2
\$\begingroup\$

You state:

3.When the Arduino digital pin is 0V, the Gate still will be +5V, given that the Arduino's pin isn't an open-drain pin. In other words, that pin doesn't connect to GND, letting the current flow and to take the pin to the 0 digital status.

This is a misunderstanding of a CMOS output stage that is not open drain:

It looks like this:

CMOS output stage

Because this is a push pull circuit (always driven to the rails in normal operation), either the top transistor is on (output high) or the bottom transistor is on (output low; in both cases, current can flow.

Update on current concerns:

When the output is high and therefore at the same level as the external PMOS drain, then no current flows (because the voltage between them is zero or very close to it). When the output is low, then a current of 5V / external PMOS gate to source resistor will flow.

It is not unusual to see resistors of the order of 100k\$\Omega\$ in this use case.

I fully agree with Olin that the control pin to gate resistor is unnecessary.

\$\endgroup\$
1
  • \$\begingroup\$ Ok, so in both cases we have to care about maximum rated current of the pin. \$\endgroup\$
    – Nic1337
    Commented Apr 7, 2016 at 11:30
2
\$\begingroup\$

The circuit you show should work if the FET can be usefully turned on with -5 Vgs, and the pullup is much larger than the series resistor.

There is really no need for the first resistor anyway. You could just connect the gate to a 0-5 V microcontroller output with a weak pullup to make sure it is high before the firmware can set the pin to low impedance and drive it high. Putting the pullup after the series resistor creates a voltage divider that reduces the gate drive, which is probably not desirable.

\$\endgroup\$
1
  • \$\begingroup\$ @Tut: Yes, clarified. \$\endgroup\$ Commented Apr 7, 2016 at 13:20
0
\$\begingroup\$

You do need to place a resistor between the Arduino output and the gate to limit the current which flows into the capacitor formed by the gate. This is explained very well here mosfet-gate-resistor

The article suggest that to limit the current from the Arduino to safe levels you should use a 100 - 220 ohm resistor (trade off switching speed vs current).

\$\endgroup\$

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.