# understanding a mosfet used as a switch

I want to drive a load of 12v 500mA.

So this is my reasoning, I've never worked with mosfets so please guide me here.

I thought I'd start by my arduino, the max current output per pin I want to keep at 20mA. So is it correct if I calculate a resister value to limit the gate current to 20mA as follows: 5v/0.02A = 250ohm. So if I connect a 250ohm resister to my arduino pin that serves as the mosfet's gate signal. I can be sure that the current will never exceed 20mA so my arduino is safe? Can I say that?

Regarding the above paragraph though, what I have read about Mosfets is that they do not draw current? Like they only draw micro amps? Is this because the gate acts like a magnetic field or what? If they don't draw much current then why do I need to include a resister?

Next I believe mosfets are voltage driven and not current driven. Regarding this subject, firstly: If I connect a resister between the arduino pin and the gate am I not reducing the voltage the gate will see? Instead of 5v it will be less? I'm not to sure how to calculate how much voltage the gate will see then? Secondly, for the mosfet to act as a switch, the way I understand it, I must make sure the voltage the gate gets is high enough to fully "saturate" the junction? Can I say that?

Finally for me to select a mosfet to drive my load from the arduino, do I only need to know the voltage the gate wants to fully switch on and match that with what voltage my arduino can supply to the gate and if I can match those two then the mosfet will work? Also taking into consideration the max voltage and current the source and drain can handle.

Thanx for any help

As i understand, because i think i am often in the same position as you, the best thing to do is to clear what do you want to achieve.
About your questions now, you can use a voltmeter to measure the exact current, after that you can measure it i the analog inputs of arduino.
Furthermore, what version of arduino you plan to use?

The current flowing into a MOSFET gate can be thought of like a capacitor. Once it is "charged" the gate lets current through the drain/source without consuming extra current from the gate. The gate resistor won't reduce the voltage in the long run, it will reduce how fast the gate can get charged up.

If they don't draw much current then why do I need to include a resister?

For a few microseconds it might draw enough current to damage the Arduino pin.

The problem with a large resistor though, is that it takes time to fully saturate the FET, during which time it may get hot because of the resistance between source and drain is higher.

As far as I know, and I am not the world's leading MOSFET expert, you have to take other things into account, like the gate capacitance, and also the output pin's own resistance, which wouldn't be zero.

I would say use a dedicated gate driver. They drive the gate quickly to the correct level (not all mosfets have logic level gates and as high as possible gate voltage is a good thing) and provide level conversion.

If your mosfet is logic-level (that is, it only needs 5V or less to achieve a low Rds(on) value), and you are not switching high voltage or high current loads at high PWM frequencies, then you can drive the mosfet gate from a 5V Arduino output pin. A 100 ohm series resistor is recommended. In other situations, use a mosfet gate driver IC, which can provide a higher gate drive voltage, and a higher current to switch the gate faster.

dc42:
If your mosfet is logic-level (that is, it only needs 5V or less to achieve a low Rds(on) value), and you are not switching high voltage or high current loads at high PWM frequencies, then you can drive the mosfet gate from a 5V Arduino output pin. A 100 ohm series resistor is recommended. In other situations, use a mosfet gate driver IC, which can provide a higher gate drive voltage, and a higher current to switch the gate faster.

If I'm driving 12v and 500mA maximum for 5 microseconds every 15microseconds? I think that's 5hz? Will I be fine then?

Excuse me I mean 50hz

If you mean on for 5 microseconds and off for 15 microseconds, that's 50kHz. If you meant milliseconds instead of microseconds, then it's 50Hz.

Either way, as you are only switching a 6W load, you should be able you use logic-level mosfets without gate drivers - but if you really did mean microseconds, then I suggest you use mosfets with low gate charge in order to keep the switching times low.

dc42:
If you mean on for 5 microseconds and off for 15 microseconds, that’s 50kHz. If you meant milliseconds instead of microseconds, then it’s 50Hz.

Either way, as you are only switching a 6W load, you should be able you use logic-level mosfets without gate drivers - but if you really did mean microseconds, then I suggest you use mosfets with low gate charge in order to keep the switching times low.

Thanx yes my mistake, in that case I meant milliseconds, as in 1000th of a second. If I do high side switching will I have to switch the p type mosfet with an n type mosfet?

calvingloster:
If I do high side switching will I have to switch the p type mosfet with an n type mosfet?

It's probably easier and cheaper to switch the P-channel mosfet using an NPN transistor.

Would a mosfet not be better for switching purposes because it uses less current? What is the differents in switching the p type mosfet with a npn transister or a n type mosfet?

I'm honestly confused with the differences between the transistor and the mosfet. I don't know which one is better to use depending on the application. I've been reading up like crazy about transistors and mosfets in hope that I can have the knowledge to know what to use when but its too confusing:(

calvingloster:
Would a mosfet not be better for switching purposes because it uses less current? What is the differents in switching the p type mosfet with a npn transister or a n type mosfet?

I’m honestly confused with the differences between the transistor and the mosfet. I don’t know which one is better to use depending on the application.

