Best mosfet for switching DC from 5v Arduino pin.

Thanks for all your information, but I don't understand it all.
I made a drawing showing what I want to do, this is the basic principle...

How I switched some leds a couple of years ago was this way.
I used a IRF540N that came with the Arduino starters kit.
It worked perfect, did not get hot, I used it with 12v, 3A...

I now want to make an switching board that I can install in all kind of places for switching DC.
Someone advised me a modern logic mosfet instead of the old IRF540N.
He advised me this one...
IRLZ34NPBF
datasheet:http://www.irf.com/product-info/datasheets/data/irlz34npbf.pdf
Would this work the way I show for loads under 68 watt?

But I may need more than 68 watt, I gues a max. of 48v, 2-4A.
Thats around 100-200 watt.
So I thought, for $1,- I buy a more heavy mosfet to switch a little bit more in case I need it.
I can't understand all those datasheets, I see so much graphs.
Can I simply ask whats the biggest mosfet I can easily use the way I drawed?
No one of the mosfets I posted above?
As far as I know they are all logic level's.

The power you can switch is NOT the power rating of the mosfet. A mosfet can switch much more power than it dissipates if it is selected properly and driven properly. Here's a quick guide to choosing a mosfet:

  • Choose a logic level mosfet - that is, one who main specifications are given at Vgs=5v, not Vgs=10v.
  • Choose a mosfet whose Vds(max) rating is comfortably above the voltage you want to switch.
  • Choose a mosfet whose Ids(max) rating is comfortably above the current you want to switch.
  • Choose a mosfet whose Rds(on) at Vgs=5v is low enough that for the current I you want to switch, the power dissipated when the mosfet is on, given by I^2 * Rds(on), is low, for example below 5W.

I use type STP40NF10L which is rated at 100v max, 40A max, Rds(on) max = 0.036 ohm max at Vgs=5v and Id=20A. So it will comfortably drive your 48v 4A load and will dissipate only 0.6 watts in the steady state. The IRLZ34NPBF that you mention would also be suitable, but has lower voltage/current ratings and a slightly higher Rds(on), so it may get a little warmer.

1 Like

Well some of us are trying to explain the meaning of the specifications so that then you may learn and then use that new knowlege to make your own choices. However you seems to just want someone to say, "use this one, it should work fine".

Someone will undoubtedly eventually make that choice for you, but will that help you in the future when you have to again select a component from a raft of choices?

PS: that small transistor looking device in the picture of the arduino that is going to give you "more then 20ma", you are going to have to identify what it is, why you think you need it. I suspect it will not work at all as you suspect it will.

Lefty

I want to learn, but it all seems so complicated to me, mostly all the graphs.
But I try to understand.

You use the STP40NF10L. That would be a better option you say.
When I compare them I see it has a higher voltage and amp rating, that I can understand.
It has also other differences I can't understand...

The STP40NF10L has Rds(on) max "33 mOhm @ 20A, 10V" The IRLZ34NPBF has "35 mOhm @ 16A, 10V"
I don't understand this, your talking about 0.036 ohm max at Vgs=5v and Id=20A.
What does this digikey spec tells me, and wich would be better, lower Ohm's?

There are more differences...
The STP40NF10L has "Vgs(th) (Max) @ Id" = "2.5V @ 250µA"
The IRLZ34NPBF has "2V @ 250µA"
Vgs should be as low as posible I believe?
The STP40NF10L has "2.5V @ 250µA" the IRLZ34NPBF has "2V @ 250µA"
The STP40NF10L has a higher Vgs? That means thats a plus for the IRLZ34NPBF?
Another spec,
Gate Charge (Qg) @ Vgs, STP40NF10L has "64nC @ 5V" the IRLZ34NPBF has "25nC @ 5V
"
Does that mean the IRLZ34NPBF need less than half the power to switch than the STP40NF10L?
Thats another plus for the IRLZ34NPBF?
Another spec...
Input Capacitance (Ciss) @ Vds, The STP40NF10L has "2300pF @ 25V", the IRLZ34NPBF has "880pF @ 25V
". The STP40NF10L has much more with it's 2300pF. Does that mean how much power is needed to switch on? The IRLZ34NPBF is the better one here?

