Value of gate resistor?

I have an mosfet (IRF3708) that i will use for turing on an Songle 30a rated relay module with 5V. Relay demands 180mA.

I use an Wemos D1 mini for switching the mosfet on/off. (3.3V)

What value do i need for the series resistor to the gate pin?

This question comes up here periodically. I am surprised that the argument has not started yet. One school of thought is that there is no resistor required. Another is that the resistor should limit the current to charge the gate capacitance to the max recommended for an output pin of the processor. Personally, I use a resistor. What is the recommended max current for a D1 output?

I think datasheet says 12mA.

These two references both suggest using a gate resistor but for completely different reasons

Personally I usually don't use one, but I have a relative the would always put say 50ohms in series with the gate. I depend on the output fet's on resistance to limit the current and a small gate Capacitance to limit the time. Perhaps I have just been lucky :slight_smile:

The data sheet for the ATMega48P (Uno I believe) on Figure 29-24. the I/O source pin curves. The gate output resistance is ~27.5ohms. 5V drops to 4.45V when supplying 20mA
So at least for that chip it appears to have ~25ohms in series with output to the FET gate.
Looks like the input Cap for the IRF3708 is a few nF
Edit -- I do always add a pull down resistor on the gate (N-Fets) of about 10K

1 Like

Okay, thanks :slight_smile:

This is not an critical important circuit, so i will try without a series gate resistor and see how it works. But yes, a pull down resistor to Gate will be added. :slight_smile:

Wery funny btw. When i get notice by mail that you have answered in this post, i read the page you linked to :slight_smile:

That module you are switching, which I guess you are switching on the low side, probably has also large capacitors across its power rails, which are charged up as soon as the module is powered on. So exactly the same arguments apply to protecting the mosfet as protecting the Wemos D1 pin.

So actually a high value gate resistor might be good to control the slew rate. In practice, however, the internal resistance of your power supply will be the limiting factor and prevent damage.

You can play with the calculations here: Charging a Capacitor

Why are you using a 52A rated MOSFET to switch 0.18A? A 2N2222 would be
perfectly servicable for this, and smaller and cheaper.

1 Like

I do not have 2n2222, but i have BC547 and BC537. Can i use one of theese to power on and off a relay that claims 180mA?

BC547 not (Ic max = 100 mA)/
BC537 yes (Ic max = 1 A).

Is that MOSFET rated to turn on with a vgs +3.3v?

Edit: just saw marks post. Exactly right

So the value of the gate resistor with a 3.3V output would be 3.3V / 12mA = 275Ω (nearest 5% resistor = 270Ω). Along with a 10K (or so) pulldown from the D1 output to ground (not gate to ground).

Thanks :slight_smile:

But isn't gate to ground the same as D1 output to ground? Output is connected to the gate?

The gate resistor goes from the D1 output to the MOSFET gate. The gate resistor is in between.
If the pulldown is on the gate there is a voltage divider formed that drops the voltage form the output at the gate. Granted the difference is very small, but it is there.

Schematic is for a 5V (20mA) output, hence the lower value gate resistor.

And it is a matter of comprehending why you have a pulldown resistor.

It is not that the gate "needs" to be pulled down. It is that until the microcontroller initialises, the GPIO pin is undefined - floating. The problem is the microcontroller, so that is where you put the pulldown. :sunglasses:

Two things. The IRF3708 is a good logic level FET, so if you have one and it was cheap enough, you might as well use it. And if all you are doing is switching a relay, the infrequent transient current charging or discharging the gate capacitance is unlikely to harm the ESP8266. Not the same as using PWM.

