A little PIC & FET clarification please!

Thread Starter

MagicMatt

Joined Sep 30, 2013
117
I have some PIC16F690 microcontrollers.
I also have some IRL520 MOSFETs

So far so good.

I want to use the PIC to drive the FET as an on/off switch. In the circuits I've seen, some have a resistor between the PIC logic output, and the FET gate input, usually around 320 ohm, and some don't. All seem to have a resistor that taps off the line between PIC output and FET gate, and goes to ground - usually around 10 kohm.

The 10kohm seems to me to be a pull-down resistor to make sure the line goes to 0V (or near as).

I don't know what the 320 ohm resistor is for though... particularly as some circuits have it and some don't.

Can somebody please explain to me what that resistor is for, and when it would be needed?
 

joeyd999

Joined Jun 6, 2011
6,279
Upon power-on reset, the PICs outputs are Tri-state, i.e. floating. The 10K resistor, to ground, in the case of an N channel MOSFET insures the load stays off until the pin gets initialized. It also ensures the load returns to the off state quickly when the PIC is powered down.

The gate has a very high DC impedance...essentially, an open circuit. But it has a finite AC impedance. This depends on the size of the gate, which is usually dependent upon the power handling capability of the FET.

Ideally, one wishes to drive the gate as hard as possible, ensuring rapid turn-on and turn-off, thus reducing the power dissipated by the FET during transitions. In this case, zero ohms between the driving pin and the FET gate produce optimal results.

But if the gate capacitance is high enough, and the switching speed is fast enough, the AC current may be large enough to damage the driver. This is where a gate resistor can be used to limit the output pin AC current, at the expense of slower turn-on/turn-off times.

Also, there is this thing call gate charge injection where, during transitions, power is capacitively coupled from the drain to the gate, causing a surge feeding back into the driver.

The higher the drain voltage, and the faster the switching time, the greater the surge. At some point, this surge can damage the output pin driver. The gate resistor can limit the max current of this surge, again at the expense of switching speed.
 

NorthGuy

Joined Jun 28, 2014
611
If you do not switch it thousands times a second, then it's better to use a resistor to protect the pin.

If you do switch frequently, you probably need a driving circuit or IC to make switching faster.
 

Thread Starter

MagicMatt

Joined Sep 30, 2013
117
Thank you, that explains it very clearly.

Since I'm using around 250Hz max, I will include a resistor to protect the PIC. :)
 

BobTPH

Joined Jun 5, 2013
11,514
With 490pF input capacitance and a 330 Ohm resistor, the time constant would be 166uS. Switching at 250Hz, at 50% duty cycle gives you and on / off time of 2mS. Thus a ballpark estimate of the % of the cycle in switching time will be 166 / 2000 = 8%. This is way too high. Use a much smaller resistor, more like 10 to 33 Ohms.

Bob
 

Thread Starter

MagicMatt

Joined Sep 30, 2013
117
Hang on, rewind, lol....

"With 490pF input capacitance..."

Ok - from the data sheet, yes? 440pF apparently, but close enough...

"...and a 330 Ohm resistor, the time constant would be 166uS."

Ok... that's T=RC, yes?
So 330ohm x 440pF = 145uS ... ok....

"Switching at 250Hz, at 50% duty cycle gives you and on / off time of 2mS."

So that's the time the output is at a given state, ignoring any rise and fall time... ok...

"Thus a ballpark estimate of the % of the cycle in switching time will be 166 / 2000 = 8%. This is way too high. Use a much smaller resistor, more like 10 to 33 Ohms."

So if I use a 33 ohm resistor, the switching time becomes 15uS ... and 15uS / 2000uS = 0.75%

This is essentially how much of the waveform is changed from a square wave to a slightly trapezoid shaped wave, yes?

What is the consequence of that being too low... more heat build-up in the FET?
 

crutschow

Joined Mar 14, 2008
38,503
A series gate resistor is used to minimize oscillations that can occur due to the gate capacitance and stray inductance. Normally you don't really have to worry about the gate capacitive load damaging the PIC output since it is not damaged by short-term shorts to ground.

Yes, the slower the rise and fall time the more the MOSFET dissipates. A rough estimate of that dissipation is to multiply the rise/fall time by the MOSFET supply voltage and ON current, and then multiply that by the frequency.
 
Last edited:

Thread Starter

MagicMatt

Joined Sep 30, 2013
117
Ohhhhh... yeah that does make a big difference! LOL!

So, my 330 ohm resistor is probably fine then... :)

Soon find out - I'll keep a check on the FET temp. anyway when I test run it. If it gets too warm, I'll put a smaller resistor in until it doesn't. :D
 

THE_RB

Joined Feb 11, 2008
5,438
The PIC output pin HI side driver has an internal resistance of 40 to 60 ohms anyway. :)

I've done low freq PWM of FETs for DC motors (few hundred Hz) on many occasions, and have used resistors in the 1k to 4k7 range with never a problem.

The FET datasheet "490pf" is likely to be a worst case scenario value, maybe when running at max drain current of 50A etc. The real world G-S capacitance when switching lighter loads is likely to be much less than 490pF.

And the region where the FET switches from OFF to ON can be over a small range of a volt (or less than a volt) from G-S, so the G-S timeconstant value does not properly represent the rate that the FET switches from OFF-ON anyway (for BobTPH).

I just look at Drain rise and fall times on the 'scope.
 

Thread Starter

MagicMatt

Joined Sep 30, 2013
117
I don't have a scope, so I'll have to use the "put your finger on the FET every minute or so and see if it's getting warm" method. ;)
 
Top