Circuit:
ir_sensor = A0; relay = 2; relay1 = 3; buzzer = 12; LCD = 11; LiquidCrystal lcd (4, 5, 6, 7, 8, 9); // pins of the LCD. (RS, E, D4, D5, D6, D7)
Wire Connection:
If anyone needs a Gerber file, can contact this kantirobot@gmail.com mail id.......
Code:
/* 2020
* IR SOAPY WASH Code by Kanti Sharma @roboticskanti
* Find building instructions on https://roboticskanti.com
*/
#include <LiquidCrystal.h>
int ir_sensor = A0;
int relay = 2;
int relay1 = 3;
int buzzer = 12;
int LCD = 11;
LiquidCrystal lcd (4, 5, 6, 7, 8, 9); // pins of the LCD. (RS, E, D4, D5, D6, D7)
void setup() {
lcd.begin(16, 2);
pinMode(relay, OUTPUT);
pinMode(relay1, OUTPUT);
pinMode(buzzer, OUTPUT);
pinMode(LCD, OUTPUT);
Serial.begin(9600);
}
void loop(){
int sensor_value = analogRead(ir_sensor); //read the sensor value
int distance_cm = pow(3027.4/sensor_value, 1.2134); //convert readings to distance(cm)
digitalWrite(LCD, LOW);
delay(500);
lcd.setCursor(0, 0);
lcd.print(" READY");
lcd.setCursor(0, 1);
lcd.print(" FOR HANDWASH");
if (distance_cm < 30)
{
digitalWrite(buzzer, HIGH);
delay(200);
digitalWrite(buzzer, LOW);
digitalWrite(relay1, HIGH);
digitalWrite(LCD, HIGH);
lcd.clear();
lcd.setCursor(0, 0);
lcd.print(" WATER ON");
delay(4000);
lcd.clear();
digitalWrite(relay1, LOW);
lcd.clear();
lcd.setCursor(0, 0);
lcd.print(" RUB HANDS");
lcd.setCursor(0, 1);
lcd.print(" FOR- 20 SECOND");
delay(20000);
lcd.clear();
digitalWrite(buzzer, HIGH);
delay(200);
digitalWrite(buzzer, LOW);
digitalWrite(relay1, HIGH);
lcd.clear();
lcd.setCursor(0, 0);
lcd.print(" WASH WITH");
lcd.setCursor(0, 1);
lcd.print(" CLEAN WATER");
delay(10000);
lcd.clear();
digitalWrite(relay1, LOW);
digitalWrite(buzzer, HIGH);
delay(200);
digitalWrite(buzzer, LOW);
delay(1000);
digitalWrite(buzzer, HIGH);
delay(200);
digitalWrite(buzzer, LOW);
digitalWrite(relay, HIGH);
lcd.clear();
lcd.setCursor(0, 0);
lcd.print(" DRY WITH");
lcd.setCursor(0, 1);
lcd.print(" YOUR HAND");
delay(10000);
lcd.clear();
digitalWrite(relay, LOW);
digitalWrite(buzzer, HIGH);
delay(50);
digitalWrite(buzzer, LOW);
delay(50);
digitalWrite(buzzer, HIGH);
delay(50);
digitalWrite(buzzer, LOW);
lcd.clear();
lcd.setCursor(0, 0);
lcd.print("REMOVE YOUR HAND");
delay(1000);
digitalWrite(buzzer, HIGH);
lcd.clear();
lcd.setCursor(0, 0);
lcd.print("HANDWASH COMPLED");
lcd.setCursor(0, 1);
lcd.print(" Thank you");
delay(5000);
lcd.clear();
}
else {
digitalWrite(relay1, LOW);
digitalWrite(relay, LOW);
digitalWrite(buzzer, LOW);
digitalWrite(LCD, LOW);
}
}
Comentários