Using MOSFETS with TTL levels

FETVarious Arduino projects that need to switch a high DC load are using MOSFET’s to do this, according to the circuit at the right (R1 is optional and may be necessary to switch off the FET if the pin goes low.

Popular MOSFET’s that are used are the IRF510 and IRF 520

irf510 irf520
IRF510 IRF520

Looking at those graphs one can see that at a gate to source level of 5V (Arduino levels) the IRF510 is only capable of delivering 1 Amp, whereas it is specified for 5,6 Amps continuous current. The 520 is somewhat better: at 5 V it delivers 3 Amps from its max of 9.2. This is because these FET’s are designed to pass the max current at gate voltages of around 10 Volts and that is beyond what most microcontrollers can deliver.

For the IRF522 it is even worse.


Looking at the curve, at a gate to source voltage of 5V the IRF522 is hardly turned on. You are limited to a current of about 200mA. Much better to use a cheap Darlington transistor then.

The IRF530 is a better choice:

At 5V volt on the gate, the IRF530 will pass something around 4.5Amps.

If you are shopping for a MOSFET for the Arduino consider the IRL540 The L shows that is a logic level mosfet. A logic level mosfet means that it is designed to turn on fully from the logic level of a microprocessor. The standard mosfet (IRF series etc) is designed to run from 10V.

Here is the curve for the IRL540:


Now at 5V you are out of the linear region and the MOSFET can already deliver its specified 28 Amps continuous current.

You may also consider the IRLZ44.

The IRLZ44 data-sheet says that with a 3V TTL-level drive the FET drops less than 0.15V at 4A (at 25C, Rds(on) is about 0.04 ohms), and under 0.25V at 175C (Rds(on) < 0.063 ohms).
So we know the FET’s I^2-R ohmic dissipation will be under 1 watt, and that’s good. If we use Vgs = 4V, specified for AVR chip outputs, the dissipation should be about 0.4W at 25C (0.8W for Tj = 175C).

Wether a MOSFET is a standard MOSFET or a ‘logic’FET becomes clear from the Datasheet. If for instance you look at the Datasheet  of the IRFZ44N at the Rds(on), 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. A logic level MOSFET will have Rds(on) specified for Vgs=5V or 4.5V.  If its only specified for Vgs=10V, its not logic-level.

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).

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 linear resistor.  If for instance you want to switching 5A in a 12V circuit and you only want to waste 0.5V across the MOSFET, then its on-resistance (Vds(on)) should be <= 0.1 ohms (0.5V / 5A)

The dissipation then is 5x5x0.1=2.5 Watt. But suppose the FET 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 the load is on for more than a second or two, but it is no issue if it gets millisecond pulses every few seconds.  ‘ON-resistance’ of 0.2 to 0.001 ohms are available (though less than 0.005ohms gets expensive).

The relatively cheap BUZ11 is also an option. Although it is no Logic level MOSFET, it will go into saturation with a 5 Volt gate voltage  at around 7 amps and a VDS of about 0.5 to 1 Volt. But  it’s RDS(on) will be far from ideal and you will lose 3.5-7 Watts in the FET:

Should you however be stuck with a FET like the IRF522 that really needs a high voltage to switch efficiently then use the following circuit:

Realise though that it is an inverting circuit. A HIGH on the Output of the Arduino will switch the Load Off. Also the 520 and 510 will be more efficient with this circuit.

MOSFETwith low voltage input
Remember to use a heatsink for the MOSFET if you are using any serious loads

If you are using this circuit to switch any serious loads, then it is wise to solder some thick wire over the tracks coming from the MOSFET. You will find the print design here. This is for direct transfer so it is already mirrorred the right way.

