Gate and pull-down resistor values for MOSFET and Arduino Nano

Hi, I've got two projects ongoing and in both run into this issue. So I'm using Arduino Nano r3 with MOSFET IRF540n to control following devices (FET connected to Arduino's PWM pin):

  1. Mist maker: 24V 0.6A
  2. Fan: 12V 0.2A
  3. Led strips: 12V 1.6-2.5A per channel.

Many of the example projects I've seen don't have neither pull-down gate resistor, nor the resistor between gate and arduino. But I've found few posts stating that at least the latter is necessary.
So my questions are:

  1. How to calculate the value of gate - Arduino resistor for my cases (R2 on the schema)
  2. Do I need a gate pull-down resistor and if yes, how to calculate its value. (R1 on the schema)

Thanks a lot.

Screen Shot 2016-12-07 at 13.30.54.png

The IRF540N is not logic-level, so no use to you.

Also you have commoned the grounds of the two circuits - the FET source
must be attached to Arduino ground or you don't have a circuit.

Add a 10k resistor from the Arduino pin to ground, and a 150 ohm from the pin to the gate of a logic
level n-channel MOSFET. Find something more like 40V and 0.01 ohm rating, much more useful than
a 100V device (high voltage devices have much higher on resistances).

The 10k is on the pin so there isn't any voltage dividing (not actually important with these values,
but it will bite you in a soft-switching circuit with a larger gate resistor).

150 ohm gives protection to the Arduino pin (limits the inrush/outrush currents from the gate to under
40mA - MOSFET gates are highly capacitive loads).

If you want to use PWM you'll have to analyse switching losses - sometimes a MOSFET driver chip is needed
to allow efficient switching at PWM frequencies.

Thanks for the explanation! So with IRF540N I can't do any switching directly from Arduino?
I'm a bit puzzled, because I've seen the schema below and that device is working perfectly according to the author:

So if IRF540N won't work, would something like IRLZ34NPBF or as Adafruit suggests IRLB8721 be a better option?

There are, I'd guess, tens of 1000's of different MOSFETs available. Parametric search on an
electronics supplier's website is how to find components meeting your requirements. Older devices
are often more expensive and less good than newer ones, so cherishing a favorite device isn't very
sensible.

It does bug me that devices from the 60's, 70's and 80's still persist in circuit designs when there are
better alternatives available now - the 7555 is better than the 555, the 741 opamp is hopeless by
modern standards, everyone uses the 2N2222 (because the partnumber is easy to remember!)...

About the only ancient devices that are still cool in my eyes is the LM339 quad comparator (its
a decent fastish low power comparator that generally just works), erm, that's probably it.

