Simple Arduino Alarm System
by Noah Mathai in Circuits > Arduino
2031 Views, 3 Favorites, 0 Comments
Simple Arduino Alarm System
In this Instructable you will learn how to build a simple Arduino buzzing alarm system on a breadboard. The original project can be found here: https://create.arduino.cc/projecthub/Krepak/ultrasonic-security-system-3afe13?ref=search&ref_id=Ultrasonic%20Security%20System&offset=0
However, I have changed some things and have not included the LEDs found in the original project and I have created more cases in the code to accommodate for different buzzer sounds based on the different distances that I have included in the code.
Supplies
For this Instructable you will need:
- Arduino (I used an Arduino Uno so I would recommend using an Uno but you can also use a Nano as well.)
- HC-SR04 Ultra Sonic Sensor
- 220 Ohm Resistor
- A Buzzer
- A USB A to USB B wire to power the Arduino and to transfer the code from your computer to the Arduino
- OPTIONAL: After building this project if you want to make it mobile then you can connect a 9V battery to the Arduino.
Step 1: Connecting the GND and 5V to BreadBoard
Take a red wire and connect on end to the 5V on the Arduino then connect the other side to the first + rail hole on the bread board. The take a Black wire and connect one end into GND and then connect other end to the first - rail hole on the breadboard.
Step 2: Connect the HC-SR04 Ultrasonic Sensor to BreadBoard
Take the HC-SR04 Ultrasonic Sensor connect to the breadboard parallel to the + and - rails. Then take a red wire and connect one end to the VCC row of the sensor and then the other end into the positive rail. Take a black wire and plug one end to the GND row of the sensor and the other end to the negative or - rail. Take a orange wire preferably a long one and plug one end into the TRIG row of the sensor and plug in the other end into digital port 7. Take a yellow wire preferably a long one and plug one end into the ECHO row of the sensor and plug in the other end into digital port 6.
Step 3: Connecting the Buzzer to the BreadBoard
Take the Buzzer and put it in making sure the 2 legs are parallel to the + and - rails. Take a red wire and plug one end into the same row that has the positive leg. Then take the other end of the red wire and plug it into the digital port 3. Then take a 220 Ohm resistor and plug one end into the same row that has the negative leg and plug the other end of the resistor into the - rail (GND Rail).
Step 4: Writing the Code
I used the Arduino IDE to write the code. I have attached the code as a .ino file. When writing the code we will not to use any libraries. I set the maximum distance to 100 cm for example purposes. However you can choose what ever distance you would like to set as the maximum distance where the buzzer will go off. Just make sure if you are changing one number then just check the rest of the code and make sure the numbers make sense.
Downloads
Step 5: Congrats! You Have Officially Set Up a Buzzer/Alarm System.
Now you could set it up around the house and see how it works! Obviously this is the most basic version and you can very well make the project better and house it in a case with a custom PCB board instead of a breadboard.
I hope you enjoyed making this project and please heart and comment down below what you liked about doing this project/what you would do differently when doing this project.