If you have a non logic FET (like the IRF series and need some galvanic separation from your  microcontroller circuit, the following circuit comes in handy:

68 thoughts on “Using MOSFETS with TTL levels

  1. Rob, the 10 k resistor is there to pull the gate of the FET to a high enough level to fully open up the FET.
    If it is not there, the gate will not get any voltage from the 12 V power source.
    If it would be just a wire (i.e. 0 ohm, it would be quite hard to close the gate without shorting the power supply when the transistor closes. You’d probably fry the transistor as well

  2. recreated this with pn100 tran and irf1405 mosfet

    reverse R1(to gnd) and T2(C to Vcc E to T1g) to run it non inverting

    good learning curve as i knew next to nothing about transistors at the begging

    1. Joe, good idea, but as I picture your changes, the emittor will be at 12 Volt when open, while yr Arduino will set the basis at a max of 5Volt, which would cause the transistor to close again. But if it is working for you, that is good

      1. foutIs this what you mean? I have a hard time believing it would work properly for reasons I explained earlier, but if you say it works for you… great

  3. Thank you for the clear explanation. Is it possible to use two (or maybe three) IRF510 to handle more amperage? It would probably be best to just buy a FET that could handle the higher amperage, however I have some IRF510 s in my parts bin.

    1. Apologies foe my late reply. I haven’t been paying attention. As far as I know it is possible to put FETs parallel but I think it is better to get one w a higher rating, just in case the FETs don’t open at the same moment

  4. Excellent post, was very illuminating! In the schematic where you show the BUZ11 FET, are R1 and R2 functioning as a voltage divider?

    1. Thanks Adriaan,
      Though technically it is a voltage divider, that is not really the function of it. R1 is just there to limit the current through the gat, coming from a microcontroller pin.
      the function of R2 is to tie the gate to ground in case there is no input attached. As FET’s usually have a high impedance, leaving a gate ‘floating’ may make it be high or low and the attached lamp might go on when there is no signal

    1. the LM324 is a quad opamp. driving a mosfet with it is basically attaching the output to the gate of the MOSFET. Not sure though what bridge you need. Is it for audio? Or for a power rectifier?

  5. Would like to have a non inverting driver, do you have any recommendation how to solve this, or best IC driver for arduino.

    1. if you drive a logic Mosfet directly from your arduino it is non inverting. so I am not entirely sure what you need

      1. Im actualy pondering the same question as Legolas. How can you design a non inverting circuit for controlling a non logic level mosfet where the 5v the arduino can provide is not enough to “open” the mosfet enough.

        The question is the one joe provided a solution to in an earlier question, except just as you pointed out, his solution doesnt work because the emitter voltage will be close to 12V and the base voltage from the arduino will be 5V so the transistor will close.

      2. Well, you would need to put an inverter before the circuit i provided, either by a logical gate or with yet another transistor. I am not sure if there is an easier way to do it. But it would be a bit of an uneconomic solution compared to just using a logic level MOSFET. If you come up with an idea I would be happy to hear it.🙂

    1. yes you can, but the question is reallt too genereic to give a good answer to as there are probably better ways to drive astepper motor from an Arduino. If the steppermotor does not draw too much, think about an ULN2803

    2. I see. That was a MOSFET motordrive board you referred to. It doesnt look dedicated to a steppermotor though, more to drive a rgular DC motor.
      There are ready made driver modules for stepper motors, check aliexpress, or, depending on yr motor, use a 595+ULN2803

  6. Hi,
    I try to make something like this but I’m not using arduino but a PIC18F4550. I should turn on a load (some LED lamps in paralel) with a Mosfet. In my schematic I use an output with a small resistor (150 Ohms) in series with the gate of the N Channel Mosfet (STP3NA) and my load is in drain (like the first schematic showed in this post, but I have no R1 resistor between gate and source, I only have a resistor like R1 in the second schematic). So, when I put the output high some of my LED lamps doesn’t turn on immediatly, it seems that has a flash before turn on. Is that normal? I think that is not normal. Who can tell me what should I improve i my schematic? Should I try to use a BC337 for exemple to turn on the Mosfet like the schematic 3 and in this case when I put my output high the Mosfet is off, so I should put it Low to turn on my load, is it?
    Thanks all

    1. Dinah, that your lights do not light up immediately seems kinda odd, but could be a habit of the lamp you are using. What kind of lamp is it?
      wether to use a resistor in the gate line is a matter of debate, some say no, some say yes. I have chosen to put one in just to be sure. Normally the impedance of a FET is high enough to not lose any signal over that resistor. The gate source resistor is purely to make a predefined state and to avoid the entrance to float
      I do not know the PIC18F4550 that well, but what is important is the Output voltage it has on its pins. The STP3NA I do not know very well and I couldnt quickly find a readable datasheet, but though it doesnt seem to be a Logic level FET, from what I could see, it should open enough around 3 volt already… but if you have a better datasheet, please check that.
      If it does open at 3 volt and your PIC supplies that, adding a transistor is not really necesary and if you do it doesnt need to be the BC337, can be a regular signal transistor too, like the 547.
      What i like you to do first is to detach the pic-circuit and just put 5 Volt on the entrance of yr FET circuit, via say that 150 ohm resistor, and see if then your lamp behaves the same.
      Let me know

  7. Hello – Great post ! I’m trying to build a H-bridge with mosfets (switching from ‘old’ NPNs and PNPs …). Could you please recommend a logic-level P-channel equivalent to the IRLZ44 or IRL540 ? Thank you. Olivier.

    1. Somehow Logic P channel mosfetsarent as plentiful. You could consider the FQP27P06.
      I presume you are aware of the designcriteria of an H-bridge and the chances of shorting your PSU if you dont do the switching correctly.
      Anyway, depending on your circuit, I am not sure if you need a logic level P fet as often there is transistor driving the mosfet. good luck

      1. Thanks – You are correct. The two P-channel mosfet will be driven by transistors. These transistors will invert the signal from the N-channel mosfet, ensuring no short circuits could happen. The driver will have only 2 inputs, allowing off, fw, rev and brake. I need TLL mosfets just because the motor is ~5V max…

  8. Could I use the IRL540 (or IRL540N) in order to activate a on/off +24Vdc/10A solenoid valve? The circuit should be robust enough to support the load during a few minutes.

    1. oddly i replied twice and my answer just doesnt get logged. OK I try again: Yes you can. The IRL540N can take 36 amps. Please bear in mind that eventhough a logic level FET, the IRL540N is not at its lowest resistance at 5 Volt, but it shld be low enough to make 10 amp no problem

  9. Can i use this circuit with Arduino to drive 2 x 20W (1.6Amp each) LED Auxiliary lights on my motorcycle? I will use Arduino to dim the power acording to inputs from handlebar.. Please help. I´m am looking for a good reliable circuit to PWM the lights. Cheers!

    1. you could do that, but an Arduino might be a bit overkill. An attiny85 could do that as well. But then again, if bought at the right place.. a bare Attiny85 may cost 80 cts and a complete arduino pro mini only 1.60 euro

  10. Hello.

    I would like to control my marine tank LED’s at 4amps 12v and have a IRF540 what circuit would be best suited to this type of application and part?

    1. The IRF 540 can obviously take 4 amps, but sadly it expects a higher voltage on its gate than the most microcontrollers can deliver ( i presume you will use a microcontroller). That means you have to have a 12 Volt driver as in this circuit:
      However keep in mind that that driver inverts as well, so you have to invert your signals (HIGH-> off ; LOW-> ON).
      Really my advice would be to get a different FET, use the Logic level FET’s, such as the IRL540.
      I am not sure where you are based but the IRL540 costs abt 60 cts where I am.
      That just will make your circuit much easier and save you a transistor and resistor.
      Good luck, but dont hesitate to ask again shld you need further advice

      1. Hi.
        Thanks very much for your time.
        Yes im using Arduino to control the circuit.
        I will try source a IRL540.
        So no R1 and T1 from your diagram link?

  11. Hello
    I have IRL3713 and IRL540. I tried to switch an IR LED to control the air conditioner. I noticed that the range is very low. When I conneted a BJT (2N2222) it was ok, range was above 4 meters.
    I couldn’t understand the datasheet of IRL3713. The current of a MOSFET is Ids =K*(Vgs-Vt), so it should be constant for some Vds. But where can I find K in the datasheet? Also, from the graphs, Ids changes with Vds, is it because of the channel shortening effect? How can I find the current in the LED?

    1. IR LED’s usually have a high (80-100mA) current they can take. Do you have a type number for the IR LED? Then you can find the current in the datasheet?
      remains the question why you would want to use a bulky IRL540 or an IRL3713 (which i think is a double MOSFET
      When you were using the 2n2222, what seriesresistor did you use. Was that the same as for the mosfet?
      Your formula Ids =K*(Vgs-Vt), is only valid under some circumstances depending on whether Vgs is bigger than Vt or not and wether Vds is close to the saturation or not. But in reality you dont need that formula as it mainly has to do with the range wherein the FET DrainSource acts as a pure resistor.
      The IRL540 is a logic level FET and putting 5 Volt on the gate should be enough to open it up, albeit that it has a drain source resistance of less than one ohm, though that depends a bit on the current and the temperature.
      I would suggest that you just use a 2n2222 or BC547 (or similar) and if you have a regular IR LED like SFH487 (880nM) or an LD274 (950 nm) drive them with 80-100mA.
      the 2n2222 has a collector current of max 800mA so that should not be a problem. For a BC547 it is a bit on the edge.
      Generally, IRLED’s have a forward voltage of 1.4-1.5 Volt, so you need a seriesresistor. The Vce in saturation is about 0.3-0.4 Volts so you need to have a voltage drop of 5-1.7=3.3 Volts. For a 100mA current you then need a seriesresistor of 33 Ohm. Use a baseresistor of say 560 Ohm.

      That also explains why it is foolish (sorry) to use a powerfet to drive a 100mA IRLED. The IRL540 is aimed at currents up to 28 Ampere and therefore it aims at having a very low RDSon. However, since your LED NEEDS a seriesresistor at 5 Volt, there is no point of choosing a FET with say a 0.077 Ogm resiatance, only to then add a bigger series resistor.
      Anyway, my questions
      Which IR LED?
      What seriesresistor did you have on the 2n2222
      What seriesresistor did you have on the FET
      and maybe most of all… Why do you want to use a FET

  12. How we connect irf450 mosfet , here the problem is ….it required 20 v to turn on and from ic 555 i cannot get it

    1. you make a mistake. The irf450 doesnt need 20 Volt tu turn on. It already switches on at much lower voltages, albeit not completely, but the optimal voltage is around 10-12 Volt. The 20 Volt you probably saw in the datasheet, but that is the max voltage on the gate.

      As the 555 can be fed with up to 18 Volt, it shouldnt be a big problem to use the 555 to switch. If you feed it with 15Volt the output voltage is around 12-13 volt which will do the job

  13. I’m trying to switch a 3.7 volt 3A peak load (LoNet SIM800L breakout board) using an IRL540N with 5.2 volts on the gate but the circuit keeps shutting down. I’m using a 3.7 volts LiPo battery as a power supply. And a step up boost converter to supply the 5.2 volts on the gate. According to your post and the datasheet, the IRL540N should have no problem supplying the current at this voltage, right? Or am I overlooking something? When I power the SIM800L directly from the LiPo it runs fine. Please help me out. My hairs are starting to turn gray😦.

    1. That indeed is odd and I start to wonder if it is the IRL540 that is shutting down or something else.
      Maybe you alreadymeasured it but just to make sure, when your problem aises, have you measured if there is still voltage on the gate or even voltage on your PSU?
      What type of step up converter are you using?
      Try (just to test) without the converter, 3.7 Volt is not ideal but still should open the FET somewhat, and tell me what happened.
      Do you have the break out board in the drain or the source?

      1. HI, thank you for your fast reply and I’m glad you agree that this is odd behaviour! I seem to have missed your reply at first since I did not subscribe to your posts fast enough apparently😦, but I’m here now.
        I have done like you said. It shows the same behaviour when I use 3.7 volts on the gate directly instead of using the boost converter. I am using this converter: Perhaps it is a lose wire or something. The battery is ok and gives a steady 4 volts. I’m using a breadboard. Perhaps one of the wires is corrupt. I will try it again after soldering it instead of using a breadboard.

  14. Hi there,

    Can I use PC817 Optocoupler instead of 4N35?

    And what if I wish to use 5V or 9V instead of 12V input, the R1 (100R), R3 (1K), R4 (40K ???) will stay the same values?


    1. in principle u can use any optocoupler

      With regard to 9V and 5V input, I presume you mean supply voltage. Well there is a bit of a problem there, Not with the resistors but with the FET as those voltages are too low for the IRF540. You need a logic fet for that such as the IRL series

  15. Very good article, thanks for talking about a subject often overlooked by many. Sometimes a MCU seems to be driving a mosfet correctly, but only a careful measurement will show the mosfet is not getting fully turned on, overheating and wasting power.

    However, I would like to point that some mosfets not rated as “logic-level” are also very good for the job. I’m a fan of AO (Alpha and Omega) mosfets, and the model below (as an example) will show extremely low Rds(on), even on voltages as low as 3V, but yet, the datasheet rates Rds(on) at Vgs = 10V:

    So, the bottom line is: always check the whole datasheet, specially the Vgs / Rds(on) curve, if the datasheet has one. A mosfet may have great performance at low voltages, even if the datasheet initially rates it at Vgs = 10V.

    1. Thanks for your contribution. That 52 mOhms at 2.5Volt definitely is pretty good. better even than some TTL level MOSFETS. Thanks for pointing out that series. I was not aware of those.
      Checking the datasheet is always a good suggestion. Some people however have trouble reading a datasheet or do not know what to look for and in that case foing with TTL level FETs is a safe option.
      Many of the cheap MOSFET driver boards available at say Dealextreme or aliexpress are with an IRF520 or IRF540 and though these will do they job, they are definitely not the best, as 5 Volts just not high enough to open them up. The 2n7000 series, often used with the arduino is even worse in that aspect, but if used to switch an LED it is OK (rdsOn about 40-50 ohms at 4.5V)
      The AO6400 you refer to can handle almost 7 ampere. That is definitely enough for most applications.
      It is not expensive: If bought per 20 it is 26 eurocts a piece.

      1. Glad to be able to contribute! The only caveat using those AO parts, is their size: they are tiny, SOT-23 package, and that bring problems on soldering, and also on power dissipation!

        I already set a few of them on fire during testing / development, because they can’t stand much current in the linear zone. So, mistakes during development can be fatal.

        They indeed can stand almost 7A, but only when sufficiently on or off. For example, when used with a high frequency PWM and high amps, careful testing must be done, because high frequency means more time spent in the linear zone, and these parts can quickly get hot and burn, differently of TO-220 parts, that can also burn, but only after some minutes of overheating.

      2. Switching speed indeed is important. I emphasize that in my AC dimming with PWM article as in a MOSFET article I am still working on. I can imagine that a SOT23 indeed can only take a current the size of 7 amps if there hardly is any dissipation (read low RDSon). MOSFETs make excellent switches but bad resistors🙂.
        A spec the the size of an SOT23 only needs a little heat and it is gone🙂

  16. Did you test something like AP90T03P-HF?
    Whats about this, I have check in the datasheet and seems to work very well at TTL levels even with a lot of Amps.

    1. The AP90T03P-HF is an interesting Mosfet. It is not a true logic level mosfet, it needs some 10 volts. However it has a very low Rdson. At 10 volt it is 4mohm and the fet can take 45 amp, but at 4.5 it is 6mOhm and can handle 30 amps. at 5 volt it is about 4.5 mOhm, so it will function well at TTL levels.

Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s