Controlling a Solenoid Valve from an Arduino

There is now an updated and more detailed post. See Controlling a Solenoid Valve from an Arduino. Updated.

 
Using the Arduino to control the solenoid valve is simply a case of setting a pin high for the appropriate amount of time. There is, however, a caveat, the solenoid works at a different voltage to the Arduino and you cannot directly connect the two. In this case a TIP120 transistor is used as a bridge.

TIP120

The TIP120 allows a small dc voltage (from the Arduino) to switch a larger dc voltage (12V to the solenoid). It can be thought of as a switch, applying a current to  B allows current to flow between C to E.

Read more