mwhens:
I want to learn, but it all seems so complicated to me, mostly all the graphs.
But I try to understand.

You use the STP40NF10L. That would be a better option you say.
When I compare them I see it has a higher voltage and amp rating, that I can understand.
It has also other differences I can't understand...

The STP40NF10L has Rds(on) max "33 mOhm @ 20A, 10V" The IRLZ34NPBF has "35 mOhm @ 16A, 10V"
I don't understand this, your talking about 0.036 ohm max at Vgs=5v and Id=20A.
What does this digikey spec tells me, and wich would be better, lower Ohm's?

Yes lower Ron is better, but very little differenc .033 ohms Vs .035 ohms, and your using it at 4 amps load, so no reason to pick one over the other just on this specification alone.

There are more differences...
The STP40NF10L has "Vgs(th) (Max) @ Id" = "2.5V @ 250µA"
The IRLZ34NPBF has "2V @ 250µA"
Vgs should be as low as posible I believe?
The STP40NF10L has "2.5V @ 250µA" the IRLZ34NPBF has "2V @ 250µA"
The STP40NF10L has a higher Vgs? That means thats a plus for the IRLZ34NPBF?

No, all should be looked at at what the Ron and current flow allowed with 4.5 to 5vdc on the gate. These threshold values all fall in the 'logic level mosfet' catagory, again no deal breaker or maker here.

Another spec,
Gate Charge (Qg) @ Vgs, STP40NF10L has "64nC @ 5V" the IRLZ34NPBF has "25nC @ 5V
"
Does that mean the IRLZ34NPBF need less than half the power to switch than the STP40NF10L?
Thats another plus for the IRLZ34NPBF?
Another spec...
Input Capacitance (Ciss) @ Vds, The STP40NF10L has "2300pF @ 25V", the IRLZ34NPBF has "880pF @ 25V
". The STP40NF10L has much more with it's 2300pF. Does that mean how much power is needed to switch on? The IRLZ34NPBF is the better one here?

Both those spec give an indication of how much charging and discharging current the arduino output pin has to supply to make the mosfet switch from on to off and off to on. Lower capacitance is better in this case and I would make it the deciding factor if all other specs meet the application.

Again I'm concerned about that small transistor you show in your picture. One usually tries to drive a power mosfet directly from the arduino output pin to the gate of the mosfet. Arduino ground must be wired to the external power supply negative terminal. Lastly it's a good idea to wire a 10k ohm resistor directly from the gate to source terminal on the mosfet. This will insure the mosfet turns off if you happen to turn off power to the arduino, but external power for the mosfet load is still on.

Ok, a little bit more clear now, thanks.

I was thinking about putting on all output pins of the arduino an small transistor.
If all outputs would be high, the Arduino can't power everything I think. To be sure of this, I tought, why not boost it with an transistor.
Can that be a problem?
How much current wil an mosfet use normally? 2mA or something?

Good idea about the resistor.
Any other ways to make it an safer switch circuit?
Some spook about fuses and zenerdiodes and resistor on the gate, don't know what it all does, or if it's usefull.
But I like to be on the safe side.

Ok, I now know it is thermal watts. But how much would the IRLZ34NPBF be capable of switching, and how much thermal watts would make for example the 48v 4A?

And also, the 5v and ground from the Arduino will be provided by a long (around 5-20meter) Cat6 cable. That would be ok right?

mwhens:
Ok, a little bit more clear now, thanks.

I was thinking about putting on all output pins of the arduino an small transistor.
If all outputs would be high, the Arduino can't power everything I think. To be sure of this, I tought, why not boost it with an transistor.
Can that be a problem?

Yes it can be, depending on how you wire up the transistor, what kind (NPN or PNP or mosfet), and if you mind if there is a logic inversion as a result of adding this 'driving transistor'. Not saying it can't be made to work if wired correctly, just that your picture won't work, and it shouldn't be needed.

