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.
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.
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...
And Larry, your diagram is what I have, except I don't have a diode on the load.
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.
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.
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)