There are many situations in which you can use either a mosfet or a BJT (= bipolar junction transistor). This particular case (driving a P-channel mosfet used as a high side switch from an Arduino pin) is one of them. The reason I suggested a BJT instead of a mosfet is that small signal BJTs in non-SMD packages are cheaper and more widely available than small signal mosfets in non-SMD packages. So unless you are making a PCB using SMD components, then whenever you have the choice of using a BJT or a mosfet, a BJT is usually the easier and cheaper option.

dc42:

calvingloster:
Would a mosfet not be better for switching purposes because it uses less current? What is the differents in switching the p type mosfet with a npn transister or a n type mosfet?

I'm honestly confused with the differences between the transistor and the mosfet. I don't know which one is better to use depending on the application.

There are many situations in which you can use either a mosfet or a BJT (= bipolar junction transistor). This particular case (driving a P-channel mosfet used as a high side switch from an Arduino pin) is one of them. The reason I suggested a BJT instead of a mosfet is that small signal BJTs in non-SMD packages are cheaper and more widely available than small signal mosfets in non-SMD packages. So unless you are making a PCB using SMD components, then whenever you have the choice of using a BJT or a mosfet, a BJT is usually the easier and cheaper option.

ok thanks. Im trying to order now, could you please have a look at these and tell me if you think they will work? how do i tell what voltage the gate needs?

The data sheet of the above one said max 600v and 1A. But 600v is way to much? like i only need it to handle 12v. and i dont know what voltage the gate needs? how do i identify this in the spec sheet?

Im looking at the red underlined and circled part of the spec sheet below, does it say that it requires minimum 2v and max 4v to be fully switched on?

and then regarding the red circled part, is that the switching time at 300v ?. the arduino cant supply 300 volts so how can i tell what the switching time will be at 5v?

Or would this one be a better bet? its drain source voltage is 30 v with max amps at 10A
http://za.rs-online.com/web/p/mosfet-transistors/7192881/

calvingloster:
Im looking at the red underlined and circled part of the spec sheet below, does it say that it requires minimum 2v and max 4v to be fully switched on?

and then regarding the red circled part, is that the switching time at 300v ?. the arduino cant supply 300 volts so how can i tell what the switching time will be at 5v?

Look at the line for Rds(on). The gate voltage at which it is quoted is the gate voltage you need to be certain of turning the mosfet fully on, and the drain current at which Rds(on) is quoted is the maximum current you should switch with that gate voltage.

Sometimes you will see Rds(on) quoted at two or more different gate voltages, with a lower drain current used at the lower gate voltage. The lower gate voltages are OK to use provided you stay within the corresponding quoted drain currents.

In practice, the switching time for a logic-level mosfet driven directly from an Arduino pin via the recommended 100 ohm resistor depends on the total gate charge. Multiply the total gate charge by 60 to get a very rough figure for the switching time. [Justification: Arduino pin output resistance is about 20 ohms, giving 120 ohms total. The gate plateau voltage is typically between 2V and 3V, so there will be around 2V across the 120 ohms, giving a current flow of about 1/60 amp to deliver the gate charge.]

calvingloster:
Or would this one be a better bet? its drain source voltage is 30 v with max amps at 10A
http://za.rs-online.com/web/p/mosfet-transistors/7192881/

Yes, that's a perfectly good choice for switching 12V @ 500mA. It has Rds(on) quoted at Vgs = 4.5, so you can drive it directly from an Arduino.

Personally, for prototyping work I would normally use a BJT (e.g. BC337) and not a mosfet for switching 500mA @ 12V; and if making a PCB then I would use a small SMD mosfet such as TSM2314CX.

If the load you are switching is inductive, then don't forget to use a flyback diode.

dc42:

calvingloster:
Or would this one be a better bet? its drain source voltage is 30 v with max amps at 10A
http://za.rs-online.com/web/p/mosfet-transistors/7192881/

Yes, that's a perfectly good choice for switching 12V @ 500mA. It has Rds(on) quoted at Vgs = 4.5, so you can drive it directly from an Arduino.

Personally, for prototyping work I would normally use a BJT (e.g. BC337) and not a mosfet for switching 500mA @ 12V; and if making a PCB then I would use a small SMD mosfet such as TSM2314CX.

If the load you are switching is inductive, then don't forget to use a flyback diode.

Thanx for the help man really appreciate it. the funny thing is when i ask people what mosfet i must use then they say "ill personally use a bjt" then when i ask what btj i must use then they say " i'd personally use a mosfet" haha is it just a matter of personal preference?

should the diode be between the arduino pin and the gate resistor in series?

Thanx for the help man really appreciate it. the funny thing is when i ask people what mosfet i must use then they say "ill personally use a bjt" then when i ask what btj i must use then they say " i'd personally use a mosfet" haha is it just a matter of personal preference?

Not really always just preference, but certainly devices on hand that can work are always more likely to be used. When you get into the higher current applications, say above 3 amps or so then modern MOSFETS with their very low Ron values can save a lot of heat and inefficiencies compared to BJTs.

Ok now here is the next problem, i can only find one p type mosfet that might work for high side switching but Rds (on) is 5v? is 5v not too high? i know the arduino pin outputs 5v but will the diode and resister not drop this voltage slightly thus making the mosfet not turn on properly?