Control Pump Arduino
Control Pump Arduino
Automatically turn on the water tap when our hand move near the tap
BeginnerFull instructions provided1,547
Solinoid Valve × 1
Water tap × 1
12V DC Adapter × 1
Arduino IDE
Story
Automatic Water Tap
In this time, Sharing the water tap or using a public water tap is very
dangerous. This may help to spread the virus. You can read my previous
article here. That discuss about the construction of an Automatic Hand
Sanitizer. The same distance sensor using here. You no need rotate the knob
of water tap to turn on or off.
How it works?
Working is almost same as my previous project. There we use a Servo motor
to operate the sanitizer bottle. Here I am using a Solinoid valve to operate the
water tap. First we read the distance from distance sensor to the hand with
the help of Arduino Uno. If the distance is less than 20 cm, the solinoid valve
will turn on and start the water flow. Otherwise the solinoid valve is turned off.
Solinoid Valve
Solinoid valve is a electro-mechanical device. Simply a valve only open or
close only when the required is voltage is available. This device is basically
available in two models. One is "Normally Closed (This is closed when the
absence of electricity. And open the presence of electricity). The second
model is "Normally Opened" (This is opened when the absence of electricity.
And closed the presence of electricity). Here we are using the "Normally
closed" type.
You can also get the solinoid valve from old washing machine.
Step - 1
Step - 2
Now we need to set the trigPin in "LOW" for 2 microseconds. Then set the
trigPin "HIGH" for 10 Microseconds. And set it back to "LOW". Then read the
total travel time using the function pluseIn(). Then calculate the distance from
this time. And use "if" and "else" for control the solinoid valve. Set pin 3 as
"HIGH" only the distance is less than 20 cm. Otherwise it keep as "LOW".
void loop(){
digitalWrite(trigPin,LOW);
delayMicroseconds(2);
digitalWrite(trigPin,HIGH);
delayMicroseconds(10);
digitalWrite(trigPin,LOW);
duration=pulseIn(echoPin,HIGH);
distance=(duration*0.034/2);
if(distance<=20){
digitalWrite(3,HIGH);
}
else{
digitalWrite(3,LOW);
}
}
The coding part is complete. The complete code is given in the attachment
part. Now we need to setup the hardware.
First connect the solinoid valve to the pipe. Connect it between the water tap
and supply pipe with the help of other connectors and thread seal. Keep the
knob of the water tap always on
Connection
Here TP120 is used as a switching device. It will drive the Solinoid valve. This
Solinoid valve will draw 500 milli amphere. That's why I use the additional
power supply. One IN4007 diode is used as flyback diode. It help to protect
the TP120 from back current due to the coil of solinoid valve. Complete the
hardware connections with the help of circuit diagram. Place the sensor in the
front the water tap and other circuits in an enclosure.
Follow me on,
Instagram : five_volt_player
Github : akshayjoseph666
STAY HOME, STAY SAFE, STAY CREATIVE. Let break the chain.
Schematics
solinoid_valve_87Aq3uF0CO.png
Code
Untitled file
Arduino
//sketch created by Akshay Joseph Follow me on Instagram : five_volt_player
#define echoPin 4
#define trigPin 5
int long duration;
int distance;
void setup(){
pinMode(echoPin,INPUT);
pinMode(trigPin,OUTPUT);
pinMode(3,OUTPUT);
digitalWrite(3,LOW);
delay(2000);
}
void loop(){
digitalWrite(trigPin,LOW);
delayMicroseconds(2);
digitalWrite(trigPin,HIGH);
delayMicroseconds(10);
digitalWrite(trigPin,LOW);
duration=pulseIn(echoPin,HIGH);
distance=(duration*0.034/2);
if(distance<=20){
digitalWrite(3,HIGH);
}
else{
digitalWrite(3,LOW);
}
}
Credits