Solenoid valve is small device which controls water or air flow and Arduino can operate this valve using relay.
Relay then works like switch and Arduino gives signal to relay and relay then turns valve ON or OFF; also this project for Solenoid Valve Control Circuit using Arduino is simple and useful.
Arduino Code:
void setup() {
pinMode(7, OUTPUT);
}
void loop() {
digitalWrite(7, HIGH);
delay(5000);
digitalWrite(7, LOW);
delay(5000);
}
Coding Explanation:
- pinMode sets pin 7 as output pin.
- digitalWrite HIGH sends 5V signal to relay.
- Relay turns ON solenoid.
- delay 5000 keeps valve open 5 seconds.
- digitalWrite LOW turns relay OFF.
- Valve closes.
- delay is again for 5 seconds.
- Loop repeats.
Circuit Working:

Parts List:
| Components | Quantity |
|---|---|
| Arduino UNO | 1 |
| 5V Single Channel Relay | 1 |
| USB Cable | 1 |
| 12V DC Power Supply | 1 |
| 12V Connector | 1 |
| 12V DC Solenoid Valve | 1 |
A 12 volt solenoid valve requires high power, and the Arduino cannot provide this power; therefore, a relay connects the Arduino to the solenoid valve.
Then Arduino sends low power signal to relay input pin and relay coil becomes active and then relay connects 12 volt power to solenoid valve and valve opens.
When Arduino pin goes low then relay turns OFF and relay disconnects 12 volt supply and then valve closes; also Arduino and relay share common ground.
Formula with Calculation:
Relay coil voltage = 5V from Arduino
Solenoid valve voltage = 12V from power adapter
Current of valve = around 300 mA typical
Arduino pin current = around 20 mA max safe
Relay isolates Arduino from high current load
Power of valve = Voltage x Current
Power = 12V x 0.3A = 3.6 Watt
How to Build:
To build a Solenoid Valve Control Circuit using Arduino follow the below steps:
- First, gather all the parts as shown in circuit diagram.
- Next, Arduino 5V go to relay VCC, Arduino GND go to relay GND and Arduino digital pin 7 go to relay IN pin.
- Then 12V DC power positive connect to relay common terminal COM and relay normally open terminal NO go to solenoid valve positive wire.
- Also, solenoid valve negative wire goes to 12V DC power negative.
- After that, the positive pin of the connector goes to Relay module COM terminal and the negative pin of the connector goes to Solenoid valve negative wire.
- Finally, make sure Arduino GND and 12V negative join together for common reference.
Conclusion:
To conclude, this Solenoid Valve Control Circuit using Arduino is easy for control system, as Arduino cannot drive solenoid directly, so relay gives safe switching.
Also, circuit is simple and cheap and is good for beginners and further, is useful for water control, irrigation and automation.