How much current wil an mosfet use normally? 2mA or something?

Once the mosfet is fully on or off it draws 0 (yes zero!) ma from the output pin, it just draws current during charging and discharging the mosfets gate on the transition of turning on to off or off to on. Some people like to put a 200 ohm series resistor between the output pin and the mosfet gate to limit the peak current to protect the output pin, but it probably would work fine without it.

Good idea about the resistor.
Any other ways to make it an safer switch circuit?
Some spook about fuses and zenerdiodes and resistor on the gate, don't know what it all does, or if it's usefull.
But I like to be on the safe side.

Well resistor in series with the gate we just talked about. Fuse on your external power supply always a good idea, unless it already has automatic overcurrent shutdown protection. No zener needed anywhere.

Ok, I now know it is thermal watts. But how much would the IRLZ34NPBF be capable of switching, and how much thermal watts would make for example the 48v 4A?

Power dissapation is a hard thing to calculate, but most of the loss is the I squared R loss, where I is the load currect and R is the Ron resistance of the mosfet when it's turned on. Other losses are the transision losses developed during the short periods between turning on to off and off to on, so are related to the PWM switching speed being used. The Arduion PWM switching frequency is under 1khz I think, so I would think you can ignore it. Make no mistake thermal watts dissapation is the limiting thing that keeps one from using a 40 amp rated mosfet at 40 amps actual load, only with massive heat sink with fan cooling would one reach the current limit. Heat is the limiting factor. However at 4 amps you probably won't even feel them warm up, or very little. If you can touch them and it doesn't raise a blister, then you are OK. :wink:

And also, the 5v and ground from the Arduino will be provided by a long (around 5-20meter) Cat6 cable. That would be ok right?

That is a pretty long distance. I would check out the system using short (under 1 foot) first to see if everthing works ok. Then later try a longer run and check if mosfets get too much hotter or not. You can always add simple 8 pin DIP mosfet gate driver chips to support longer cable runs if they are required.

Where can I find a tutorial about using a mosfet gate driver?
Does it need any extra power supply?
Is it easy to use?

mwhens:
Where can I find a tutorial about using a mosfet gate driver?
Does it need any extra power supply?
Is it easy to use?

Yes pretty easy, signal input, signal output, power and ground. Your Arduino +5vdc would power one fine, most have two channels in a single 8 pin package, so you can use it for two digital output/mosfets per package. You would look for the "low side driver non-inverting" varity:

http://www.ti.com/lit/ml/slub005a/slub005a.pdf

Certainly other manufactures offer similar chips. I bought some cheap on E-bay several years ago, forget the device number and don't want to try and find them at this time. :wink:

Again I would test without it and only look into them if the long cable run turns out to be a problem.

The short answer is that both the IRLZ34N and the STP40NF10L are suitable for your application. You don't need a mosfet driver for your application, you can drive them directly from an Arduino pin through a series resistor in the range 100 to 220 ohms, with a 10K to 100k resistor connected from the pin to ground to ensure the mosfet is off when the Arduino powers up and the pin hasn't yet been set to be an output.

Regarding the switching time, the important factor is the total gate charge at the source-drain voltage you are switching. This charge is made up of the gate-source charge, which is more or less constant, and the gate-drain charge, which increases with voltage because of the Miller effect. So when you see that the total gate charge is greater for the STP40NF10L than for the IRLZ34N, part of the reason for this is that the total gate charge for the STP40NF10L is quoted at Vds=80v but for the IRLZ34N it is quoted at 44v. However, even allowing for this, the IRLZ34N has lower total gate charge when switching 48v.

You can calculate an order-of-magnitude estimate for the switching time using the formula t = QR/V where Q is the total gate charge, R is the series resistor and V is the gate voltage you are using. You only need to use a MOSFET driver if you need the switching to be faster than this figure, bearing in mind that you don't want R to be less than about 100 ohms.

Ok, I will test it first.

