Overview
This project deals with a problem faced by the whole world due to the pandemic Covid-19. No person wants to touch anything outside their houses so to this problem we have a solution by using a Touchless Doorbell
In this project, we have used an ultrasonic sensor to calculate the distance of the person from the doorbell if the distance is less than 20 inches then the buzzer gets activated and produces a continuous sound to let us know that there is someone outside the door and also tells the distance of the person from the door.
Hardware required
- Arduino Uno R3
- Ultrasonic Sensor
- Resistor
- Buzzer
- Jumper Wires
Schematic Diagram
Fig 1. Circuit Diagram
Arduino Code :
int inches = 0;
const int buzzer = 8;
int cm = 0;
long readUltrasonicDistance(int triggerPin, int echoPin)
{
pinMode(triggerPin, OUTPUT);
digitalWrite(triggerPin, LOW);
delayMicroseconds(2);
digitalWrite(triggerPin, HIGH);
delayMicroseconds(10);
digitalWrite(triggerPin, LOW);
pinMode(echoPin, INPUT);
return pulseIn(echoPin, HIGH);
}
void setup()
{
Serial.begin(9600);
pinMode(buzzer, OUTPUT);
}
void loop()
{
cm = 0.01723 * readUltrasonicDistance(7, 7);
inches = (cm / 2.54);
if (inches < 20)
{ tone(buzzer, 1000);
}
else {
noTone(buzzer);
}
Serial.print(inches);
Serial.print("in, ");
Serial.print(cm);
Serial.println("cm");
delay(100);
}
Precautions
- Connections should be done properly.
- Arduino is case Sensitive so code accordingly.
- Give different colors to the wires.