Mosfet let's current pass

Hi,

For driving a 16 V motor I’m using a IRLZ44 Mosfet MBR1645 diode and wired as shown in the attachment. For driving a small 3.6 V motor I’ve used the same wiring (different, weaker Mosfet and diode) and code and that one works perfectly. For my big motor however, when I attach the battery the motor starts rotating even if the arduino isn’t powered. It’s like the Mosfet just always let’s current through instead of functioning as a switch as it should. What am I doing wrong?

It's doesn't look like you're doing anything wrong, if, indeed, your actual assembly is the same as your diagram [perhaps you can supply a photo of your setup]. Have you measured the voltage at the Gate? And, even better, if you own a scope, I would probe the gate and see what's going on there. If the motor is turning when the gate voltage is at, or near, 0 [or below the 1Vish Gate threshold voltage], then it sounds like the MOSFET is bad [or there's something weird going on, like somebody spilled something on that breadboard that is a good conductor -- or that MOSFET is something other than what you think it is - or the connections are wrong - or bad/dirty/oxidized terminals in that breadboard are causing one or more of the wires/leads to not, actually, make contact (more common than you might realize), or ??]

Conditions that might cause the motor to turn when the Arduino is not powered:

  • One or both of the leads on the 10k resistor are not making contact, leaving the Gate to float.
  • That "10k" resistor is really 100Ω [Brown can, sometimes, be mistaken for Orange], and it's connected from the Drain to the Source, instead of from the Gate to the Source.
  • The motor's negative lead is really connected to the Source [and not the Drain].
  • The batteries Negative lead is connected to the Drain [and not the Source].
  • The MOSFET is in a failure mode that allows current to pass from the Source to the Drain no matter what is going on at the Gate.
  • That's all I can think of :wink:

Ah okay thanks! Yeah I've considered there was something wrong with my components or breadboard wiring but I've already soldered this setup togheter twice with new components every time and it didn't work both times. But I'll try and measure the gate votage.

It is anybody's guess what the pinout is on the MOSFET mislabeled "NPN" in that Fritzing-for-idiots diagram.

Connections should be (R2 is NOT optional):

Always check the data sheet for GSD pinouts.

jremington:
It is anybody's guess what the pinout is on the MOSFET mislabeled "NPN" in that Fritzing-for-idiots diagram.

Always check the data sheet for GSD pinouts.

I just assumed the OP used the wrong symbol. I looked up the IRLZ44 datasheet, and determined that the OP did get the wiring right [on their diagram, which is no guarantee that they got it right in real-life :wink: ]

MOSFETs are static sensitive and do not usually have any protection components built-in, so should always
be handled with full anti-static precautions until in-circuit.

Ok so looking at the circuit from Jremington I'm missing a capacitor. What kind of value should I get for this?

The value given on the diagram is good.

Steve

WB02:
Ok so looking at the circuit from Jremington I'm missing a capacitor. What kind of value should I get for this?

You're missing R2 which, as jremington states, is NOT optional.

slipstick:
The value given on the diagram is good.

But not necessary for function in this context.

This capacitor is to suppress RF interference and possibly to minimise impulse noise conveyed to the power supply wiring.

sterretje:
You’re missing R2 which, as jremington states, is NOT optional.

Yup, I missed that. Here’s a crude calculation:

[b]T[/b] = Qg/Ig

where:

  • [b]Ig[/b] - is the peak Gate current [it’s not linear, so this is an estimate]
  • [b]Qg[/b]- the Total charge on the Gate [from the datasheet]
  • [b]t[/b] - the approximate switching time

So, if we drive the gate with 20mA [the recommended max current from an Arduino pin], and call it a 10mA average current, since the current will not remain at 20mA, but will ramp down [or up, depending on whether the thing is switching ON, or OFF], we get the following switching time:

[b]T[/b] = 66nC/10mA = [b]6.6µS[/b]

It’s probably a bit faster than that, because the gate doesn’t have to get all the way to 5V, before the transistor “turns on” [and at what point the transistor can be considered “ON” has much to do with how much current is needed to get that motor started. For instance, according to Figure 1, on the Vishay datasheet, in the Typical case, the gate needs to be at 2.75V for 10A to flow in the channel, and if, say, that motor demands 20A, then the Gate needs to be at 3V, etc.

So, to set this current, use the following math:

[b]Rg[/b] = Vout/Iout = 5V/20mA = [b]250Ω[/b]

But, for such short periods of time, we can probably get away with pressing that Arduino output to deliver a little more current, say 30mA, which is 10mA short of the Absolute Maximum ['cuz were, potentially, dealing with a lot of current, here, so it would be good to get that transistor switching as fast as possible] – and, again, lets take the estimated average current of 15mA:

[b]T[/b] = 66nC/15mA = [b]4.4µS[/b]
[b]Rg[/b] = Vout/Iout = 5V/30mA = [b]167Ω[/b]

But, once again, this is some kindergarten math, so only useful, maybe, for ballpark calculations, and non-critical applications, like occasionally turning a motor on and off.

Also, 4.4µS [and even 6.6µS] seems pretty fast, but if that 16V motor does demand the kind of current the IRLZ44 is designed for, then even 4.4µS might be long enough for damage to occur. After all, the datasheet indicated this transistor is meant to be driven with a rise/fall time in the hundreds of nS range, making our measly 4.4µS rather a long time!

The datasheet indicates a Rise Time of 230nS. Let’s get an estimate of how much current ti would take to get that kind of switching speed. And lets assume we need at least 4V on the Gate to get the channel open enough to accommodate start up current or 40A on that motor [currently a mystery quantity, as the OP has failed to divulge].

4V/5V = [b]0.8[/b] or
** **80%** **
of the full Arduino Vout.

[b]Ig[/b] = Qg/t * 80% * 2 = 66nC/230nS * 0.8 * 2 = [b]460mA[/b]

Not something an Arduino output is capable of!

I've decided to try something else and found this motor driver: https://www.tinytronics.nl/shop/en/robotics/motors/motor-drivers/bts7960-btn7960-motor-driver-high-power-43a

Would that be a good choice?

sterretje:
You’re missing R2 which, as jremington states, is NOT optional.

So many people agrees here the R2 is NOT optional. So I ask again: how do you know so? What is the limit for non-optionalness of adding the R2?

  1. We all know that CMOS inputs are in fact MOSFET gates. Yet no one says they must be driven with current limiting resistor.
  2. Do you think a small signal MOSFET switching low voltage signal NEEDS current limiting resistor? Its capacitance is comparable to driving a few CMOS inputs with one pin.
  3. When you drive a large MOSFET with large capacitance the gate resistor is a trade-off: without it Arduino output pin is stressed. But adding the resistor makes the transition even slower, making the MOSFET suffer. Why do you believe it is ALWAYS better to prefer Arduino over the MOSFET? AFAIK damaged MOSFET is much more common problem than damaged Arduino output for people here.

ReverseEMF:
Here’s a crude calculation:

This is only the first part of the story. You need to estimate the energy dissipated in the MOSFET while in linear region. Is it enough to kill the MOSFET in worst case conditions? If it is, than a MOSFET driver is needed. If it is much lower you can even get away with the gate resistor R2.
There is a Maximum Safe Operating Area (Figure 8) in the datasheet. It shows that for a single pulse and 20V drain source voltage the MOSFET should survive 100A@25°C. If the MOSFET is large enough for the motor (we don’t know the stall current!) it should easily survive being switched from Arduino, even with R2. Unless a PWM regulation is needed ofc.

WB02:
Would that be a good choice?

Not solving the problem in OP is probably a bad choice IMO. Driving motor with a MOSFET should be “easy” task.

sihlz44.pdf (1.77 MB)

Smajdalf:
So many people agrees here the R2 is NOT optional. So I ask again: how do you know so? What is the limit for non-optionalness of adding the R2?

It has to do with moving charge. The Gate of a MOSFET is, by it's very structure, a capacitor. And, a capacitor holds charge. And to change the state of a MOSFET, you have to either charge the Gate capacitance, or discharge it. And doing so requires current. How much current depends on how large the Gate capacitance is, and the larger the amount of current that Gate is designed to control, the larger that capacitance tends to be.

Smajdalf:

  1. We all know that CMOS inputs are in fact MOSFET gates. Yet no one says they must be driven with current limiting resistor.

As is the case with MOSFETs designed to drive large currents, MOSFETs designed to drive small currents, like those used in CMOS,, tend to have small capacitance, thus much less current is needed to change the state. The input capacitance of a typical CMOS input, is around 5pF.

Smajdalf:
2) Do you think a small signal MOSFET switching low voltage signal NEEDS current limiting resistor? Its capacitance is comparable to driving a few CMOS inputs with one pin.

Probably not. It's only if the amount of current needed to charge or discharge the Gate capacitance, will exceed the recommended (or maximum, depending on how reckless you are :wink: ) Arduino output current [for the UNO that's 20mA recommended and 40mA Max].

Smajdalf:
3) When you drive a large MOSFET with large capacitance the gate resistor is a trade-off: without it Arduino output pin is stressed. But adding the resistor makes the transition even slower, making the MOSFET suffer. Why do you believe it is ALWAYS better to prefer Arduino over the MOSFET? AFAIK damaged MOSFET is much more common problem than damaged Arduino output for people here.