But I want to know about the capacitance of the mosfets.
It seems, if you want an low resistance/high efficiency mosfets, the capacitance goes up.
A small capacitance, and the resistance is getting higher.
Also a higher voltage will make the capacitance allot higher.
I need to find a good balance between the two.
the STP40NF10L seems like a good balance, but does have more capacitance than IRLZ34NPBF.
But I want some more voltage, the IRLZ34NPBF goes to 55v, close to my 48v.
So to have more headroom my first shoice goes to the STP40NF10L.
But how translate those capacitance into mA?
When the mosfet is charging, how much current is flowing for a 880pF @ 25V capacitance?
I gues no matter how high the capacitance, they all switch fast enough for PWM, but just use more current to switch?
How can I calculate how high the capacitance can go?
And I gues I can't measure it with a multimeter because of the short peaks?

mwhens:
But I want to know about the capacitance of the mosfets.
It seems, if you want an low resistance/high efficiency mosfets, the capacitance goes up.
A small capacitance, and the resistance is getting higher.
Also a higher voltage will make the capacitance allot higher.
I need to find a good balance between the two.
the STP40NF10L seems like a good balance, but does have more capacitance than IRLZ34NPBF.
But I want some more voltage, the IRLZ34NPBF goes to 55v, close to my 48v.
So to have more headroom my first shoice goes to the STP40NF10L.
But how translate those capacitance into mA?
When the mosfet is charging, how much current is flowing for a 880pF @ 25V capacitance?
I gues no matter how high the capacitance, they all switch fast enough for PWM, but just use more current to switch?
How can I calculate how high the capacitance can go?
And I gues I can't measure it with a multimeter because of the short peaks?

Ignore the capacitance, concentrate on the total gate charge. The peak current when charging the gate is (5v - a_little)/R where R is the series resistor. That's the point of having a series resistor, and why it shouldn't be less than 100 ohms - you don't want to exceed 40mA output per Arduino pin.

I agree that 55v is uncomfortably close to the 48v you are switching - particularly as the 48v supply is probably unregulated, in which case it may be somewhat higher than 48v when all the LEDs are off.

To get a very rough estimate for the switching losses:

  • Calculate the approximate switching time using the formula I gave earlier
  • Multiply this by 2 (to allow for both switch on and switch off) and then by the PWM frequency
  • For a resistive load, multiply this by the power in the load when the mosfet is on, and divide by 4

In fact for your LED+series resistor load, if most of the 48v is dropped across the LEDs then the switching losses will be much less than this figure.

Thanks for your help, but that to complicated for me.
The only thing I'am not sure of is how much current a mosfet use from the Arduino pin.
Can someone show how to calculate the current peak with for example this mosfet?
http://www.st.com/internet/com/TECHNICAL_RESOURCES/TECHNICAL_LITERATURE/DATASHEET/CD00003023.pdf

The peak current when charging the gate is (5v - a_little)/R where R is the series resistor. That's the point of having a series resistor, and why it shouldn't be less than 100 ohms - you don't want to exceed 40mA output per Arduino pin.

I understand how to limit the current. But as everyone is saying, you need to drive the mosfet so that it has enough current. But how do I know whats enough.
If I can booste the Arduino pins to 250mA, would that be allot better for some mosfets, and get less hot?
If I do not use a series resistor, thats best for the mosfet?

One Arduino pin may be good for a 40mA peak, but If i use 20 outputs with mosfets, it can't deliver that 40mA anymore on each pin.
Thats why I was thinking about using a small transistor to make each pin 250mA ( I used this transistor to power some 5mm leds that one pin could not provide, and that worked perfect with PWM)
I don't see way this would not work with a mosfet.

The 40mA rating for Arduino pins is an "absolute maximum" rating - you should not be going near than value, 25mA is a reasonable limit to ensure reliable operation and prevent the chip dying. For most "abs max" ratings you want to back off by a significant factor, not go near the limit (its the point when some chips start to get permanently damaged - also most max ratings are for single exposure, not repeated...)

If there is a "continuous" rating or "recommended" rating, use that, not the abs max.

