Mosfet as a Switch application

Thread Starter

kalemaxon89

Joined Oct 12, 2022
241
I have the output of a GPIO of an ST microcontroller which switches high (3.3V) or low (0V).
I want a fan to turn on when the output is high and turn off when it is low.
So I need to apply a simple mosfet (between the gpio and the fan) that switches between the saturation region and the cut-off region (like a switch)

Assuming I use this fan and this mosfet (I know it's not the best choice, but let's assume we're using this), I have some doubts on circuit dimensioning:

1) The chosen mosfet has Vgs(th) = 1.7V ... so it will conduct and turn on the fan if Vgs > 1.7V
Since I have 0V or 3.3V output from the GPIO, can I connect the mosfet directly to the pin? Do I need a resistor or some protection diodes?
Since no current is flowing on the gate, I think the only condition to be met is that any voltage on the input of the pin (i.e. Vgs(th)) does not exceed the maximum breakdown voltage of the pin itself ... right?
If it is true, in this case I don't think it will happen since Vgs(th) << Vgpio tolerant (it should be 3V or 5V)

2) The fan datasheet states that the maximum rated current is 74mA ... this means that my drain current must not exceed that value, is this correct?
But it is not clear to me how I can calculate the drain current flowing when the mosfet conducts in saturation (switch circuit closed).
Once I understand what I have to calculate, I can also definitely add a resistor.

View attachment 279230

So, to recap:

1) the circuit I drew in my original post is correct (although the mosfet should be represented as @dl324 suggests in post #8) ... tell me if any components are missing

2) in this application I don't need a resistor on the gate (if I want I'll put it for example 1k)

3) the power dissipated on the drain by the mosfet while it's on is Rds(on)*I_drain^2 = Rds(on)*I_fan^2 = 0.147mW < maximum power dissipated by the mosfet in question (i.e. 1.3W at 25°C) .. so I don't need a Rd.
Should I worry about the rated power consumption of the fan (i.e. 1.78W) ?
Sorry, but I get a bit confused between power dissipated by the mosfet and that of the fan.

4) The fan current on the drain (Id) is about 74mA, much less than the Id that the selected mosfet can handle .. so as before, I may not add an Rd

If nothing is missing .. then I ask for some advice on the choice of mosfet.

(of course I thank everyone for the answers)
 

Ian0

Joined Aug 7, 2020
9,805
One thing we haven't mentioned is the surge. Fans, like any other motors, take extra current when starting and in addition to that Sunon fans have a small circuit in them which has a smoothing capacitor.
What is the surge current of the fan?
 

dl324

Joined Mar 30, 2015
16,916
3) the power dissipated on the drain by the mosfet while it's on is Rds(on)*I_drain^2 = Rds(on)*I_fan^2 = 0.147mW < maximum power dissipated by the mosfet in question (i.e. 1.3W at 25°C) .. so I don't need a Rd.
Should I worry about the rated power consumption of the fan (i.e. 1.78W) ?
Sorry, but I get a bit confused between power dissipated by the mosfet and that of the fan.

4) The fan current on the drain (Id) is about 74mA, much less than the Id that the selected mosfet can handle .. so as before, I may not add an Rd
Where did you come up with the notion that you might need to use a resistor to limit fan current?

You never needed to worry about limiting the current drawn by the fan. As long as you're connecting it to the specified voltage, it will draw the specified nominal current.

Power dissipated by the fan is a don't care to the MOSFET. You need to operate the MOSFET within it's maximum drain current and power dissipation specs.
 

LowQCab

Joined Nov 6, 2012
4,067
The FET selection is just fine, ( lots of over-kill, nothing even close to the stated maximums ).

The FET will not dissipate a noticeable amount of Heat.

Look at the "Rds-On" ratings on the Spec-Sheet, with a 3.3V "Gate to Source Voltage",
it's really low,
so if You apply Ohms-Law,
You will see that there will be only a very tiny Voltage between the
Drain and the Source, because of the Current being limited to only ~74mA by the Fan.

The FET can deal with ~10-Amps of Current, for a short period of time, with 3.3-Volts applied to the Gate.
So, even if the Fan would draw 10-times it's rated running Current, ( 0.74-Amps ), for a short period of time,
the FET would casually handle it without any issues at all.
However, at 0.74-Amps, the FET could start to get warm rather quickly,
and Heat-Sinking issues would have to be addressed to prevent overheating and smoking the FET.

