Control 24V source with IRF520 MOSFET?

Hi, I have a bare proportional solenoid flow valve PV21-06

I would like to control from my arduino nano. With my laboratory power supply the air flow increases more or less linear to the voltage put on the valve.
I try to reach same with a IRF520 module:

I connect it with the solenoid and a 24V/2A DC source and try to control the output voltage via PWM.
Unfortunately the voltage increases hardly until I reach about 4 volts (PW: Frequency 2000, width:50). From then the output voltage increase exponentially until I reach the full 24V at PWM width 100.

I cant read the IRF520 datasheet, so I dont know if this behaviour is absolutely normal.

Is there a reasonable way achieving a control of the external 24V DC supply?

The IRF520 needs 10V gate drive. A logic-level MOSFET is a must for this.

You also have to have a diode.

Thanks, I bought the often mentioned IRLZ44N and will replace the IRF520. Hopefully this gonna work. Do you mean a zener-diode parallel to the solenoid? If so, which would be suitable for a 24V DC solenoid? Should I use any capacitors or resistors on the load side? Maybe a capacitor on the PWM side? If so, how do I have to dimension any of those?

Interesting! The FET is avalanche protected so no diode is needed. The valve from the data on your link does not use PWM it wants a zero to ?? DC voltage. You can achieve this with a resistor, capacitor and an opamp on the PWM output. This is configured to form a buffered or active low pass filter. Check on line there are lots of circuits and how to configure them. The resistor (R3) goes to the capacitor with the - end grounded. It then goes to the + of an op amp. The output goes to the valve control and to the - of the opamp with a 20 K resistor (R2) in series. If you need more then 5 volt you need to add R1. Gain is R2/R1 +1. The drawing can be gotten from here:

Good Luck, Have Fun!

Thanks for the advice. I dont have all components at home to try out everythink. So far:

Exchanging the irf520 changet hardly anything. Under load there is hardly any linearity between PWM width and voltage on the load. The output volage is 3 Volts width 80 % PWM width , 6V with 90% and 12 with 100%. Decreasing the frequency from 1000 Hz to 100Hz increases the output voltage a lot for the same pulse width. Without load the output voltage is highly linear to the PWM width.

So I think the load must interfere harmfully with the arduino PWM signal? Ot the incuctivity is pushing back?

Just had to add a diode parallel to the solenoid. Now everything works nice and smooth.

Interesting! The FET is avalanche protected so no diode is needed.

FETs may or may not be characterized for avalanche breakdown, they most certainly are not protected from it, nor is it usually safe to use avalanche breakdown unless you have a repetitive rating that's higher than the max energy in your inductor, which means you have to know the inductance of the solenoid.... For PWM the single pulse rating is immaterial.

And with avalanche breakdown your coil insulation has to handle the voltage spikes, and the rest of the circuit may get severe interference too....

So putting a diode across solenoid was correct?

Its one common way to prevent damage. Its not going to guarantee linear behaviour though, that was important to you.

There are interactions between the snubbing method and PWM frequency and load current that are complex and not linear.

I cant understand why company market the irf520 moduals for arduino,they are not logic level,as i see it if they do conduct they will be in the linear region and will fry with any sort of load across them,just my thoughts.

Unscrupulous people dumping old stock (or even counterfeit stock). Knowledge is your defence.

Look at: the IRF520 is definitely avalanche rated. I personally have tested this one and hundreds of others. They will work properly with out an external diode. the data sheet tells it is rated for: Repetitive Avalanche Currenta IAR 9.2 A maximum repetitive, considerably more then your solenoid will generate. The voltage from the solenoid as any other inductor when switched off reverses polarity and will rise until it is limited. The data sheet also shows a Body Diode Voltage VSD TJ = 25 °C, IS = 9.2 A, VGS = 0 Vb - - 1.8 V, indicating the voltage will go to just less then -2.0 volts so there will be no high voltage spikes generated assuming good connections. These datasheets are what the part is capable of doing. All reputable semi manufacturers are very careful to meet or exceed there data sheets or they would not stay in business.
Good Luck & Have Fun!

You don't understand avalanche ratings I think. The maximum energy per spike is important, this depends on the inductance and the current. Single-event and repetitive ratings are different, single event means just that, one event ever for the device - its assumed some amount of damage happens. Repetitive rating is the one where the device doesn't suffer cumulative stress damage.

But you really want to avoid high voltage spikes in your circuits unless there's a good reason, because the EMI is a big problem and puts noise into the rest of the circuit, fails you your compliance testing, stresses other components, etc etc.

The fact a device is avalanche rated simply means its avalanche behaviour has been measured. Not that it is particularly good, just that there's a known set of limits its been tested for. Non-rated parts might have a greater variability in breakdown voltage for instance, leading to inconsistent behaviour in circuits. Also if unrated the behaviour might change between batches considerably, since its not a tested data sheet parameter, the manufacturer is allowed to make it worse (to improve other ratings).