Arduino Forum

Using Arduino => General Electronics => Topic started by: JimboZA on Mar 22, 2015, 09:08 am

Title: [sorted] Tesla member but never used a MOSFET: clarity please?
Post by: JimboZA on Mar 22, 2015, 09:08 am
Last visit to my preferred supplier I picked up a couple of IRL520N (http://www.mantech.co.za/datasheets/products/IRL520N.pdf) logic level mosfets. I've never used a mosfet before.

If I want to use one connected to an Arduino digital output does it need a current limiting resistor on the base oops I mean gate?
Title: Re: Tesla member but never used a MOSFET: clarity please?
Post by: TomGeorge on Mar 22, 2015, 09:15 am
Hi,
JimboZA, I usually use a 470R, no matter what the design along with 10K gate to source.

http://irf.custhelp.com/app/answers/detail/a_id/215

Tom...... :)
Title: Re: Tesla member but never used a MOSFET: clarity please?
Post by: Coding Badly on Mar 22, 2015, 09:25 am

I have used them without.  But it's a not a good idea.  There is a brief surge of current when the MOSFET is switched which may damage the pin.  Anything to keep the current below 20mA will work.

Grumpy_Mike occasionally publishes a simple current-limiting circuit for LEDs (two transistors + resistor).  That circuit works great with a MOSFET (plus transistor and resistor).  I highly recommend it as a first circuit.

Title: Re: Tesla member but never used a MOSFET: clarity please?
Post by: Paul__B on Mar 22, 2015, 11:53 am
JimboZA, I usually use a 470R, no matter what the design along with 10K gate to source.
Actually, it should not be a 10k gate to source, but Arduino output to ground. You do not want a potential divider - however minor - between the Arduino and the FET.
Title: Re: Tesla member but never used a MOSFET: clarity please?
Post by: JimboZA on Mar 22, 2015, 12:17 pm
The difference between reply 1 and reply 3 being on which side of the gate resistor the resistor to source / ground goes?

Would one of you guys mind doing a quick sketch when you have a moment?
Title: Re: Tesla member but never used a MOSFET: clarity please?
Post by: TomGeorge on Mar 22, 2015, 12:31 pm
Hi,
At your service.