When using Ohms-Law to figure this out,
both the Fan-Motor, and the FET can be treated as "Dynamic-Resistors",
which would mean that their Resistances change depending on other outside factors.

In the case of the Fan, the Resistance varies with the Load on the Motor's Shaft,
which is greatest, ( lowest numerically ), when the Motor is not turning,
and highest when it is running in it's designed, nominal, working RPM range.

The "Resistance" of the FET changes depending upon the Voltage applied to the Gate-Pin,
( there are also some other factors to consider, but Voltage on the Gate is the most important )

So,
if You have 2 Resistors in series in a Circuit, ( the Fan, and the FET ),
the maximum Current that can flow will be determined by the combined Resistance Value,
and,
the Voltage measured across each "Resistor" will be determined by
the "instantaneous-Resistance-Value" ( because the Resistance can fluctuate ), of that Resistor,
and it will be some "Percentage" of the Supply-Voltage.

Example .........
If the first Resistor is 1-Ohm, and the second Resistor ( in series ) is 1000-Ohms,
there will always be 1000-times more Voltage across the second Resistor,
than there is across the first Resistor,
but both Resistors will have exactly the same amount of Current ( Amps ) flowing through them.

Power = Watts = Volts X Amps.

Best-Practices would include a 100K Resistor from the Gate to Ground to
protect the Gate of the FET during Power-Up and Shut-Down conditions,
( when unusual things can happen ).
.
.
.
 

Thread Starter

kalemaxon89

Joined Oct 12, 2022
241
Look at the "Rds-On" ratings on the Spec-Sheet, with a 3.3V "Gate to Source Voltage"
Yes, I have now realised that I have mistakenly used Rds(on)_max at Vgs=10V ... and not Vgs = 3.3V (on the datasheet there is Rds(on)_max=0.04ohm for 4.5V) .. but still less than the maximum power dissipated by the mosfet.
The FET selection is just fine, ( lots of over-kill, nothing even close to the stated maximums ).

The FET will not dissipate a noticeable amount of Heat.

Look at the "Rds-On" ratings on the Spec-Sheet, with a 3.3V "Gate to Source Voltage",
it's really low,
so if You apply Ohms-Law,
You will see that there will be only a very tiny Voltage between the
Drain and the Source, because of the Current being limited to only ~74mA by the Fan.

The FET can deal with ~10-Amps of Current, for a short period of time, with 3.3-Volts applied to the Gate.
So, even if the Fan would draw 10-times it's rated running Current, ( 0.74-Amps ), for a short period of time,
the FET would casually handle it without any issues at all.
However, at 0.74-Amps, the FET could start to get warm rather quickly,
and Heat-Sinking issues would have to be addressed to prevent overheating and smoking the FET.

When using Ohms-Law to figure this out,
both the Fan-Motor, and the FET can be treated as "Dynamic-Resistors",
which would mean that their Resistances change depending on other outside factors.

In the case of the Fan, the Resistance varies with the Load on the Motor's Shaft,
which is greatest, ( lowest numerically ), when the Motor is not turning,
and highest when it is running in it's designed, nominal, working RPM range.

The "Resistance" of the FET changes depending upon the Voltage applied to the Gate-Pin,
( there are also some other factors to consider, but Voltage on the Gate is the most important )

So,
if You have 2 Resistors in series in a Circuit, ( the Fan, and the FET ),
the maximum Current that can flow will be determined by the combined Resistance Value,
and,
the Voltage measured across each "Resistor" will be determined by
the "instantaneous-Resistance-Value" ( because the Resistance can fluctuate ), of that Resistor,
and it will be some "Percentage" of the Supply-Voltage.

Example .........
If the first Resistor is 1-Ohm, and the second Resistor ( in series ) is 1000-Ohms,
there will always be 1000-times more Voltage across the second Resistor,
than there is across the first Resistor,
but both Resistors will have exactly the same amount of Current ( Amps ) flowing through them.

Power = Watts = Volts X Amps.

Best-Practices would include a 100K Resistor from the Gate to Ground to
protect the Gate of the FET during Power-Up and Shut-Down conditions,
( when unusual things can happen ).
.
.
.
Yes, I have now realised that I have mistakenly used Rds(on)_max at Vgs=10V ... and not Vgs = 3.3V (on the datasheet there is Rds(on)_max=0.04 ohm for 4.5V) .. but still less than the maximum power dissipated by the mosfet.

