transistor IRF 540: which resistor on gate?

Hi guys!
I implemented a little circuit for managing a light bulb (12 V , 0.6A) through my arduino mega.
I used a transistor IRF 540. The intensity of light is managed through a pwm pin connected to the transitor's gate, while the supply is extern (in attachment my diagram).
The question is: do I have to put a resistor between the pin and the gate? I tried with a 1k transistor and without, and the device works in both configuration. So, I was wonder which is the role of this resistor, because I saw a lot of tutorials: someone use no resistor, someone use 330 ohm, someone 1k,... I'm a little bit confused.
Thanks!

You should use a resistor on the gate.

The problem is the MOSFET gate looks like a "big" capacitor (relative to what the Arduino expects to see), and it takes a short burst of current to charge it up and turn on the MOSFET (and the same for discharging it when turning it off). This short burst of current can easily be higher than is safe for the Arduino. So it looks like it works, but in reality you may be slowly damaging the Arduino pin driver through these repeated bursts of high current.

If 1k works, use 1k. The only tradeoff is that the higher the resistor, the longer it takes to turn on the MOSFET. But we are talking differences of a few microseconds. If you are lighting an LED, it just doesn't matter.

--
The Ruggeduino: compatible with Arduino UNO, 24V operation, all I/O's fused and protected

Be aware that then IRF540 isn't really right for driving direct from an Arduino pin through a resistor because it doesn't have logic level gate drive. However, if you are only switching 0.6A then you will probably get away with it. The symptoms of not getting away with it would be the LEDs not coming on a full brightness and the mosfet getting hot.

1K is much higher than would normally be used, 100 to 150 ohms is more usual. However, as you are only switching 0.6A, it doesn't matter if the switching is a little slow so the value is not critical.

To explain further - a logic-level FET is one that is fully on at 4.5V of gate drive, at all temperatures and load-currents. In the datasheet look for the Rds(on) being quoted for "Vgs=4.5V" (or sometimes at 5V).

If you see "threshold voltage" ignore this, its the point the device turns fully off, not on.

With non-logic MOSFETs its common for the Vgs to be quoted at 10V and the threshold to be 2 to 4 V. The large variation in threshold means you might be lucky or unlucky depending on the batch of wafers the MOSFET came from. Logic level MOSFETs have thresholds more like 0.5 to 1V.

If you see "threshold voltage" ignore this, its the point the device turns fully off, not on.

Not exactly. The threshold voltage is that voltage that allows the mosfet to just start to conduct current, perhaps at just milliamps of source/drain current flow. It would take a voltage less then the threshold voltage to guarantee that the device is fully turned off.

Either way, your correct in that it is not the proper spec to use to see if the device can work to maximum (minimum Ron) current at arduino supplied gate voltage.

Lefty

If you're driving a DC motor, 250uA is "fully off". Conceptually the threshold voltage is the actual off-point, on datasheets they standardise on a small (a few ppm of the full load) current to mask such effects as leakage - I think I'm justified in being this liberal with my language.

Another possibillity is to use an optocoupler like this

http://www.bristolwatch.com/ele/opto_isolated.htm

I have been warned though, that if Vcc is too high you have to use a voltage divider, because the gate voltage could be to high, but 12 V should be OK

I have used that because I had some IRF540 in the drawer (and as an experiment). Furthermore I put a resistor from gate to ground, because I wanted to be sure that the motor I was using didn't start before I wanted it.

MarkT:
If you're driving a DC motor, 250uA is "fully off". Conceptually the threshold voltage is the actual off-point, on datasheets they standardise on a small (a few ppm of the full load) current to mask such effects as leakage - I think I'm justified in being this liberal with my language.

Well we can agree to disagree. I says it's threshold as in threshold of conduction, you say as in threshold of cut-off. So how many angles can dance on the head of a pin? In the world of MOSFET datasheets, where the term originates from, 250ua is not 'fully off', but rather the current level at which to measure and establish the threshold specification and it's possible variation from device to device.

If in the world of motors, if 250ua is fully off, what would one call 500ua, not so fully off?

Lefty

Actually Vt is theoretically the best fit for the FET equations for sub-threshold, linear and saturation modes, which may each be a bit different. Since its temperature and aging sensitive its a fairly imprecisely specified value anyhow, so measuring/defining it at 250uA, 1uA or 5mA makes little practical difference. Perhaps the best working definiton is the change-over from sub-threshold conduction to the linear or saturation modes. Motors than can run on 5mA let alone 500uA are a rare and select breed!