[ don't get me started on the 2N3055! 3A into the base??? Whaaaaat? ]

Don't get me wrong here, I'm hardly cherishing anything. IRF540Ns were the ones I happen to have already and seeing that schema above I thought, that they ought to work.
So basically what I need is a logic level MOSFET with Vgs = 5V, Vthresh = 0.5-1V and max current rating >20A, right?

Pretty much - if you are looking at the current rating learn not it, its not normally relevant.

Calculate the power dissipation using I-squared-R, if that's more than the device can dissipate
(with whatever heat sink you have), that's too much current anyway. These days you
normally get away without heatsinks on MOSFETs because they are so good (a few milliohms
of on-resistance), whereas the current rating represents the best the device can do at the
limit with a watercooled low-thermal-resistance mounting.

The other check you should do is on Vds for full load, what is the voltage drop between drain and
source? Add that value to the nominal Vgs.

For instance if a device was rated at 0.01 ohm at Vgs=4.5V, and you pass 100A through it, Vds
will be 1V, which means you must use at least 4.5+1.0V on the gate - ie a minimum of 5.5V,
not a minimum of 4.5V. The gate must be 4.5V above the drain as well as above the source,
to guarantee the channel region is fully formed and the resistance is as advertised.

In practice you typically don't have to worry about this unless you are pushing a device to the
limit, which is a bad bad idea in the first place. Expect Vds to be 0.25V or less in a sensible
circuit when the FET is on.

It is not that the IRF540 will not work at all, it will work "somewhat" with a 5v gate drive. Unfortunately, the "somewhat" mode puts it in a linear mode instead of switch, so you end up dumping a fair amount of heat with the FET if you are handling any current (as well as dropping a significant part of the voltage to the part you are driving). For many of the older ones, there are direct 5v drive equivalent parts - such as the IRL540 - same thing for the old IFR520 and IRL520 (note the change from an "F" to an "L" in the part number), however, as Mark points out, there are many newer and better parts available these days that are still very reasonably priced. It is a bit harder to find 3.3v drive parts not in a SMD package, but there are some out there.

Thanks a lot for the answers, they've cleared things up!

I've got another issue with transistors, so in order not to start a new topic. I'm trying to control computer fan (12V) speed with either TIP120 or IRF540N connected to PWM pin of Arduino and in both cases have the same problem.
Solution is OK to switch fan on or off, but fails to control the speed in a correct way, i.e. if I write to PWM pin anything with [1; 254] range, the fan does slow down, but also starts to emit high frequency electric noise. Yet, all the tutorials I've found online were suggesting to use TIP120 to control fan or DC motor. I've tried 3 different fans with no luck. What am I doing wrong?

Use a 4-pin computer fan.
The PWM pin of a 4-pin fan can be driven directly with an Arduino PWM pin.
Nothing else needed.

Fan to +12volt and ground.
Arduino to fan PWM input and fan ground.

The tach pin can be used to read RPM.
Leo..

Thanks, that's one way to go. But all the fans I've got are 3 pin ones and after reading numerous tutorials I was under impression that one can control regular computer fan speed with Arduino PWM + some transistor.

"but also starts to emit high frequency electric noise" Do you mean you are getting lots of EMI you are hearing on nearby radios etc. or are you hearing high frequency sound with your ears? If we are talking sound, that is not unusual with many things when you feed them some sort of AC (especially if they were designed for straight DC). That is part of the reason most switching supplies are running well above the audible range (and cores are smaller for higher frequencies etc.). Several things you can do if you are talking sound. You can run at a lower frequency for the PWM which may make it less noticeable. You can also put a small capacitor on the gate of the FET (you are driving the FET gate through a resistor right?). That will slow down the turn on/off speed which may help. The downside of that is that it also increases losses in the FET as it is spending more time in the linear region.

Yes, I've meant the audible noise. I've got two setups, on one fan is powered with 9VDc PSU via DC-DC step-up module, which raises it to 12V and is controlled with TIP120, 1K resistor between base and Arduino. Other setup: fan powered directly from 9VDC PSU and controlled with IRF540N with a 150 Ohm resistor.

Both setups exactly the same result. 100% ON and OFF states – fine, anything in between makes noise.

By "lower frequency for the PWM" do you something like in this topic?

That appears to address the frequency issue (I use PWM for my project, but do it differently with about a 3 second cycle time so I had not run into that issue). Seems odd they would not have an easy way to change the frequency though.

antti_s:
I've got another issue with transistors, so in order not to start a new topic.

What is wrong with starting a new topic? Part of the purpose of the forum is that people with similar problems can search the archives. Hijacking your own topic mixes things up the same as if you were hijacking someone else's topic.

I've unintentionally just proved, that gate pull-down resistor is a must for IRF540N.
Setup: 9V PSU, positive to fan, negative to FET's source, fan's negative to FET's drain. Now if I promptly touch the gate with my finger, FET closes completely and if I touch with my finger for a second – it opens completely.
Can anybody explain why I can do that with my finger, given that I'm not touching anything else?

...and with pull down resistor the abovementioned scheme doesn't work.

What is wrong with starting a new topic?

Nothing, but last time I've done that, I've been accused of cross-posting.

If you switch a 3-pin fan low-side (ground wire) with a TIP120 darlington, be prepaired to "loose" ~1.5volt across the transistor. So use a 13.5volt supply for a 12volt fan.
That IRF540N mosfet is not a logic fet, so it might or might not work with an Arduino.

If you switch a fan low-side, you can't use the tach output.
If you want to use the tach output, use a high-side switch (P-channel fet).
Picture#3 on this page.

You don't need a logic level fet for high-side switching.

3-pin fans should be PWM-ed at a frequency that is outside human hearing.
~30Hz is common but can cause "knocking". You could also try ~25kHz.
Leo..

Thanks, so I'll try today changing PWM frequency.
As for tach output – I don't need it, all I need is switching fan between these there modes: OFF / Full power / Night mode (which means the max revs I can get with the fan not making any 'air' noise). So it's the latter mode I can't still get to work.

Wawa:
3-pin fans should be PWM-ed at a frequency that is outside human hearing.
~30Hz is common but can cause "knocking". You could also try ~25kHz.
Leo..

You may find that 25khz drives any pets in your house nuts. Years ago we were down at the south rim of the Grand Canyon and I walked into one of the little shops there. I could hear the motion sensor transmitters (my hearing was much better then!!). The shop owner asked me what I was looking at and I asked him why the ultrasonic transmitters were on during the day. He laughed and explained that many people did not believe his sign on the front door about no pets, but with the transmitters on, dogs would refuse to come in the store (which puzzled the owners who could not read (or figured it didn't apply to THEIR pets)). Pretty funny actually, but it is a consideration since animals can typically hear higher frequencies than humans.

25kHz is the standard frequency for all computer CPU fans.
There is ofcource a difference between the tiny level a fan makes and the high level an ultrasound transducer makes. I think OP doesn't have to worry about using that frequency.

TV remotes worked with 40kHz ultrasound in the seventies.
We had a dog at work that ran the hinges out of the door when you used the remote.
Motion sensors also worked with that same frequency.
They compared the returned frequency with the original to find any doppler frequency from moving objects.
I still remember that they came in the shape of a book, to be hidden in plain sight on the bookshelf.
Leo..