Thank you very much for the clarification!

So do you think it is useful in this application to add the resistor between gate and ground you mention, or can I also do without it?
 

LowQCab

Joined Nov 6, 2012
4,067
If You are not completely sure of the capabilities of the Output that You are using
a Resistor is good insurance that everybody will "Play-Nice" and get along together.

It's always a good idea to to "overbuild" rather than to find out later that
a problem was created by "going-cheap",
especially when it may take You many hours to trouble-shoot the problem after the fact.
.
.
.
 

Irving

Joined Jan 30, 2016
3,884
So do you think it is useful in this application to add the resistor between gate and ground you mention, or can I also do without it?
It'll work fine without it, however is generally good practice to do so. On startup the GPIO is a high impedance as its configured as an input so both upper and lower internal output MOSFETs are turned off. In theory a static charge could build up on the external MOSFET gate that A) could damage the very thin gate oxide insulation layer which would kill the MOSFET (very unlikely) or B) turn the MOSFET partially on, thus turning the fan on. A 100k resistor from gate to source bleeds any static charge, thus protecting the gate and avoids any false triggering. For the cost of 1 resistor its a sensible thing to do.
 

Thread Starter

kalemaxon89

Joined Oct 12, 2022
241
I have the output of a GPIO of an ST microcontroller which switches high (3.3V) or low (0V).
I want a fan to turn on when the output is high and turn off when it is low.
So I need to apply a simple mosfet (between the gpio and the fan) that switches between the saturation region and the cut-off region (like a switch)

Assuming I use this fan and this mosfet (I know it's not the best choice, but let's assume we're using this), I have some doubts on circuit dimensioning:

1) The chosen mosfet has Vgs(th) = 1.7V ... so it will conduct and turn on the fan if Vgs > 1.7V
Since I have 0V or 3.3V output from the GPIO, can I connect the mosfet directly to the pin? Do I need a resistor or some protection diodes?
Since no current is flowing on the gate, I think the only condition to be met is that any voltage on the input of the pin (i.e. Vgs(th)) does not exceed the maximum breakdown voltage of the pin itself ... right?
If it is true, in this case I don't think it will happen since Vgs(th) << Vgpio tolerant (it should be 3V or 5V)

2) The fan datasheet states that the maximum rated current is 74mA ... this means that my drain current must not exceed that value, is this correct?
But it is not clear to me how I can calculate the drain current flowing when the mosfet conducts in saturation (switch circuit closed).
Once I understand what I have to calculate, I can also definitely add a resistor.

View attachment 279230
If I want to drive, exactly as I have just done for the fan, another component (e.g. servomotor .) from the same pin to which I have already connected the mosfet and the fan ... how do I do this?

