Drive a low-voltage MOSFET gate directly from a microcontroller

gpiomicrocontrollermosfetmosfet-drivermotor controller

We're working on this project for school where "reducing the number of components is essential".

We need to operate a little brushed DC motor so we thought of using a simple low-side drive configuration with an N-channel MOSFET like this one here: IRLHS6242PBF

How do I know if a microcontroller's GPIO has enough "power" to drive that MOSFET? Here is the link to the microcontroller we're thinking of using.

I looked at the gate charge of the MOSFET in the datasheet, the rise time of our PWM signal and the maximum GPIO current of 25 mA and from my calculations it looks like the controller should be able to drive the MOSFET gate without a problem as long as the required PWM rise time allows it. Am I actually wrong? How would you calculate it?

MOSFET specs

GPIO specs

EDIT: We're aiming at a switching frequency of 1 kHz, not much more than that, I think.

Best Answer

The answer is yes, and no. I mean it depends on what you need to do with the load.

For simple and relatively slow on/off switching you can do it provided that…

Your MCU has sufficient output level: most logic level mosfets are characterized for a Vgs of 4.5V; usually in the cover page you see the manufacturer boasting their Rds at 10V (standard level) and 4.5V (logic level)

Your MOSFET is a so-called super logic level, it's characterized at 2.5V in this case; there are even 1.8V gate level MOSFETs (usually for low power environments).

Note that you pasted the absolute values for the GPIO ports: these are not quite as interesting as the typical values, for this purpose. On your datasheet table 17 has the answers.

Be sure that your maximum VOL is below your gate threshold (to avoid erroneous starts!). You have 0.4 max on the MCU and 0.5 min on the MOSFET, so it's OK. Also remember a gate pulldown to ensure the MOSFET stays off when the port is tristated (during reset, usually).

For the ON condition you need to check the VOH. Your target is at least 2.5V (the output curve on the MOSFET datasheet tells the whole story). So you need at least 3V of supply on the MCU.

Notice the condition column in the table: the specified values are stated at 8mA. CMOS output cells are somewhat nonlinear (i.e. they don't have exactly an output impedance). The idea is that you ask for more current the port will not reach the stated performance.

For the current the issue is slightly more complicated: as you probably know the gate terminal is substantially a capacitor (the other terminal is the source, of course). Turning on/off the MOSFET is simply charging/discharging that capacitor (almost: it's a composite capacitor that has different charging phases).

As a first approximation you need to look at Ciss (the input capacitance of the MOSFET). That's about 1.1nF in this case. Another useful parameter is the total gate charge Qg (it tells how much you need to charge the gate)

So, to recap:

  • You have about 2.5-2.8V of GPIO available;
  • You need to charge a 1.1nF gate capacitor;
  • You have at your disposal about 8mA of current;
  • When you have put about 18nC of charge in the gate the MOSFET has completed the switching (well, it finishes before but it's simplified).

To limit the GPIO current of course you use a resistor. Remember that an empty capacitor is almost a short circuit so you need to limit the whole 2.5-2.8V output to 8mA. Ohm's law helps.

This is everything you need for a simple, slow, MOSFET switch (remember to freewheel the motor inductive demagnetization, obviously). In this situation the MOSFET is (substantially) fully enhanced and dissipates as an Rdson resistor.

Now, for PWM you have two main issues:

  • With only 8mA the switching operation is slow. Really. You can use the RC circuit exponential behaviour to determine the switching time, in theory. In practice these days you usually use a simulator (often SPICE based) to know how much time it takes; this limits the frequency you can use for you PWM (remember that you also need to discharge the gate for turning the MOSFET off, so the minimum period is twice the time!)

  • During the commutation the operation point moves thru the linear region, so the Rdson value is not valid anymore. In this region Vds is significant and power dissipation can be a concern (these are called switching losses). Of course the more time it take more joules are wasted in heat.

Losses depend on the current needed for your motor but can be estimated. You can't do a thing for static (Rdson) losses. Switching losses can be reduced charging faster the gate, i.e. with more current. Then you need a gate driver and there are more issues. You can use gate drivers even at logic level (if the driver works at such a low voltage).

A good introductory appnote is SLUP169 Fundamentals of MOSFET and IGBT Gate Driver Circuits from TI.