Go Down

### Topic: How to use a MOSFET as a switch. (controlled by arduino) (Read 125857 times)previous topic - next topic

#### mahela007

##### Oct 08, 2011, 04:59 pm
I'm relatively familiar with the working and biasing calculations of Bipolar Junction Transistor. However, this is my first time using a MOSFET and I'm not sure how to use a MOSFET as a switch. My main concern is how to ensure that the MOSFET is in saturation. (i.e fully on). Should I just connect the gate to the source to make the gate voltage equal to the source voltage?

The current I want to control is around 10 - 15 A. It's for my coilguns' solenoid and the current should be in the form of a pulse, a few milliseconds in duration.

This is the datasheet of my MOSFET. http://www.irf.com/product-info/datasheets/data/irfz44n.pdf.
Since the threshold voltage is +ve, I assume the MOSFET is an N-channel one.
Thanks.

#### RuggedCircuits

#1
##### Oct 08, 2011, 05:31 pm
To use a MOSFET as a switch, you have to have its gate voltage some voltage (Vgs) higher than the source. If you connect the gate to the source you are ensuring the MOSFET is off (Vgs=0).

The MOSFET you selected (IRFZ44N) is a "standard" MOSFET and only turns on when Vgs=10V or higher (up to the maximum rating of 20V, which you should stay away from), so 10V-15V is common for Vgs for this type of MOSFET.

If you want to drive this from an Arduino, which only outputs 5V, you will need a "logic-level" MOSFET. For this type of MOSFET, Vgs=5V is enough to turn it on. For example, the ST STP55NF06L would be appropriate and is comparable to the IRFZ44N, except the STP55NF06L is logic-level.

You should also have a resistor in series with the Arduino output to limit the current, since the MOSFET gate is highly capacitive and can draw a big instantaneous current when you try to turn it on (or off). 220 ohms or so is appropriate.

--
The Ruggeduino: compatible with Arduino UNO, 24V operation, all I/O's fused and protected

#### mahela007

#2
##### Oct 08, 2011, 05:56 pm
I have a couple of questions:
Where did you find the Vgs value of 10V? I can't seem to find it on the Datasheet.. maybe I'm not looking for the right attribute.

Is it possible to use a separate driver circuit to provide the required Vgs?

#### MarkT

#3
##### Oct 08, 2011, 05:59 pm
When designing with MOSFETs be aware that instead of having a Vsat like a bipolar transistor, a fully-saturated MOSFET acts as a low-value resistor.  Say you are switching 10A in a 12V circuit.  And lets suppose you only want to waste 0.5V across the MOSFET, then its on-resistance (Vds(on)) should be <= 0.05ohms (0.5V / 10A)

If the device you choose has 0.05ohm Vds(on) and carries 10A then it will dissipate I^2R watts, ie 10x10x0.05 = 5W.  This will need a good heatsink if for more than a second or two, but not at issue if millisecond pulses every few seconds.  These days on resistances of 0.2 to 0.001 ohms are available (though less than 0.005ohms gets expensive).

Another thing to beware of in datasheets is Vthresh (threshhold voltage).  This is not the gate voltage to turn the device on, its the gate voltage at which it switches fully off (less than a few uA of current, typically).  If Vthresh is given as 2..4V range, it cannot be a logic level MOSFET (Vthresh is usually 0.5 to 1V for logic-level MOSFETs).

A logic level FET will have Rds(on) specified for Vgs=5V or 4.5V.  If its only specified for Vgs=10V, its not logic-level.

And finally the abs. max current rating is usually the thermal limit with infinite heatsinking.  So a 20A MOSFET is not a good choice for carrying 10A, a 100A MOSFET is a better choice as you won't need a large heatsink and fan(!).
[ I will NOT respond to personal messages, I WILL delete them, use the forum please ]

#### RuggedCircuits

#4
##### Oct 08, 2011, 06:02 pm
Quote
Where did you find the Vgs value of 10V? I can't seem to find it on the Datasheet.. maybe I'm not looking for the right attribute.

It is on the second page of your datasheet, in the Rds(on) row (third row). This lists the on-resistance under the condition that Vgs=10V (and ID=25A). If there is no rating for Rds(on) when Vgs=5V (or 4.5V), then it is not a logic-level MOSFET.

Quote
Is it possible to use a separate driver circuit to provide the required Vgs?