- do I connect the gate of another mosfet to the pin? (which would be connected to the gate of the other mosfet driving the fan).
- can I not use an additional mosfet and connect (I don't know how) the new component to the drain of the mosfet already in use?

I have a lot of questions about both the first option and the second, so I ask you first of all which of the two options suits me and why

The circuit to be modified is the one in the first post I wrote (you can see it above) with the addition of a resistor between gate and ground
One thing we haven't mentioned is the surge. Fans, like any other motors, take extra current when starting and in addition to that Sunon fans have a small circuit in them which has a smoothing capacitor.
What is the surge current of the fan?
Can this problem be solved with a potentiometer?
Or modulating the length of the mosfet channel with the PWM?
 

LowQCab

Joined Nov 6, 2012
4,067
How much Current does the "Servo-Motor" require ?

"" Can this problem be solved with a potentiometer? ""
No.

"" Or modulating the length of the mosfet channel with the PWM? ""
You seem to have some terms mixed-up here ........
MOSFETs do have a thing called "Channel-Length" which You don't
need to be concerned with in the current project, or maybe never.
I assume this is not what You meant.

A PWM Signal has an "Off-Voltage", and an "ON-Voltage",
and stays "On" for a certain percentage of a single "Cycle",
the Cycle-Frequency, normally, never changes.

Changing a PWM Signal percentage
has no effect on the ability of a FET to handle a particular Load.
.
.
.
 

Irving

Joined Jan 30, 2016
3,884
If I want to drive, exactly as I have just done for the fan, another component (e.g. servomotor .) from the same pin to which I have already connected the mosfet and the fan ... how do I do this?

- do I connect the gate of another mosfet to the pin? (which would be connected to the gate of the other mosfet driving the fan).
- can I not use an additional mosfet and connect (I don't know how) the new component to the drain of the mosfet already in use?

I have a lot of questions about both the first option and the second, so I ask you first of all which of the two options suits me and why

The circuit to be modified is the one in the first post I wrote (you can see it above) with the addition of a resistor between gate and ground


Can this problem be solved with a potentiometer?
Or modulating the length of the mosfet channel with the PWM?
Assuming you mean for both to be active at the same time, and they run from the same 24v supply, and you are just switching them on or off and doing nothing fancy (like trying to control speed/position) then, as long as servomotor doesn't exceed a few amps, just connect both to the same MOSFET, otherwise another MOSFET etc needed. However this makes little sense if you really mean a servomotor.

If you are expecting to control servomotor speed or position (as would normally be the case with a servomotor - check your use of the term) then you need a separate GPIO and MOSFET for the servomotor.
 

Thread Starter

kalemaxon89

Joined Oct 12, 2022
241
It'll work fine without it, however is generally good practice to do so. On startup the GPIO is a high impedance as its configured as an input so both upper and lower internal output MOSFETs are turned off. In theory a static charge could build up on the external MOSFET gate that A) could damage the very thin gate oxide insulation layer which would kill the MOSFET (very unlikely) or B) turn the MOSFET partially on, thus turning the fan on. A 100k resistor from gate to source bleeds any static charge, thus protecting the gate and avoids any false triggering. For the cost of 1 resistor its a sensible thing to do.
So the circuit I have on the gate of the mosfet is something like this:
SmartSelect_20221107_204740_Samsung Notes.jpg
Is it correct?

If the circuit I have attached is a correct approximation of what happens and what I have on the gate ... now I am interested in calculating how much current flows on the gate in order to avoid burning out the GPIO (max 20mA).
I think I could proceed in several ways:

1) I should analytically study the circuit I have attached ... right? (I means find Xc, the parallel, maybe use Laplace or design and study the small-signal model of the mosfet etc.)

2) Much more simply:
I=dQ/dt
Q=total gate charge
t=turn-on event duration of the mosfet
These two parameters are present on the datasheet ... but the values are referred/estimated to Vdd=15V, Rload=1.5 ohm, ID≅10 A, Vgen=10 V, Rg=1 Ω ... quite different from my case.

If this is the right approach then:
- I try to understand from the datasheet what values I and Q would have in my case by studying well the characteristic curves shown
- I make the circuit on a breadboard (but the mosfet we are talking about is a smd .. so I couldn't) and I use an oscilloscope to detect dt

3) I simulate the circuit on Ltspice by importing the spice model of the mosfet in question


I accept advice from those who have been designing for a long time and are certainly more experienced than I am (as you can see .. I have very little)
 

crutschow

Joined Mar 14, 2008
34,418
how much current flows on the gate in order to avoid burning out the GPIO (max 20mA).
Note that value is the steady-state current limit.
The peak current can likely be much higher than that for the short transient current needed to charge and discharge the MOSFET gate capacitance.
Likely the GPIO output is current limited so short duration short-circuits at the output do no damage.
 

Thread Starter

kalemaxon89

Joined Oct 12, 2022
241
Note that value is the steady-state current limit.
The peak current can likely be much higher than that for the short transient current needed to charge and discharge the MOSFET gate capacitance.
Likely the GPIO output is current limited so short duration short-circuits at the output do no damage.
Otherwise: Ig = Vg(max) / Rg < Ig(max)=20mA del GPIO
so.. Rg > 3.3V / 20mA .. e.g. 1k or 10k

Obviously, the higher the resistance at the gate ... the slower the parasitic capacitance Cgs will be charged ... thus leading to slower mosfet switch-on.
 

Jerry-Hat-Trick

Joined Aug 31, 2022
552
Replace MOSFET with BJT
I'm not looking to start an argument but if I had a dollar for every post extolling the virtues of MOSFETS over BJTs which then go on at great pains to discuss how they should be turned on and off I'd be sailing my yacht in the Carribean by now:)
Almost any BJT with a reasonable gain, turned on hard with a micro output via a suitable resistor (based on the allowed output current of the micro pin) will do the job fine. You will need Ohms law...
 
Top