Yes, that's why, if the Arduino's output current limitation is such that it can't properly drive the indented MOSFET [as in the case you offered, where adding the resistor makes it switch too slowly for the application], one must employ some sort of Gate Driver. So, why would you ever use a resistor? Because there is a window of cases where the 20 to 40 mA is enough to properly switch the MOSFET, yet, without the resistor, the Gate would demand greater current than 20 or 40 mA. So, it's simply, that you have determined that the MOSFET doesn't have to switch as fast as it possibly can, for that particular application, so you can get away with driving directly from an Arduino output [with said series resistor].

So, essentially, there are three cases:

  • The gate capacitance is small enough that the Arduino output can drive it without a series resistor -- mainly because the inherent Gate resistance, and trace inductances are enough the limit the brief current impulse. In other words, the gate charges so fast, that the current never has a chance to reach maximum output levels.
  • The gate capacitance will demand a current higher than can be safely delivered by an Arduino output [with the subjective definition of "Safe" discussed before], but adding a series resistor to properly limit the current, will not sufficiently degrade the switching time.
  • The gate capacitance is so large, the Arduino cannot safely switch the MOSFET, at the required speed, even with a limiting resistor. In which case, a gate driver is required.

There is no "current demand of capacitance". When charging ANY capacitance, even i.e.(non negligible) capacitance of solderless breadboard the current is limited by resistance of the drivers (+ maybe some other parasitic properties). It is ALWAYS short - with larger capacitance the out of specs current only takes longer. Anyway the current ratings of the datasheet are for DC (or average) current. There is no guidance how to handle them for low frequency switching of high capacitance - and more importantly what "low frequency" and "high capacitance" means.

