Elc Working

You might also like

Download as docx, pdf, or txt
Download as docx, pdf, or txt
You are on page 1of 7

ELC-ACTIVITY

Submitted By:
Atharv Ambokar - 102003564
OBJECTIVE:-
This project aims to eliminate the need to touch/press the doorbell whenever
someone pays a visit. It comprises of an ultrasonic sensor along with a buzzer
which rings up when a person comes within a pre-defined range of the sensor,
letting us know that someone is on the door.

Need Analysis:-
The door-bell is a common point of touch which may become lethal in case of
COVID-19, etc diseases that spread by touch. This project completely removes the
root of cause for such problem by discarding the need of touch. One can simply
stand in front of the doorbell within a certain range and it will buzz out/ring up
automatically.

WORKING:-
The materials that we need to make this project:
1. Arduino UNO R3 CH340 (you can use any Arduino Boards)
2. Ultrasonic Sensor HC-SR04
3. Male to Male Jumper Wires
4. Breadboard

In order to generate the ultrasound we need to set the Trigger Pin on a High State
for 10 µs. That will send out an 8 cycle sonic burst which will travel at the speed
sound and it will be received in the Echo Pin. The Echo Pin will output the time in
microseconds the sound wave traveled.
Ultrasonic HC-SR04 timing diagram

CODE:-
int piezoPin = 6; // pin for the piezo

int trigPin = 8;

int echoPin = 9;

int val = 0; // variable for reading the pin status

int counter = 0;

int currentState = 0;

int previousState = 0;

void setup() {

pinMode(piezoPin, OUTPUT); // declare piezo as output

pinMode(trigPin, OUTPUT);
pinMode(echoPin, INPUT);

Serial.begin(9600);

void loop(){

delay(200);// reading will be taken after 200 milliseconds

Serial.println("\n");

int duration, distance;

digitalWrite(trigPin, HIGH);

delayMicroseconds(10);

digitalWrite(trigPin, LOW);

duration = pulseIn (echoPin, HIGH);

distance = (duration/2) / 29.1;

if (distance < 100)

{ // Change the number for long or short distances.

digitalWrite(piezoPin, HIGH);

else {

digitalWrite(piezoPin, LOW);

val = digitalRead(piezoPin); // read input value

if (val == HIGH) { // check if the input is HIGH (led on)

currentState = 1;

else {
currentState = 0;

if(currentState != previousState){

if(currentState == 1){

counter = counter + 1;

Serial.print(" Arduino has been passed ");

Serial.println(counter);

Serial.print("times.");

previousState = currentState;

You might also like