Solenoid Water Liquid Valve – Arduino Tutorial

4,224 views

Introduction

Interfacing a liquid solenoid one-way valve with an Arduino UNO is an interesting and useful application for automating fluid control systems. The liquid solenoid one-way valve, also known as a check valve, is an essential component of many fluid systems that require unidirectional flow. When interfaced with an Arduino UNO, the solenoid valve can be opened and closed in a predetermined manner, allowing precise control of the fluid flow. This has many potential applications in areas such as home automation, agriculture, and industrial processes.

The Propane 12 Volt Lock Off Solenoid Valve is a valve designed for controlling the flow of propane, liquid, vapor gas, and other compatible media. The valve is equipped with a solenoid, which allows for remote operation by an electric current. The valve has a 90-degree lock-off configuration, which ensures reliable operation and prevents the possibility of accidental gas leakage. It can be easily interfaced with an Arduino UNO to control the flow of the media using an electrical signal.

Hardware Components

You will require the following hardware for Interfacing Water Liquid Valve with Arduino.

S.noComponentValueQty
1.Arduino UNO1
2.USB Cable Type A to B1
3.Relay1
4.Liquid Solenoid Valve1
5.Power Adapter12V1
6.DC Power Jack1
7.Power Adapter for Arduino9V1
8.Jumper Wires1

Steps Interfacing Water Liquid Valve with Arduino UNO

  1. Define a constant integer variable RELAY_PIN and assign it the value A5. This variable will hold the Arduino pin that connects to the IN pin of the relay.
const int RELAY_PIN = A5;
  1. In the setup() function, initialize the Arduino pin specified in the RELAY_PIN variable as an output using the pinMode() function.
void setup() {
  pinMode(RELAY_PIN, OUTPUT);
}
  1. In the loop() function, turn on the relay by setting the voltage of the specified pin to HIGH using the digitalWrite() function.
digitalWrite(RELAY_PIN, HIGH);
  1. Wait for 5 seconds using the delay() function.
delay(5000);
  1. Turn off the relay by setting the voltage of the specified pin to LOW using the digitalWrite() function.
digitalWrite(RELAY_PIN, LOW);
  1. Wait for another 5 seconds using the delay() function.
delay(5000);
  1. Repeat steps 3-6 continuously until the Arduino is powered off or reset. This will cause the relay to turn on and off every 5 seconds.

Schematic

Make connections according to the circuit diagram given below.

Wiring / Connections

ArduinoRelay
5VVCC
GNDGND
A5INP

Installing Arduino IDE

First, you need to install Arduino IDE Software from its official website Arduino. Here is a simple step-by-step guide on “How to install Arduino IDE“.

Code

Now copy the following code and upload it to Arduino IDE Software.

const int RELAY_PIN = A5;  // the Arduino pin, which connects to the IN pin of relay

// the setup function runs once when you press reset or power the board
void setup() {
  // initialize digital pin A5 as an output.
  pinMode(RELAY_PIN, OUTPUT);
}

// the loop function runs over and over again forever
void loop() {
  digitalWrite(RELAY_PIN, HIGH); // open valve 5 seconds
  delay(5000);
  digitalWrite(RELAY_PIN, LOW);  // close valve 5 seconds
  delay(5000);
}

Working Explanation

The code sets up an Arduino program to control a relay module connected to the Arduino UNO board. The relay module is connected to an external valve, and this code will open and close the valve repeatedly every 5 seconds. In the setup function, the pinMode function is called to configure the pin connected to the relay module as an output pin.

In the loop function, the digitalWrite function is used to set the relay pin high, which will open the valve. Then, the delay function is used to wait for 5 seconds before setting the pin low again, which will close the valve. This process is repeated continuously in a loop.

Applications

  • Liquid dispensing machines
  • Fuel injection systems for vehicles
  • Chemical mixing and dispensing systems
  • Water supply control systems
  • Beverage dispensing machines
  • Aquarium water level control systems
  • Lubrication systems for machinery
  • Cooling systems for industrial equipment

Conclusion.

We hope you have found this Water Liquid Valve Circuit very useful. If you feel any difficulty in making it feel free to ask anything in the comment section.