Tom..... :)
Title: Re: Tesla member but never used a MOSFET: clarity please?
Post by: JimboZA on Mar 22, 2015, 12:58 pm
Thanks Tom... so @Paul, you would prefer the vertical resistor (Tom's G-S one) to be on the left of the current limiter?

Tom's pic:

(http://forum.arduino.cc/index.php?action=dlattach;topic=310202.0;attach=119559)

Title: Re: Tesla member but never used a MOSFET: clarity please?
Post by: MarkT on Mar 22, 2015, 02:17 pm
Last visit to my preferred supplier I picked up a couple of IRL520N (https://www.robotics.org.za/datasheet/IRL520N.pdf) logic level mosfets. I've never used a mosfet before.

If I want to use one connected to an Arduino digital output does it need a current limiting resistor on the base oops I mean gate?
Its not an easy question to answer definitively.  The Arduino outputs are rated at an
absoute max of 40mA, yet will be designed to handle a certain amount of capacitive load
(although how much isn't given in the datasheet).  Capacitive loads will mean brief
spikes of current as the outputs switch which could exceed 40mA, but last a few
nanoseconds.

So a small MOSFET with a few hundred pF of gate capacitance might be quite OK
to drive directly.  But what the maximum capacitive load is before a resistor should be
used is unclear.  Most modern MOSFETs have more gate capacitance that you would
expect to see on a logic signal (measured in nanofarads) so a resistor is generally
advised.  150 ohms is a good value, since the lower the better for switching speed.

If you have a beefy MOSFET and want to switch it fast, you should always consider
a MOSFET driver chip which boosts the current output to much higher levels safely,
reducing switching losses and appearing as a standard logic load to the microcontroller.
Title: Re: Tesla member but never used a MOSFET: clarity please?
Post by: JimboZA on Mar 22, 2015, 03:22 pm
I'm finding that the 10k pull down is mandatory: if I tickle the "G" the led (above the mosfet, between +ve and "D", "S" to ground) comes on but stays on when the 5V is removed, unless I have that pull down.

Is that normal for mosfets?
Title: Re: Tesla member but never used a MOSFET: clarity please?
Post by: MarkT on Mar 22, 2015, 03:33 pm
Absolutely - the gate is one plate of a capacitor, that's why they are called "field effect
transistors" as the electric field between gate and channel is responsible for the thickness
of the induced channel which allows current to flow between source and drain.

The charge on the gate mirrors the charge forming the conducting channel (charge carriers
overwhelm the natural p or n-type of the channel to the opposite sign).

Since the gate is isolated on a thin layer of quartz (silicon dioxide) it will hold its charge for
quite a while.
Title: Re: Tesla member but never used a MOSFET: clarity please?
Post by: JimboZA on Mar 22, 2015, 03:46 pm
Ah ok thanks Mark... I was wondering about capacitance. I actually turned all the power off, and when I reapplied it (but with nothing tickling the gate) the LED was on again. I took a while for it to go off and I said to myself, self, this is a capacitor.

Right then, the mystery of MOSFETs is sorted, at least as much as I need to know.
Title: Re: Tesla member but never used a MOSFET: clarity please?
Post by: MarkT on Mar 22, 2015, 03:55 pm
Another thing worth mentioning is that power MOSFETs are very unlike logic circuit
MOSFETs.  They use vertical current flow (the substrate is the drain), there is an
integral diode between source and drain that is part of the 3D structure of the device,
the gate voltage relative to the source is the important thing (gate to drain voltage
has little effect on behaviour).  On resistances of 0.001 ohm or lower are possible!

Logic MOSFETs are completely symmetrical, source and drain are interchangable,
and the substrate has to be kept at one of the supply rails to remain isolated.  On
resistances in MOSFETs in a typical processor are measured in k-ohms (but
gate capacitances in fF (femto farads)...)

Chips with integrated DMOS MOSFETs are a hybrid between the two - current flow
is horizontal since the drains have to be isolated from the substrate, and thus
the on-resistance is significantly higher than with discrete power MOSFETs (down to
about 0.2 ohms)
Title: Re: [sorted] Tesla member but never used a MOSFET: clarity please?
Post by: JimboZA on Mar 22, 2015, 04:14 pm
One other thing just struck me, and that's due to the word "gate" as distinct from "base" in bjt-speak.....

Are mosfets thus switches always?- whereas a bjt is only a switch when it's saturated and otherwise is an amplifier?

Title: Re: [sorted] Tesla member but never used a MOSFET: clarity please?
Post by: MarkT on Mar 22, 2015, 04:21 pm
power MOSFETs originally were analog amplifiers, but the switching use
has come to dominate as all power electronics today is switchmode, more
or less.  Modern power MOSFETs are optimised for switching, not for low
distortion.

I think the gate/base difference was purely to have a different name and prevent
confusing circuits designed for FETs being used for BJTs and vice versa.  Although
SCRs also have gates, so its not particularly consistent.

The base was named after the early transistor design which had a sliver of silicon with
two dopant areas diffused in from opposites sides, nearly meeting in the middle, the
sliver was the base in a mechanical sense...

Incidentally IGBT's have gate/emitter/collector....
Title: Re: [sorted] Tesla member but never used a MOSFET: clarity please?
Post by: Paul__B on Mar 22, 2015, 11:39 pm
Thanks Tom... so @Paul, you would prefer the vertical resistor (Tom's G-S one) to be on the left of the current limiter?
Yes, because as first stated, you do not want a potential divider reducing in any way the voltage applied to the gate.

It may be a small point, but - why not do it properly?

The term "gate" is more appropriate for FETs as that is what it is - it controls; opens and closes the path from source to drain, like a tap or valve.

The action of a transistor is quite different - it amplifies the current you feed into the base; this is the beta (ß) parameter.  The ß of a FET is almost infinite as virtually no current is drawn by the gate (except of course, to charge it up); it has instead a voltage/current transfer factor or "transconductance" like a (thermionic) valve (translation for Yanks: vacuum tube).
Title: Re: [sorted] Tesla member but never used a MOSFET: clarity please?
Post by: nickgammon on Mar 23, 2015, 06:37 am
I did a page about driving stuff with MOSFETs: http://www.gammon.com.au/motors (http://www.gammon.com.au/motors).

It shows current sources and sinks, plus calculations for heat dissipation etc.
Title: Re: [sorted] Tesla member but never used a MOSFET: clarity please?
Post by: KeithRB on Mar 23, 2015, 05:33 pm
In other words the transfer parameter for bipolars is the unitless Ic/Ib, while the Fet's is Id/Vg, which has the unit of mho or sieman - the reciprocal of ohms.
Title: Re: [sorted] Tesla member but never used a MOSFET: clarity please?
Post by: krupski on Mar 23, 2015, 08:57 pm
Last visit to my preferred supplier I picked up a couple of IRL520N (https://www.robotics.org.za/datasheet/IRL520N.pdf) logic level mosfets. I've never used a mosfet before.

If I want to use one connected to an Arduino digital output does it need a current limiting resistor on the base oops I mean gate?
Most everyone will tell you you need a series resistor to absorb the "current spike caused by charging and discharging the gate capacitance (and fighting the Miller effect)".

However, that is completely wrong. The mosfet drivers in the AVR chip are basically voltage controlled resistors (i.e. mosfets!). The way to damage them is to overheat them. But the current spike caused by driving a mosfet gate is SO short in duration that you will never even begin to warm the output drivers, let alone damage them.

Also, a series resistor will slow down the switching time of the mosfet you are controlling your load with and keep IT in the linear region longer, resulting in a higher power dissipation in the mosfet.

What resistor to use? 0 ohms.
Title: Re: [sorted] Tesla member but never used a MOSFET: clarity please?
Post by: pito on Mar 23, 2015, 10:51 pm
Quote
However, that is completely wrong.
If you work in electronics for some time you are maybe aware of something called "good engineering practice".

If Atmel claims the max i/o current is 20mA, then the good practice is to limit the current to be less than 20mA under any conditions.

The input capacitance of the fet is 450pF, so you may (can?, able to?) calculate easily what is the max charge/discharge current for a certain speed of a falling/rising signal edge  ;)
Title: Re: [sorted] Tesla member but never used a MOSFET: clarity please?
Post by: Paul__B on Mar 24, 2015, 03:27 am
The input capacitance of the fet is 450pF, so you may (can?, able to?) calculate easily what is the max charge/discharge current for a certain speed of a falling/rising signal edge  ;)
And further on that, it entirely depends on what you are doing with the FET.

If you are switching it on or off every ten seconds or so, it may well not be critical.  If on the other hand you are performing PWM with it, than it absolutely may be drawing these charge/ discharge currents for a significant proportion of the time.
Title: Re: [sorted] Tesla member but never used a MOSFET: clarity please?
Post by: MarkT on Mar 24, 2015, 11:59 am
You can overload a pin by vaporizing the metalization like a fuse, not just by
overheating an output transistor.  If the datasheet says absolute maximum 40mA,
that's all you have to go on (without clarification from the manufacturer).

There is also a mechnism of slow degradation by overcurrent in ICs called
electromigration. 

Moral - use those gate resistors.  If you want more current to the MOSFET gate
use a MOSFET driver.
Title: Re: [sorted] Tesla member but never used a MOSFET: clarity please?
Post by: charliesixpack on Mar 24, 2015, 02:52 pm
It is probable that the designer of the off chip driver included some means of transition rate control making a series resistor unnecessary.  The only reason for considering limiting the transition rate is to prevent spikes above VDD or below GND on inductive transmission lines with capacitive loads at the end.  The waveform at the far end of a transmission line can get ugly.
Title: Re: [sorted] Tesla member but never used a MOSFET: clarity please?
Post by: polymorph on Mar 24, 2015, 04:57 pm
Quote
Actually, it should not be a 10k gate to source, but Arduino output to ground. You do not want a potential divider - however minor - between the Arduino and the FET.
I've said that before, and inexplicably had people jump down my throat for it.
Title: Re: [sorted] Tesla member but never used a MOSFET: clarity please?
Post by: krupski on Mar 24, 2015, 07:55 pm
If you work in electronics for some time you are maybe aware of something called "good engineering practice".

If Atmel claims the max i/o current is 20mA, then the good practice is to limit the current to be less than 20mA under any conditions.

The input capacitance of the fet is 450pF, so you may (can?, able to?) calculate easily what is the max charge/discharge current for a certain speed of a falling/rising signal edge  ;)
I think 32 years as an EE counts... sorta....

Good engineering practice also includes NOT using components that are un-necessary (and who's fraction of a cent cost builds up over a large number of widgets).

For that matter, extra resistors also consume board real estate.  Cost and space are reasons not to use them commercially, the simple fact that they are not necessary is the reason not to use them on a hobby board.

I will admit that if you are using an Arduino (or any other MCU) to directly drive the gate of a mosfet AT VERY HIGH SPEEDS (like tens of megahertz) so that the R/C charge and discharge times are a substantial part of the total time, THEN yes you would want to limit the current.  But when you are turning a motor or LED array on and off several times per second to thousands of times per second, the microsecond range overcurrents will NOT heat the output drivers and will NOT hurt them in any way.

Title: Re: [sorted] Tesla member but never used a MOSFET: clarity please?
Post by: krupski on Mar 24, 2015, 07:58 pm
You can overload a pin by vaporizing the metalization like a fuse, not just by
overheating an output transistor.  If the datasheet says absolute maximum 40mA,
that's all you have to go on (without clarification from the manufacturer).

There is also a mechnism of slow degradation by overcurrent in ICs called
electromigration.  

Moral - use those gate resistors.  If you want more current to the MOSFET gate
use a MOSFET driver.
Found this link on Mr. Gammon's site: link (http://forum.arduino.cc/index.php?topic=176968)


Title: Re: [sorted] Tesla member but never used a MOSFET: clarity please?
Post by: nickgammon on Mar 24, 2015, 10:28 pm
I've said that before, and inexplicably had people jump down my throat for it.
Are you saying this is wrong?

(http://www.gammon.com.au/images/MOSFET_low_side_driver.png)

I've posted that a few times without adverse comment.

(edit) Image updated in view of comments below.
Title: Re: [sorted] Tesla member but never used a MOSFET: clarity please?
Post by: nickgammon on Mar 24, 2015, 10:29 pm
Found this link on Mr. Gammon's site: link (http://forum.arduino.cc/index.php?topic=176968)
Ah yes, 12 pages of interesting reading there. :)
Title: Re: [sorted] Tesla member but never used a MOSFET: clarity please?
Post by: CrossRoads on Mar 24, 2015, 10:35 pm
I have 32 MOSFETs on a board with only the pulldown resistor, driving them from 74hc595. Lack of series resistor does not seem to bother the shift register. No long term data to offer up tho.
http://www.crossroadsfencing.com/BobuinoRev17/ (http://www.crossroadsfencing.com/BobuinoRev17/)
(http://www.crossroadsfencing.com/BobuinoRev17/32MOSFET_board_populated.jpg)
Title: Re: [sorted] Tesla member but never used a MOSFET: clarity please?
Post by: Paul__B on Mar 24, 2015, 10:37 pm
Are you saying this is wrong?
Not "wrong" and generally workable, just not best design.

Best design should be the goal.  (Ignoring the other argument re series resistor.)
Title: Re: [sorted] Tesla member but never used a MOSFET: clarity please?
Post by: polymorph on Mar 25, 2015, 12:15 am
I'm saying that when I've suggested that the 10k pulldown should be on the Arduino side of the current limiting resistor, MOSFET or BJT, I've had a few long-time members here scorn that suggestion, as if it were a hardship to connect it so.
Title: Re: [sorted] Tesla member but never used a MOSFET: clarity please?
Post by: nickgammon on Mar 25, 2015, 12:59 am
Not "wrong" and generally workable, just not best design.

Best design should be the goal.  (Ignoring the other argument re series resistor.)

According to my calculations that voltage divider would reduce 5V output from the Arduino to 4.926V at the MOSFET. That's the objection, I gather?
Title: Re: [sorted] Tesla member but never used a MOSFET: clarity please?
Post by: nickgammon on Mar 25, 2015, 01:05 am
There's a bit of discussion here (http://electronics.stackexchange.com/questions/30017/which-configuration-is-better-for-pulling-down-an-npn-transistors-base/30044#30044).

There seems to be a bit of a feeling that unless conditions are marginal (ie. you need 5V rather than 4.9V) it wouldn't make much difference.
Title: Re: [sorted] Tesla member but never used a MOSFET: clarity please?
Post by: Paul__B on Mar 25, 2015, 05:09 am
According to my calculations that voltage divider would reduce 5V output from the Arduino to 4.926V at the MOSFET. That's the objection, I gather?
Indeed.  Why design a circuit with any performance restriction which can be avoided by simply doing it right (given that there is absolutely no performance, cost or risk penalty whatsoever of doing it right)?

Now the point here is also about the mind-set.  What is the problem?  Well, the problem is that in the reset phase, the Arduino outputs are open circuit.  It is incidentally, not a problem when it is unpowered as the protective diodes pull the lines down to the unpowered VCC rail.  But this is a problem because a floating gate on the FET may turn it at least partially on.

Here's the trick:  Is this a fault of the FET?  No!  The problem belongs to the Arduino (ATmega), so the correct approach is to pull down the Arduino pin, not the FET gate.  If you think by this stepwise reasoning, it is pretty obvious that the pull-down should be on the Arduino side.

Now here is an interesting muse on the matter of whether the series resistor is desirable.  What could be wrong with inserting a resistor in series with the gate?  Well, it is suggested that this will slow the transition of the gate voltage through the linear conduction region and having the FET only partially conducting will increase its power dissipation during the transient.  Which is indeed correct.  So then this argument, given the description of how brief this charging transient is, is inherently suggesting that it is more important to minimise the transient dissipation in the power FET, than it is to minimise the transient dissipation in the ATmega output driver.  So - which is it now?  :smiley-eek:
Title: Re: [sorted] Tesla member but never used a MOSFET: clarity please?
Post by: JimboZA on Mar 25, 2015, 05:35 am
By the way, the [sorted] in the title meant it was sorted as far as I was concerned; the rest of you feel free to carry on. The threads paid for....  :P
Title: Re: [sorted] Tesla member but never used a MOSFET: clarity please?
Post by: nickgammon on Mar 25, 2015, 07:43 am
Quote
Here's the trick:  Is this a fault of the FET?  No! 
The gratifying thing about these threads is that we progress from a good solution to a very good solution. I think I see your point here. The problem is that the Arduino pins are floating, not that the FET pins are floating.
Title: Re: [sorted] Tesla member but never used a MOSFET: clarity please?
Post by: nickgammon on Mar 25, 2015, 07:53 am
I've changed my schematic, which unfortunately means this thread makes less sense, but I have posted the image in a few places now, and would rather that the (more) correct one appears in all those places.
Title: Re: [sorted] Tesla member but never used a MOSFET: clarity please?
Post by: pito on Mar 25, 2015, 08:15 pm
This forum shall have some educational impact on the people who start with electronics (as the most people who are asking here do not posses such background, and, some who give an advice do not have too), so a good engineering practice has to be evangelized.

Wiring a power mosfet directly to a logic output is not a good practice, even it may work somehow.

The same as with an LED - most people think they can simply hang an LED to an atmega output because the output is "40mA" (it is not) and an LED is "20mA" (it is not).






Title: Re: [sorted] Tesla member but never used a MOSFET: clarity please?
Post by: Paul__B on Mar 25, 2015, 09:05 pm
I've changed my schematic, which unfortunately means this thread makes less sense, but I have posted the image in a few places now, and would rather that the (more) correct one appears in all those places.
Did you really drop R1 to 10 Ohms?
Title: Re: [sorted] Tesla member but never used a MOSFET: clarity please?
Post by: nickgammon on Mar 25, 2015, 09:21 pm
That's odd. I somehow reverted to an older schematic in ExpressSCH. I've updated the image now to be more consistent with the former version.
Title: Re: [sorted] Tesla member but never used a MOSFET: clarity please?
Post by: Paul__B on Mar 26, 2015, 11:31 am
Sure has reverted!

Now back to the original!
Title: Re: [sorted] Tesla member but never used a MOSFET: clarity please?
Post by: nickgammon on Mar 26, 2015, 08:32 pm
I uploaded a fixed version. You might need to refresh the page.
Title: Re: [sorted] Tesla member but never used a MOSFET: clarity please?
Post by: Paul__B on Mar 27, 2015, 12:19 am
I uploaded a fixed version. You might need to refresh the page.
Interesting - caching problem!  I had refreshed the page (in order to see the most recent replies, and the page was still in the tab in contrast to navigating from the index), but it was on a different machine which presumably was holding the original graphic.

Trick is - I browse here on no less than five machines at different times and days.  :smiley-eek:

Frankly, I am getting somewhat cheesed off with Firefox, considering moving to Chrome.  Very slow and faltering performance, even worse on Windoze.  The only reason I stay with it is the familiar and essential add-ons - NoScript, Adblock Plus and Tab Mix Plus, but I understand these are all available on Chrome so ...

And Firefox on Mint baulks at IView for some reason related to the rotten DRM.