Electronics > Projects, Designs, and Technical Stuff

Driving MOSFET gate with MCU I/O pin - resistor needed?

(1/2) > >>

I want to drive the gate of a MOSFET (http://www.irf.com/product-info/datasheets/data/irlr8259pbf.pdf) directly using the I/O pin of an ATMega8A microcontroller but I'm wondering if a gate resistor is required for this. The ATMega8A has a maximum output rating of 40 mA so wouldn't the current spike when charging the gate capacitance be very high?

I've googled around a bit for this and some people say to use no resistor, some people say to use a low value resistor (1 - 20 ? or something like that) just to prevent ringing and some people say to use a higher value resistor for current limiting (5V / 40mA). What's the correct thing to do?

I do realize that I probably should use a MOSFET driver for this but that's not the point. I'm wondering about the how's and why's so I can figure out myself what I need using the data sheets.

mikeselectricstuff:
Yes, you should use a resistor to limit peak current if using larger MOSFETS - MOSFET gates can have high capacitance - well into nanofarads, which can cause current spikes on the MCU die, and ringing if the track is long. Resistor value depends on how fast you need it to switch.
The resistor can also be useful to limit the risetime of whatever you are switching.

Since I want to switch as fast as possible (although it's not critical), I'd want to take advantage of all the current I can get. So that would be a resistance of 5V / 0.040 A = 125 ? ~= 150 ?

Sounds reasonable?

To determine the switching speed, what capacitance in the data sheet should I be looking at? Is it the input capacitance (Ciss) of 900 pF?

Psi:
I've seen circuits with anything from 10R to 200R.  Personally, ive use 100R on atmegas and had no issues, 50mA is a little above the max but its for such a short time (just to overcome gate capacitance) that it doesnt seem to do any damage. You could probably even use 20R without any problems, most atmega ports are rated to 300mA (300mA total for all i/o on one port). I wouldnt recommend doing that for a professional product though.

If you were designing a product to sell then the correct way to do it would be a proper mosfet driver IC. However i'm sure there are professional products out there that just drive it directly. You can always use 137R which limits the current to a 100% safe 40mA at 5.5V the mosfet wont switch as fast but that may not be an issue in some applications.

jahonen:

--- Quote from: shadewind on March 04, 2011, 10:51:27 am ---To determine the switching speed, what capacitance in the data sheet should I be looking at? Is it the input capacitance (Ciss) of 900 pF?

--- End quote ---

Use gate charge for that, and read required gate charge for your gate voltage. For example if your mcu outputs 5V, then determine gate charge for that voltage and divide it by gate current. That gives you an idea how long the transition will take.

Regards,
Janne