There is interesting dichotomy on this forum. Noone is afraid to drive large amount of CMOS inputs on long wires without current limiting resistors. The only concern is signal degradation due to heavy capacitive loading and too fast clock speed. A buffer is needed in such situation.
OTOH everyone is afraid to drive any MOSFET gate without resistor. But from Arduino's pin point of view the situation is the same - heavy capacitive load. The CMOS scenario may be even worse: due to large margins it will likely work "just fine" where a power MOSFET with comparable gate capacitance will already burn due to being most of the time in the linear region.

Smajdalf:
There is no "current demand of capacitance".

Really. Then what do you call the need to supply current to charge said capacitance. Surely, your not saying a capacitor can be charged without current [and, yeah...I know...don't call you "Shirley" :wink:

Sounds like a matter of semantics.

Smajdalf:
Anyway the current ratings of the datasheet are for DC (or average) current. There is no guidance how to handle them for low frequency switching of high capacitance - and more importantly what "low frequency" and "high capacitance" means.

Assuming your referring to the datasheet for an Arduion [or intrinsic MCU], when you say "the datasheet": Correct. Truly, there is a fuzzy area around the regions of capable of "safely" driving a capacitance and stress, or damage will result.

Smajdalf:
There is interesting dichotomy on this forum. Noone is afraid to drive large amount of CMOS inputs on long wires without current limiting resistors.

Who is this "Noone" you refer to?

Smajdalf:
OTOH everyone is afraid to drive any MOSFET gate without resistor.

Is Noone related to "everyone"?

Smajdalf:
The CMOS scenario may be even worse: due to large margins it will likely work "just fine" where a power MOSFET with comparable gate capacitance will already burn due to being most of the time in the linear region.

  • "comparable gate capacitance" -- so, worst case input capacitance for a TI CD74HC4002B input is 10pF. The total Gate Capacitance of the Vishay IRLZ44SPBF (to use the OPs given), is 3300pF -- so a "comparable" CMOS input scenario would be something like: 3300pF/10pF, or 330 CMOS inputs all connected together. Is that what you had in mind?
  • How is the "CMOS scenairo" worse, when it's the power MOSFET that "burns"?
  • In both cases yer attempting to drive a high capacitance, so what's your point? A resistor or resistors wouldn't be used in either case, since, an Arduino output would have no chance of properly driving either.

ReverseEMF:
Really. Then what do you call the need to supply current to charge said capacitance. Surely, your not saying a capacitor can be charged without current [and, yeah...I know...don't call you "Shirley" :wink:

I did not read it properly and missed the "inherent Gate resistance, and trace inductances are enough the limit the brief current impulse" part. Since Gate resistance and trace inductances are in general unknown, how do you know if they limit the current pulse enough? Or other way around, how do you know the transistor has so large current demand it NEEDS resistor?

ReverseEMF:
Who is this "Noone" you refer to?

Who says a reasonable large resistor MUST on CLK line of SPI?

ReverseEMF:
"comparable gate capacitance" -- so, worst case input capacitance for a TI CD74HC4002B input is 10pF. The total Gate Capacitance of the Vishay IRLZ44SPBF (to use the OPs given), is 3300pF -- so a "comparable" CMOS input scenario would be something like: 3300pF/10pF, or 330 CMOS inputs all connected together. Is that what you had in mind?

To the CMOS scenario you need to add capacitance of the traces/connecting wires. Also SPI CLK line (on Arduino Uno) may be switching with 8MHz. If you PWM the MOSFET with 8kHz it is 1000 times less average currents. "Equivalent of 0.33 CMOS input." (In reality the total gate charge is more important and it looks worse for the MOSFET, but...)

ReverseEMF:
How is the "CMOS scenairo" worse, when it's the power MOSFET that "burns"?

If the CMOS and MOSFET have the same total capacitance the load on Arduino pin will be roughly the same and resulting waveforms will be similar. If the signal is in the "somewhere between" region for 90% of time the CMOS input will work fine. With low noise margin but work. The MOSFET will be in linear region for 90% of time. It will surely burn. If the MOSFET lives it must load the pin much less than worst case still working CMOS scenario.

Well - YOU claim resistor must be used. But it is due to your own self-imposed limits. The datasheet clearly states the 40mA current limit is for DC current. On other place of ATMega328p is written:
"Although each I/O port can source more than the test conditions (20mA at VCC = 5V, 10mA at VCC = 3V) under steady state conditions (non-transient), the following must be observed: ..."
But we are speaking about transient (non-steady state) conditions!

Smajdalf:
Since Gate resistance and trace inductances are in general unknown, how do you know if they limit the current pulse enough? Or other way around, how do you know the transistor has so large current demand it NEEDS resistor?

I guess you do as much of the math as you can. Then breadboard it and scope it :stuck_out_tongue:

I will try to step back and write a short summary of my thoughts.

  • The current limits in Datasheet are for DC currents
  • Driving ANY capacitive load without current limiting resistor causes high inrush current limited by pin internal resistance only. Capacitance is everywhere - between 2 ATMega pins, in PCB traces, on wires, input of another device. Solderless breadboard has quite large capacitance between rows. Those capacitances all add together.
  • All those capacitances are unknown and mostly ignored in typical design. There is no requirement to measure and limit the inrush current anywhere in ATMega datasheet (or any datasheet of any digital IC I know). It is very likely that in some applications the 40mA may be exceeded briefly. The output drivers MUST be designed to survive such short peak repeatedly.
  • As switching speed is decreasing and capacitance is increasing the stress is closer to DC current. AFAIK no one knows what capacitance is safe. But since my Arduino so far survived very harsh handling and some accidents included short circuits for several seconds I am quite confident it will survive repeated microsecond pulses forever.

I cannot "prove" my point simply by saying - "I did drive a MOSFET without resistor and nothing bad happened". But YOU may prove I am wrong - do you know a scenario where MOSFET (or other capacitive load) was driven by bare pin and the pin was damaged? If not, I will follow BillO - make a reasonable setup where ATMega will be damaged and I will pay the costs.

Smajdalf:
I cannot "prove" my point simply by saying - "I did drive a MOSFET without resistor and nothing bad happened".

True.

Smajdalf:
But YOU may prove I am wrong - do you know a scenario where MOSFET (or other capacitive load) was driven by bare pin and the pin was damaged?

Trouble is, not all damage is "measurable" -- there can be "stress" that will, likely, shorten the life of the device. But, that isn't apparent until the failure occurs -- and even then, all you can do it point at the shorter-than-MTBF, and say "Gee, might have been some stress that occurred".

Or, you could run a QC test, with a "statistically significant" sample set, over a period of time that extends to the MTBF [or increase stressors, like heat, and hope that truly is the same as doing the test for the longer period--essentially, similar to a burn-in]. Then, you might have some useful data. But, that's a very unqualified assessment, since I'm not a Quality Control Engineer [pun there somewhere ;)].

Smajdalf:
If not, I will follow BillO - make a reasonable setup where ATMega will be damaged and I will pay the costs.

Short answer: always use a series resistor.