A little PIC & FET clarification please!

Discussion in 'General Electronics Chat' started by MagicMatt, Aug 14, 2014.

  1. MagicMatt

    Thread Starter Member

    Sep 30, 2013
    117
    14
    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?
     
  2. alfacliff

    Well-Known Member

    Dec 13, 2013
    2,449
    428
    gate current limitting
     
  3. joeyd999

    AAC Fanatic!

    Jun 6, 2011
    2,678
    2,737
    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.
     
    MagicMatt and anhnha like this.
  4. NorthGuy

    Active Member

    Jun 28, 2014
    604
    121
    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.
     
    MagicMatt likes this.
  5. MagicMatt

    Thread Starter Member

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

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

    Active Member

    Jun 5, 2013
    782
    114
    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
     
    MagicMatt likes this.
  7. MagicMatt

    Thread Starter Member

    Sep 30, 2013
    117
    14
    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?
     
  8. crutschow

    Expert

    Mar 14, 2008
    13,009
    3,233
    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: Aug 14, 2014
    MagicMatt likes this.
  9. Markd77

    Senior Member

    Sep 7, 2009
    2,803
    594
    I make it 166 ns which is much more reasonable.
     
  10. MagicMatt

    Thread Starter Member

    Sep 30, 2013
    117
    14
    I don't understand how you got 166 nano seconds...??
     
  11. Markd77

    Senior Member

    Sep 7, 2009
    2,803
    594
    330Ω x 0.000000000490F = 0.000000162s
    if I did my sums right.
     
  12. BobTPH

    Active Member

    Jun 5, 2013
    782
    114
    490e-12 * 330 = 161700e-12 = 161.7e-9 = 162 nSec.

    You are right, I am off by a factor of 1000, so never mind.

    Bob
     
  13. crutschow

    Expert

    Mar 14, 2008
    13,009
    3,233
    Always tricky to locate the decimal point when using a slide-rule. ;)
     
  14. BobTPH

    Active Member

    Jun 5, 2013
    782
    114
    I did use a scientific calculator by use -9 instead of -12 for pico.

    Bob
     
  15. MagicMatt

    Thread Starter Member

    Sep 30, 2013
    117
    14
    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
     
  16. THE_RB

    AAC Fanatic!

    Feb 11, 2008
    5,435
    1,305
    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.
     
  17. MagicMatt

    Thread Starter Member

    Sep 30, 2013
    117
    14
    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. ;)
     
Loading...