Door Alarm Security System
It is a
simple tutorial on how to create little a security device using an Arduino.
Here we are going to make door alarm security system using HC-Ultrasonic sensor. The used ultrasonic sensor is used as distance sensor, it will tell us the distance at which the object is placed. Using this distance value, we will turn the buzzer on or off.
Components Required
- Arduino Uno
- Bread Board
- UltrasonicSensor - HC-SR04 (Generic)
- Buzzer
- Connecting Wire
Connections
The
connections for the ultrasonic sensor with Arduino are as follows.
Ultrasonic Sensor
|
Arduino
|
VCC
|
5 v pin
|
Trig Pin
|
Pin2
|
Echo pin
|
Pin 3
|
GND
|
GND
|
Connect
positive pinon buzzer with pin 10 on Arduino and Buzzer negative pin with GND pin
on Arduino.
Working Mechanism
The
ultrasonic sensor emits an ultrasonic wave from the trigger which comes back
after hitting the object and it is received by the travelled in microsecond. To
send an ultrasonic wave from the trigger, we will have to set trigger for 10 micro-second.
It will send an 8 cycles sonic burst at 40 KHZ which will hit object and is
then received by the echo.
Distance = v * t
Here we have
value of t and we know that the speed of sound wave is 340 m/s. We have to
convert speed of sound into cm/ micro-second to calculate distance. The speed
of sound in cm/ micro-second is 0.034 cm/ micro-second. Then,
S= 0.034 * t
We require
only the distance it take to hit the object so,
S=(0.034*t)/2
We will get
the distance value using equation above and after that we will set a value
which help us to make the buzzer high or low.
Code:
int trigger_pin = 2;
int echo_pin = 3;
int buzzer_pin = 10;
int time;
int distance;
void setup ( ) {
Serial.begin (9600);
pinMode (trigger_pin, OUTPUT);
pinMode (echo_pin, INPUT);
pinMode (buzzer_pin, OUTPUT);
}
void loop ( ) {
digitalWrite (trigger_pin, HIGH);
delayMicroseconds (10);
digitalWrite (trigger_pin, LOW);
time = pulseIn (echo_pin, HIGH);
distance = (time * 0.034) / 2;
if (distance <= 10)
{
Serial.println (" Door Open ");
Serial.print (" Distance= ");
Serial.println (distance);
digitalWrite (buzzer_pin, HIGH);
delay (500);
}
else {
Serial.println (" Door closed ");
Serial.print (" Distance= ");
Serial.println (distance);
digitalWrite (buzzer_pin, LOW);
delay (500);
}
wow good way of learning
ReplyDeleteI went to this website, and I believe that you have a plenty of excellent information, I have saved your site to my bookmarks. Complete Alarm Systems
ReplyDeleteI got too much interesting stuff on your blog. I guess I am not the only one having all the enjoyment here! Keep up the good work. Complete Alarm Systems
ReplyDeletethanks
Deletei really like this article please keep it up. fabbro viareggio
ReplyDeletevery interesting keep posting. fabbri a viareggio
ReplyDeletei never know the use of adobe shadow until i saw this post. thank you for this! this is very helpful. ip cameras
ReplyDeleteI think this is a really good article. You make this information interesting and engaging. You give readers a lot to think about and I appreciate that kind of writing. Security Screen Windows
ReplyDeleteMost homes have picked to introduce security systems now. The expanded interest for security systems among house proprietors of today are a result of the different advantages they offer. cctv camera installation near me
ReplyDeleteGreat post, and great website. Thanks for the information! k7 total security activation key
ReplyDeleteThink about the exemplary "Form a superior mousetrap" model instructed in many business colleges. Access Control System
ReplyDeleteWithout fail, your writing style is top professional; even your website also looks amazing thank you for posting. security alarm price
ReplyDeleteI truly appreciate this post. Really looking forward to read more. Fantastic.security alarm system installation
ReplyDeleteYou know your projects stand out of the herd. There is something special about them. It seems to me all of them are really brilliant! singapore security alarm
ReplyDeleteIt might come as an amazement to hear that numerous entryways can be created as sliding entryways. This implies that regardless of whether you see an entryway you like and it's anything but a sliding entryway, you can demand the style be made into a sliding entryway by the maker.telescopic auto sliding door
ReplyDeleteOne of the leading Security System Installation services in canada
ReplyDeleteReally a great addition. I have read this marvelous post. Thanks for sharing information about it. I really like that. Thanks so lot for your convene. Serious Security CCTV Sydney
ReplyDeleteMuch obliged for the data. Incredible sites. I truly like your approach to offering the viewpoints and sharing the data. It is great to move as chance get new things life, makes ready for progression, and so forth. Basement security window
ReplyDeleteThanks for taking the time to discuss this, I feel strongly about it and love learning more on this topic. door access system in Singapore
ReplyDeleteI wanted to thank you for this great read!! I definitely enjoying every little bit of it I have you bookmarked to check out new stuff you post. https://penzu.com/p/72079d5e
ReplyDeleteYou make so many great points here that I read your article a couple of times. Your views are in accordance with my own for the most part. This is great content for your readers. sensormatic tags
ReplyDeleteThis particular is usually apparently essential and moreover outstanding truth along with for sure fair-minded and moreover admittedly useful My business is looking to find in advance designed for this specific useful stuffs… http://dooraccesscontrol.bravesites.com/
ReplyDeleteAlthough they are some of Mother Nature's most vicious storms, hurricanes can be made more manageable with careful planning and preparation. hurricane impact doors and windows
ReplyDeleteas
ReplyDelete