Shobajo AbdulAzeez
Published

Automatic Hand Sensing Water and Soap Tank with Tap

An automatic hand sensing water and soap tank for public places to prevent coronavirus, while prohibiting retouching of the faucet.

AdvancedFull instructions providedOver 1 day336

Things used in this project

Hardware components

Ultrasonic Sensor - HC-SR04
SparkFun Ultrasonic Sensor - HC-SR04
×2
Arduino UNO
Arduino UNO
×1
DC-DC CHARGE PUMP, DOUBLER/INV
DC-DC CHARGE PUMP, DOUBLER/INV
×1
Resistor 10k ohm
Resistor 10k ohm
×1
1-Channel Signal Relay 1A SPDT I²C Mini Module
ControlEverything.com 1-Channel Signal Relay 1A SPDT I²C Mini Module
×1

Software apps and online services

Arduino IDE
Arduino IDE

Hand tools and fabrication machines

Hot glue gun (generic)
Hot glue gun (generic)

Story

Read more

Schematics

Circuit Diagram

Code

Code

Liquid
To program Arduino for water level controller, first we define all the pin that we are going to use in the project for interfacing external devices like relay,

#define trigger 10
#define echo 11
#define motor 8
#define buzzer 12


Then we initialize all the devices used in project.

lcd.begin(16,2);
pinMode(trigger,OUTPUT);
pinMode(echo,INPUT);
pinMode(motor, OUTPUT);
pinMode(buzzer, OUTPUT);
lcd.print(" Water Level ");
lcd.setCursor(0,1);
lcd.print(" Indicator ");
delay(2000);


Now initialize the ultrasonic sensor module and read time of sending and receiving time of ultrasonic waves or sound by using pulseIn(pin). Then perform calculations and display the result on 16x2 LCD by using appropriate functions.

digitalWrite(trigger,HIGH);
delayMicroseconds(10);
digitalWrite(trigger,LOW);
delayMicroseconds(2);
time=pulseIn(echo,HIGH);
distance=time*340/20000;
lcd.clear();
lcd.print("Water Space In ");
lcd.setCursor(0,1);
lcd.print("Tank is: ");
lcd.print(distance);
lcd.print("Cm");
After it we check conditions if water tank is full or water level is LOW, and take actions accordingly.

if(distance<12 && temp==0)
{
digitalWrite(motor, LOW);
digitalWrite(buzzer, HIGH);
lcd.clear();
lcd.print("Water Tank Full ");
lcd.setCursor(0,1);
lcd.print("Motor Turned OFF");
delay(2000);
digitalWrite(buzzer, LOW);
delay(3000);
temp=1;
}

else if(distance<12 && temp==1)
{
digitalWrite(motor, LOW);
lcd.clear();
lcd.print("Water Tank Full ");
lcd.setCursor(0,1);
lcd.print("Motor Turned OFF");
delay(5000);
}
#include <LiquidCrystal.h>
 
#define trigger 10
#define echo 11
#define motor 8
#define buzzer 12
 
LiquidCrystal lcd(7,6,5,4,3,2);
 
float time=0,distance=0;
int temp=0; 
void setup()
{
 lcd.begin(16,2);
 pinMode(trigger,OUTPUT);
 pinMode(echo,INPUT);
 pinMode(motor, OUTPUT);
 pinMode(buzzer, OUTPUT);
 lcd.print("  Water Level ");
 lcd.setCursor(0,1);
 lcd.print("   Indicator  ");
 delay(2000);
}
 
void loop()
{
 lcd.clear();
 digitalWrite(trigger,LOW);
 delayMicroseconds(2);
 digitalWrite(trigger,HIGH);
 delayMicroseconds(10);
 digitalWrite(trigger,LOW);
 delayMicroseconds(2);
 time=pulseIn(echo,HIGH);
 distance=time*340/20000;
 lcd.clear();
 lcd.print("Water Space In  ");
 lcd.setCursor(0,1);
 lcd.print("Tank is: ");
 lcd.print(distance);
 lcd.print("Cm");
 delay(2000);
 if(distance<12 && temp==0)
 {
     digitalWrite(motor, LOW);
     digitalWrite(buzzer, HIGH);
     lcd.clear();
     lcd.print("Water Tank Full ");
     lcd.setCursor(0,1);
     lcd.print("Motor Turned OFF");
     delay(2000);
     digitalWrite(buzzer, LOW);
     delay(3000);
     temp=1;
 }
 
  else if(distance<12 && temp==1)
 {
     digitalWrite(motor, LOW);
     lcd.clear();
     lcd.print("Water Tank Full ");
     lcd.setCursor(0,1);
     lcd.print("Motor Turned OFF");
     delay(5000);
 }
 
 else if(distance>30)
 {
   digitalWrite(motor, HIGH);
   lcd.clear();
   lcd.print("LOW Water Level");
   lcd.setCursor(0,1);
   lcd.print("Motor Turned ON");
   delay(5000);
   temp=0;
 }
}

Credits

Shobajo AbdulAzeez

Shobajo AbdulAzeez

1 project • 1 follower

Comments