# MOSFET’s dynamic state current and Arduino I/O pins

Discussion in 'Microcontrollers, Programming and IoT' started by Smooth, May 4, 2019.

1. ### Smooth

5
0
Jan 2, 2017
Oi!

I am using an N-channel MOSFET (IRFZ24) to turn on a set of LEDs+other stuff (powered from 12V). Drain of the MOSFET is connected to the LEDs, source is grounded, and I use an Arduino’s digital pin to give either 5V or 0V to the Gate.

My question is about amps and burning. From their data sheets, Arduino can only handle 40mA through I/O pins. Now, while the MOSFET would draw practically nothing while in a static state, the dynamic state bothers me. Looking at page 2 of the MOSFET’s data sheet, the rise time is 58ns, and since I need to charge the gate by ~10-20nC, the current = dC/dt ~ 10/58 ~ 0.2A, higher than 40mA, hence I am killing the I/O pin.

Is my logic above correct? Am I gonna draw that much current? Would that fry my I/O pins? If no, why? If yes, what can I do to prevent that? Would throwing in a resistor to the Gate help (kinda like an RC circuit logic)? Am I being overly paranoid?

I’d really appreciate any advice and enlightenment I am just a student seeking understanding; and I don’t want to burn **another** Arduino.

Cheers,
Savva

File size:
351 KB
Views:
3
2. ### Harald KappModeratorModerator

11,975
2,803
Nov 17, 2011
The input capacitance of the MOSFET is 640 pF. While the gate drive current will not destroy the arduino unless operated repeatedly at a high rate or frequency, the usual method is a series resistor to limit the current:

Smooth likes this.
3. ### Bluejets

5,251
1,101
Oct 5, 2014
That would be an absolute maximum and even at that is also governed by other design features.

It is possible to simply drive the gate of the mosfet via an everyday transistor which in turn is driven by the uC thus avoiding any problems you imagine.

4. ### BobK

7,682
1,688
Jan 5, 2010
In reality, the I/O pin is self limited by something like 100 Ohms output resistance, so the gate will never get anything like the 200mA you calculate. And it will survive that unless you are switching at at high frequency.

Add another 220 Ohms and it will absolutely limit the current below the max, but I do not see the need for that. I have directly connected PIC pins to MOSFET gates all the time and have never experienced any problems.

Bob

Smooth and Bluejets like this.
5. ### Smooth

5
0
Jan 2, 2017
@BobK @Bluejets and @Harald Kapp thank you very much for the inputs! I will put a series resistor for the sake of it, as a precaution. Indeed, I realized that I've been driving MOSFETs with an Arduino and never burnt anything; and then that thought popped up. Cheers!!

6. ### Mark2019

14
4
Jul 7, 2019
This is one method you could use to overcome the problems that you are experiencing Notice I use a transistor drive to shut the fet off during transitions from hi to low This ensure the fet switching is stable Also note the use of the inline diode on the gate feed This ensures that we dont have reverse voltage flying back down the gate side onto the cpu port should an FET fault occur and secondly to bias the PNP transistor to shut the FET fully off when no pulse out

Its more likely that your fet you are using is not being shut off correctly than port overloading

See Image below (The most common method for driving FET's on switch mode power supplies in DC to DC convertors operating at frequencies of 500khz )

Hope that helps you You may have to alter the value of the gate feed resistor dependant on switching frequency for XR equally the type of load you are switching but you can also use a push pull transistor configuration to drive your fet for low gate drive

Your alternative is to use pulse transformers for coupling fet gates to cpu drive or use additional logic integrated driver circuitry

#### Attached Files:

• ###### FET Drive via micro.png
File size:
8 KB
Views:
5
Last edited: Jul 13, 2019