Yes, if you use a MOSFET driver chip like a TC4427. You could also use "regular" transistors (BJT's) to construct a current/voltage amplifier (essentially what the TC4427 does) and then either use a logic-level MOSFET or a standard MOSFET if you have access to a 10V-15V source for driving the gate.

--
The Basic Motor Driver: simple, inexpensive motor driver for 1 stepper motor or 2 DC motors

#### zoomkat

#5
##### Oct 08, 2011, 06:31 pm
You may want to get the logic level MOSFET like below.

http://www.sparkfun.com/products/10213
Google forum search: Use Google Search box in upper right side of this page.
Why I like my 2005 Rio Yellow Honda S2000  https://www.youtube.com/watch?v=pWjMvrkUqX0

#### mahela007

#6
##### Oct 08, 2011, 07:38 pm
Thanks everyone.. that was some very useful information.

To use a MOSFET as a switch, you have to have its gate voltage some voltage (Vgs) higher than the source. If you connect the gate to the source you are ensuring the MOSFET is off (Vgs=0).

I made a mistake there.. the gate should be connected to the drain shouldn't it?

#### RuggedCircuits

#7
##### Oct 08, 2011, 07:44 pm
No, it really shouldn't. Here's a basic circuit that uses an N-channel logic-level MOSFET as a switch (which is what you are doing):

http://ruggedcircuits.com/html/circuit__7.html

The gate is connected neither to the drain, nor the source. The 47k resistor is there to bleed any charge that accumulates on the gate through leakage paths.

--
The Rugged Motor Driver: two H-bridges, more power than an L298, fully protected

#### terryking228

#8
##### Oct 08, 2011, 07:52 pm
Hi, What supply voltage(s) do you have available, in addition to +5V??

What is the voltage you want to put across your coil when it is active?
Regards, Terry King terry@yourduino.com  - Check great prices, devices and Arduino-related boards at http://YourDuino.com
HOW-TO: http://ArduinoInfo.Info

#### MarkT

#9
##### Oct 08, 2011, 09:08 pm
Quote
I made a mistake there.. the gate should be connected to the drain shouldn't it?

Only if you want to build an expensive alternative to a zener diode!
[ I will NOT respond to personal messages, I WILL delete them, use the forum please ]

#### mahela007

#10
##### Oct 09, 2011, 05:28 amLast Edit: Oct 09, 2011, 05:36 am by mahela007 Reason: 1

Hi, What supply voltage(s) do you have available, in addition to +5V??

What is the voltage you want to put across your coil when it is active?

12V from a car battery..

No, it really shouldn't. Here's a basic circuit that uses an N-channel logic-level MOSFET as a switch (which is what you are doing):

http://ruggedcircuits.com/html/circuit__7.html

The gate is connected neither to the drain, nor the source. The 47k resistor is there to bleed any charge that accumulates on the gate through leakage paths.

Thanks for the link. I was referring to a method of getting the MOSFET into saturation, just as a proof of concept. I saw the schematic I'm referring to on this page.
http://www.electronics-tutorials.ws/transistor/tran_7.html ("section 2. saturation region")

#### terryking228

#11
##### Oct 10, 2011, 10:41 am
In the example you linked to:
"An example of using the MOSFET as a switch" section is what we're talking about.

The important thing is that unless you have a good "logic level gate" FET, you need to take the Gate voltage up to 10 or 12 volts to turn the FET on hard.

At the risk of looking like a broken record because I've put this up a lot lately, here's how to use the good old 555 'timer chip' as a FET driver for 12 volts:

Why/How this works: Look at the 555 Block Diagram:

The "control" input can fix the reference voltage of the bottom two 5K resistors. Then when your Arduino output drives both the "threshold" and "trigger" inputs, the output will switch HIGH when the IN signal is above the reference, and switch LOW when the IN signal is below .5 of the reference. If you use 2 silicon diodes as shown then the switching points are about 1.4V and about 0.7V with a nice "schmitt trigger" action.

The 555 Output can drive both + and ground at 200ma and it's fast enough for any normal PWM frequency.
Regards, Terry King terry@yourduino.com  - Check great prices, devices and Arduino-related boards at http://YourDuino.com
HOW-TO: http://ArduinoInfo.Info

#### mindcrime

#12
##### Oct 10, 2011, 06:53 pm
@terryking228 - sweet, never considered using a 555 for that before.  What I have been experimenting with, is using a LM339 comparator for something similar.  Any comment on the respective advantages / disadvantages of using a 555 versus the LM339 for this?

#### terryking228

#13
##### Oct 10, 2011, 07:50 pm
Hi, The LM339 has "open collector" outputs and can only 'pull' down towards ground and only 18ma.  The 555 can drive strongly both high and low (200 ma).

If you want to do some comparisions, like doing PWM based on current, etc. the 339 is great.

I made a controller for my kids car with a 555 as a sawtooth wave generator, a 339 comparator with a foot-operated pot for the Pulse width control, and another 555 as the FET driver. When my shipment ever gets to my new place, I may be able to find the schematic in my notebooks...
Regards, Terry King terry@yourduino.com  - Check great prices, devices and Arduino-related boards at http://YourDuino.com
HOW-TO: http://ArduinoInfo.Info

#### mindcrime

#14
##### Oct 10, 2011, 08:06 pm
Gnarly.  I'm totally going to go over to the hackerspace tonight and breadboard this 555 driver approach and try it out.   This will be really handy for working with the non-logic-level MOSFETs they carry at Radio Shack.

I'm planning to order some real logic-level MOSFETs soon; but learning to interface these IRF510s with an Arduino has been a good learning experience.   :-)

Go Up