MOSFET type issues

Hi, I thought I understood what I needed, but turns out I just don't understand.

I use Arduino PWM output pin to control a MOSFET, which is connected to a 12V source.
If I use the MOSFET IRF520N, I can varry the output voltage from 0 to 12V.
If I use the MOSFET IRL540N, it only lets me varry the output voltage from 0 to 2.5V.

I thought the IRF520 was non logic, so I should get the IRL540 because it's logic controled.

I have no idea what's going on. I would appreciate an explanation if anyone has one.

Show us a good schematic of your proposed circuit.
Show us a good image of your ‘actual’ wiring.


In the Arduino IDE, use Ctrl T or CMD T to format your code then copy the complete sketch.

Use the </> icon from the ‘reply menu’ to attach the copied sketch.

To be more sure I ask You to post schematics. That way the number of useless guesses will be less.
I hope You use N channel logic level MOSFETs switching the low side of the load.

It is really the simplest of circuits right now. I did a diagram in MS Paint. Maybe my fan should be on the S side, not D? I didn't test that out.MOSFET issue

That should be Ok , have you measured what gate /source voltage is ? :woozy_face: The IRF520 is logic level whereas the 540 requires at lest 10 Volts to "turn on".

This would be the connection.
Pin 5v means an Arduino output that goes between 0v and 5v.

Write a simple sketch that turns on and off the Arduino output pin every 5 seconds, no PWM.

measure the voltage from Drain to Source (GND).

What are the two voltage readings do you get ?

You're correct, the MosFets are not performing as would be expected looking at the data:

I would suggest you change the output to digital and see what each MosFet's drain to ground voltage is in a static situation. Also measure the gate to ground.

Have you switched back and forth a number of times to be sure its not a bad connection?

I swapped the MOSFETs and even tried with a mosfet module, where I changed the IRF520 to IRL540, and I get the same results. Measuring at load is opposit of what I expected. I thought the IRL540 was what I needed, but the IRF520 is giving me the behavior Im looking for. That's why I'm completly confused... :frowning:

And Larry, your diagram is what I have, except I don't have a diode on the load.

Its important to do the static "ON" test. It will tell you if the MosFet is fully on or not.

Test your two MOSFETs as stated below.

Write a simple sketch that turns ON and OFF the Arduino output pin every 5 seconds, do not use PWM.

Measure the voltage from Drain to Source (GND).

What are two voltage levels that you see ?

Summarize your results so we can see them.


Your summary should look something like this:

  • IRL540N drain voltage goes from 0.1V to 12V when the I/O pin goes from 5V to 0 V
  • IRF520N drain voltage goes from 0.5V to 10V when the I/O pin goes from 5V to 0 V

And as has often been said before, please supply a link to the ACTUAL component you are using (12V fan)

We need to know exactly what hardware you have. We need to know what Arduino board (or other brand, such as ESP32) you are using and exactly what other hardware you are connecting it to. The more details we have, the easier it is to help.

If you are using something that is a non-Arduino product then it helps to have a link to its technical data sheet or a link to where you bought it.

Oops! :crazy_face:

:persevere: :woozy_face: ouch !

Using 5V on or 0V off, here are the results. I wish I knew how to interpret data sheets.
The 12V resistance now is an incandescent 12V light bulb. The diagram is unchanged and the Resistor is a 10k ohm.

IRL540N drain voltage goes from 0V to 2.4V when the I/O pin goes from 0V to 5 V
IRF520N drain voltage goes form 0V to 12V when the I/O pin goes from 0V to 5 V

I was expecting the same behavior from both MOSFET, but I thought the IRL540N would be more efficient. However, it doesn't seem to be turning fully on at all. While I'm not good at reading the specs, I thought I at least knew how to read them a little bit.

I would expect the voltage from drain to ground to show more or less the opposite behavior of what you posted above.

If the MOSFET is off, the drain voltage should be equal to the supply voltage.

You have something a-about.
When the gate is on the drain should be low.

Something is amiss. Perhaps your IRL540N is an imitation?

Can you manually put 12V on the Gate of the IRF540N? (the max spec is 16V). It should be fully ON with a Vgs = 12V

It definitely sounds like the IRL540 is hosed.

Perhaps bad/damage from static/fake.

If you ran the fan (current unknown) without a kickback diode, the MOSFET may have been killed on the first PWM cycle.

Anything is possible, but this MosFet is Avalanche Rated. If they are still using IR's process it would be tough to damage it with a 12V fan (assuming it is like a PC case fan)