For the same reason using a 55V MOSFET for 48V isn't safe - switching transients can be as much as the supply voltage due to stray inductance in wiring, so in general 48V load means 100V rated MOSFET. Don't skimp on ratings, things will fail.

MarkT:
The 40mA rating for Arduino pins is an "absolute maximum" rating - you should not be going near than value, 25mA is a reasonable limit to ensure reliable operation and prevent the chip dying. For most "abs max" ratings you want to back off by a significant factor, not go near the limit (its the point when some chips start to get permanently damaged - also most max ratings are for single exposure, not repeated...)

Current limits per pin are normally the result of local thermal limitations, so drawing 40mA or even a bit more for a very short period (we are talking about less than 1 microsecond here) isn't going to damage the device. Drawing 40mA from a pin continuously is a different matter.

MarkT:
For the same reason using a 55V MOSFET for 48V isn't safe - switching transients can be as much as the supply voltage due to stray inductance in wiring, so in general 48V load means 100V rated MOSFET. Don't skimp on ratings, things will fail.

Both the power mosfets we are talking about are avalanche rated and can drive significant inductive loads without a protection diode, so that doesn't apply here.

mwhens:
I understand how to limit the current. But as everyone is saying, you need to drive the mosfet so that it has enough current. But how do I know whats enough.
If I can booste the Arduino pins to 250mA, would that be allot better for some mosfets, and get less hot?
If I do not use a series resistor, thats best for the mosfet?

The switching time for those mosfets driven from an Arduino pin via 100 to 220 ohms works out at less then one microsecond. So if your PWM frequency is 10KHz or less, we are talking about switching losses of less than 1% of the load power. OTOH if you use a PWM frequency of 100kHz, the losses could be nearer 10% and you would need either a mosfet driver or large heatsinks on the mosfets.

According to the reference, the default PWM frequency is around 490Hz. So the switching losses will be low and you definitely do not need mosfet drivers. If you're worried about the total peak current supplied by the chip when switching lots of mosfets from different pins, you could increase the gate resistors to 470 ohms.

dc42:

MarkT:
The 40mA rating for Arduino pins is an "absolute maximum" rating - you should not be going near than value, 25mA is a reasonable limit to ensure reliable operation and prevent the chip dying. For most "abs max" ratings you want to back off by a significant factor, not go near the limit (its the point when some chips start to get permanently damaged - also most max ratings are for single exposure, not repeated...)

Current limits per pin are normally the result of local thermal limitations, so drawing 40mA or even a bit more for a very short period (we are talking about less than 1 microsecond here) isn't going to damage the device. Drawing 40mA from a pin continuously is a different matter.

One failure mode from excess current is electromigration - unless the datasheet makes it clear the abs-max rating is a thermal one we cannot make such an assumption. Also high switching currents could overload the on-chip decoupling leading to unpredictable behaviour.

MarkT:
For the same reason using a 55V MOSFET for 48V isn't safe - switching transients can be as much as the supply voltage due to stray inductance in wiring, so in general 48V load means 100V rated MOSFET. Don't skimp on ratings, things will fail.

Both the power mosfets we are talking about are avalanche rated and can drive significant inductive loads without a protection diode, so that doesn't apply here.

Avalanche breakdown in MOSFETs is the situation when they dissipate the most power and is the easiest way to blow them up - unless you are sure you can calculate the energy dissipation correctly its much wiser to use conservatively rated devices (certainly at high voltages where pulse energies are much bigger).

MarkT:
Avalanche breakdown in MOSFETs is the situation when they dissipate the most power and is the easiest way to blow them up - unless you are sure you can calculate the energy dissipation correctly its much wiser to use conservatively rated devices (certainly at high voltages where pulse energies are much bigger).

Agreed - but you were talking about transients caused by stray inductance, so the energy we are talking about is tiny.

I'm interested in doing something similar, can any one tell me which transistor the OP is using to amplify the 20mA to 240mA with the PWM signal...

Is the diagram correct, on the first page, I really don't want to blow anything up.

Thanks