I am a beginner with arduino and was wondering how to use an arduino to open a 24 volt sprinkler valve . I will be using a push button to do this.
The best way is probably just a 5V relay module:
Technically it could also be done with a transistor or mosfet with a flyback diode
But the component parts together would probably cost more than this module.
Even when using a relay to maneuver a inductive load like a solenoid valve it is a good idea to use a freewheeling diode or a snubber circuit. Your relay will be much happier....
Yes, I forgot to mention that you need to do that to protect the switching device used on the module to turn on and off the relay whether it is a transistor or a mosfet. It still needs protection from the back EMF but usually those relay boards already have the diode built in so I didn't mention it. You need to look at the board to see if it has the diode. and do a continuity check from the cathode to the +Vcc and from the anode to the collector of the transistor or drain of the mosfet.
My point was that there should be a snubber circuit or a freewheeling diode across the relay contacts for this reason:
Every time you break a current in a electromechanical device you will get an arc. This is inevitable because the electrical field-strength (U/d) is very high the moment the contact surfaces start separating. It is this arc that scorches the contact surface and limits the life span of the device. The scorching is dependent on two factors:
- The intensity of the arc which depends on the current
- The time of the arcing which depends on the voltage
There is not much to do about the intensity/current but the voltage can be limited. This is especially important when switching of inductive DC loads.
As i wrote, there should be some limiting device across the contacts as well. Remove tha capacitor from the breaker points of car ignition and the points last about 20 seconds...
see attached.

Exactly!
Are you happy now ?
Your relay will be....
The arc-suppression snubber does reduce the degradation of the contacts and prevent them from being vaporized one molecule at a time from the extreme heat of the plasma arc that occurs in a period of microseconds as the contacts get within and without the
ionization of air distance (1,000,000 V/per meter = 1 V/uM or 1000V /per mM , or 100V per 0.1 mm (100 nm) or 24V /0.024 mm .
This number is arrived at by dividing 1000000 V by 24V and then dividing 1000 mm by that value. This division tells you that when the contacts are within 0.024 mm (24 nanometers) they will arc until they MAKE contact and then when the contacts open, they will arc during the period that the contacts are within 24 nanometers of each other.
The temperature of an electric arc
Arc flash temperatures can reach or exceed 35,000 °F (19,400 °C) at the arc terminals.[2] The massive energy released in the fault rapidly vaporizes the metal conductors involved, blasting molten metal and expanding plasma outward with extraordinary force.[2

