Controlling The Flow Of Water Using A Relay And A Solenoid Valve
Controlling The Flow Of Water Using A Relay And A Solenoid Valve
Are you tired of going all the way to the tap of your tree-watering pipe to turn it on and off? Well, maybe you aren't but.... our maid was.
So, after thinking and doing some research, my father's colleagues came up with an idea( This problem occurred at my father's office). They thought about controlling the flow of water without having to turn the tap on, using a mobile application, Wi-fi, a Relay and a Solenoid Valve.
But...I'm not going to talk about the entire project, I'm going to share my new learning about a Solenoid Valve and how to connect it to a Relay with some power supply and an Arduino Board.
So, what I needed was:
- A Solenoid Valve
- A Relay
- 10 Watt, 5V Power Adapter
- Some Jumper Wires
There are 2 steps in this connection
Step 1: Powering the Relay Module:
- VCC (Relay) - 5V ( Arduino)
- GND (Relay) - GND (Arduino)
- IN (Relay) - Any digital pin on Arduino
Step 2: Connecting the Solenoid Valve to the Relay:
- COM (Relay) - Any one pole of the Solenoid Valve
- NO (Normally Open) - Positive of Adapter
- Negative of Solenoid Valve - Negative of Adapter
Arduino Usage is optional, but if using, then I've given the necessary code below.
int relayPin = 7;
void setup() {
pinMode(relayPin, OUTPUT);
}
void loop() {
digitalWrite(relayPin, HIGH);
delay(2000);
digitalWrite(relayPin, LOW);
delay(2000);
}
How does it work?
- When Arduino sends HIGH, the relay closes, allowing the current to flow to the Solenoid Valve, activating it.
- When Arduino sends LOW, the relay opens, cutting the circuit, powering the Solenoid Valve off.
Comments
Post a Comment