Well, because they are both true. However, they limit themself to just one side-effect of gate capacitance without explicitly saying that there are no others. And I may add a third one. To have a more comprehensive list:

  1. Gate capacitance is, well, a capacitor. When a voltage u is applied, the (gate-) current is i_gate = C_gs*du/dt in absence of a resistor. Which becomes quite large for high du/dt - or theoretically infinite for a step-change. That's why a resistor should be used which limits the current to protect(!) the driving circuit provided it is not designed for (like MOSFET-driver circuits). Since this is not he case for digital controller like ATmega328 and others, the resistor should be designed not to overload the output. Note: Data sheet of ATmega328 is not giving any limits for transient(!) currents above the nominal output current - so it has to be taken as not-to-exceed-value.
    This was adressed in this Myths-reference.
    For, e.g., max 20mA at 5V operating voltage, the resistor should not be smaller than 250 Ohms in order to protect(!) the MCU, and not because somebody says a gate resistor shall be added for every MOSFET. This more due to reasons below:

  2. Fine with the second referenced one. A capacitor forms an oscillator with stray inductances (PCB traces etc), which is not damped in case of missing gate resistor. So add one to add damping by means of a gate resistor, and the oscillations disappear (sufficiently damped).

  3. Third effect is more from control theory point of view. A capacitor adds a pole at zero being at the border of stability. Here it depends on how good, e.g,. an OpAmp is able to actually control the output in either open loop (like effect 2) or closed loop applications. Some more information may be found here: TI OpAmp MC33078, page 14.
    Note that in referenced data sheet to load of the OpAmp is not part of the feedback loop.

For driving a MOSFET directly from an GPIO of an Arduino in typical "Arduino-applications", I consider the first effect as the dominant one. If fast switching is required, an additional driver circuitry is to use.

The problem is the floating Gate of the FET. So the 10K should ground that circuit so that even if the micro is 'unplugged' the FET stays off.
i.e. in @groundFungus circuit above R1/R2 are soldered to the FET and then the wire goes off to the micro.

There is already a "gate resistor" of 47 Ohms or so inside the microcontroller, so this ain't going to happen!

No it isn't! :roll_eyes: That's one of the specific reasons that FETs are so useful, they do not draw continuous current. Not a "problem" at all.

Yes, connected before the series resistor. It is hardly difficult as they are both adjacent and adjacent to the FET.

Why would a micro ever be 'unplugged'? :astonished:

Unfortunately it is a problem for just that reason. Because the input resistance is so high and the gate cap slow low, the Fet can easily accumulate charge of the gate which turns it on.
The micro's output does not care and does not come into it.
It is a well know design rule to ground all unused inputs to CMOS AND/OR gates and comparators. (ie. Fet inputs)

The Gate resistor reduces stress of the driver (Arduino) but increases stress of the MOSFET. Unless someone uses 55 A MOSFET to control 180 mA it is the MOSFET what is in more danger. Adding a resistor only adds unnecessary risks (and switching losses).

Inputs of other CMOS logic are also FET Gates. Do you use current limiting resistors for them?

Some are worried about noise caused by the "fast switching". Others recommend external MOSFET driver. Typical driver is able to produce ampere or more of peak current - order(s) od magnitude more than Arduino even without current limiting resistor. How is it possible noise is no longer an issue with this driver which causes much harder switching?

What I was trying to say with the list of side-effects of gate capacitance is that they all need to be considered depending on application. I also stated that I consider the first one (MCU protection) as dominant, i.e. driving factor to size the gate resistor. With above given example 250Ohm is above 47Ohm, so use 250Ohm - and oscillation issue is simultaneously solved.

I think you argument applies also in other direction. The GPIO is for sure the more weaker device than a 55A MOSFET. Besides: data sheets of MOSFETs provide much more information than it is usually given in the datasheet of an MCU about its GPIOs. This enables a design with all devices operating within their specified limits.
Switching loss is not a risk, it already happens. So one need to deal with it.
For above application it is not an issue at all. The MOSFET is used to control a relay, so switching frequency is low, current is low, switching time is not an issue. Size the resistor according to GPIOs specification (max continous output current) and everything will be totally fine.

Yes, no resistors. You have raised a valid point. For sure it is possible to connect CMOS logic to a GPIO of an MCU without resistor. Fine with this.
But like for CMOS the number of gate inputs that can be connected to an output is not unlimited. I guess nobody would connect, say, a 100 CMOS logic inputs to one output of a CMOS NAND gate, isn't it? Taking a 10pF input capacitance, 100 CMOS inputs add up to 1000pF, which is still below of a gate capacitance of a typical 55A MOSFET (somehow in 2000-4000pf range) ... So connecting a 55A MOSFET to a GPIO of a CMOS MCU is like connecting 100 CMOS gates to the output of one CMOS gate. So why not doing one but doing the other?

In case of a external driver the current is not flowing through the MCU, and proper PCB design can take care for this peak current. Simply speaking, a physically separated path of that peak current will help to limit the noise on MCU's power supply - so noise generated through peak currents is an issue. I think nobody stated that it is none.