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 

  1. Arduino Uno R3
  2. Ultrasonic Sensor
  3. Resistor
  4. Buzzer
  5. Jumper Wires

Schematic Diagram

AD 4nXduKNgSCwtAto2m1wENhgNCV4HKgsrdeCNlJCdCAj039AIxZJNuf6QY5DssQ8XTyai 3E2ODHyZwesbIrKcf ThtlVxolvMIwq46o7 3d38cUV I65gKse8YADFVuA XEszQTP3IwB6mMvPXVCGOKXMLOvz3UwV4x1k8K0KRgSiy0ZF

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

  1. Connections should be done properly.
  2. Arduino is case Sensitive so code accordingly.
  3. Give different colors to the wires.

Leave a Reply

Recent Posts

Gallery

Related Posts