I am not of an expert and just beginning in electronics, I have tried to design this circuit. The schematic is for the 24VDC-3W solenoid valve which I'll use to control a pneumatic cylinder (required to be quick release/retract of piston). enter image description here

Q1. I have used MOSFET based on the discussion here in forums and I see that they use IRL540 however, I am not sure if this will be compatible with connecting to Arduino nano. If anyone has extra time, I am still confused of the parameters needed to look for to tell when a MOSFET/transistor is appropriate for a design. I see that Vds, Rds_on, etc. are being described, but I am a bit sluggish to understand how this be calculated to the chosen load w/c is the solenoid valve.

I want to be able to defend how is IRL540 MOSFET is compatible to my circuit instead of having other MOSFET (ex. IRLML6344)

Q2. I have seen that it is recommended to use 1N4001 for the flyback diode, but what I have is only the 1N4150, can I use 1N4150? How to understand whether one diode is a suitable replacement for another.

What I have right now to explain the usage of different components in my schematic design is seen below. Is my explanation correct or are there misconception on how I described it?

"RAC20-24SK is AC/DC power eme used to convert 220VAC source to 24VDC to power the solenoid valve. Consequently, the MC708CTG is a voltage regulator that provides 9V to power the Arduino NANO microcontroller.

There are two resistors that are included in the circuit design. R1 is a series resistor, usually in the 100-1k ohm range, between the microcontroller and the transistor. This is used to limit the current into the MOSFET gate during turn-on and also has to do with fault propagation and high-frequency oscillation. For the fault propagation prevention, if Q1 fails, there can be an instance that the gate and drain may be shorted together, by adding R1 in the circuit, it can prevent damage to the microcontroller. As for the protection against high-frequency oscillations, MOSFETs have parasitic components, including inductance in their source leads. During switching, especially at high frequencies, this parasitic inductance can lead to undesirable high-frequency oscillations and ringing on the voltage waveform.

By introducing a resistor in series with the MOSFET, dampening effect on these oscillations is created. The resistor, along with the parasitic capacitances and inductances in the circuit, forms an RC (resistor-capacitor) network, which attenuates high-frequency components and helps to stabilize the switching operation. This minimizes the potential for voltage spikes and transient behavior that could adversely affect other components in the circuit. The resistor R2 is used to ensure that when the microcontroller is in the process of powering up or is in a reset state, during which its internal output becomes high-impedance, the gate of the MOSFET Q1 maintains a specific voltage level. Without R2, the gate of Q1 is left in a floating state when the microcontroller is in reset mode. By introducing R2, it guarantees that the gate is pulled to a low voltage, effectively turning off the transistor Q1.

insert why choose IRL540, what parameters were considered to tell it is capable of driving the load (solenoid valve) "


24VDC-3W-N.C Solenoid Valve - https://docs.rs-online.com/20a7/A700000008651199.pdf

24V AC/DC-830mA Power Supply - https://recom-power.com/pdf/Powerline_AC-DC/RAC20-K.pdf

  • \$\begingroup\$ What is the on-state (high) voltage at D12 (pin 15)? \$\endgroup\$
    – AnalogKid
    Nov 1, 2023 at 14:20
  • \$\begingroup\$ The solenoid value link doesn't have complete electrical characteristics. We need to know the current draw. \$\endgroup\$
    – Mattman944
    Nov 1, 2023 at 14:57
  • \$\begingroup\$ @Mattman944 that's the only datasheet that is provided, but from the document, 24VDC, and 3W would tell that the load current is approximately around 125mA. \$\endgroup\$
    – Bravo
    Nov 2, 2023 at 7:33

1 Answer 1


A2. Yes on the 1N4150 diode. It is rated up to 4 A for a short-duration pulse, way more than enough for your application.

Also, you do not need R1 to help turn off the FET. The uC low output voltage is low enough.

  • 1
    \$\begingroup\$ R1 wouldn't be necessary in a final product, but during development, the GPIO may not be driven at all times. If the gate floats into the linear region you may burn up the MOSFET. \$\endgroup\$
    – Mattman944
    Nov 1, 2023 at 14:40

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.