Arduino Ultrasonic Sensor Door Alarm

Introduction: Arduino Ultrasonic Sensor Door Alarm

This is a very simple ultrasonic sensor door alarm for beginners.
this needs just a few stuff you need to gather from any online shoppers you need.
I bought it from Amazon and I recommend to buy in amazon

Supplies:

One ultrasonic sensor
One Simple buzzer
One Arduino Uno generic board
One a to b usb cable
Some jumper wires
One generic breadboard
Softwares are:::-ARDUINO IDE

Teacher Notes

Teachers! Did you use this instructable in your classroom?
Add a Teacher Note to share how you incorporated it into your lesson.

Step 1: The Connections Are :::- πŸ˜„πŸ˜„πŸ˜„

Vcc- 5v
Trig- Arduino pin 2
Echo- Arduino pin 3
Gnd- gnd


Buzzer connections ::-
Plus to 5v
Minus to Arduino pin 12

Step 2: Just Programming Slightly πŸ˜ŽπŸ˜ŽπŸ€—

int tiger=2;
int echo=3;
int a=12;
int Duration,Distance;
void setup()
{
pinMode(tiger,OUTPUT);
pinMode(echo,INPUT);
Serial.begin(9600);
pinMode(a,OUTPUT);
}
void loop()
{
digitalWrite(tiger,HIGH);
delayMicroseconds(1000);
digitalWrite(tiger,LOW);
Duration=pulseIn(echo,HIGH);
Distance=(Duration/2)/29.1;
Serial.print("cm=");
Serial.print(Distance);
delay(500);
if (Distance<50)
{
digitalWrite(a,HIGH);
delay(1000);
}
else
digitalWrite(a,LOW);
delay(200);

}

Step 3: How It Works

It is just a simple mechanism.
Just if an object comes to a distance the buzzer buzzes.
Just play with itπŸ˜ŽπŸ˜ŽπŸ€—πŸ€—πŸ€—πŸ™‚πŸ™‚πŸ€”πŸ€”

Step 4: This Is How It Looks!!

Be the First to Share

    Recommendations

    • Trash to Treasure Contest

      Trash to Treasure Contest
    • Raspberry Pi Contest 2020

      Raspberry Pi Contest 2020
    • Wearables Contest

      Wearables Contest

    Discussions

    0
    seamster
    seamster

    2 months ago

    Thank you for sharing : )