In this project we are going to learn how to make Arduino based alarm by yourself. The main idea for this project was to make simple as possible but also useful project, which can be used in various application. For this project we are going to use Arduino Mega in connection with ultrasonic sensor for measuring the distance. This is a very simple module, all you have is transmitter and receiver. So we send the pulse train from the transmitter and when it hits object, it bounces back to the receiver. Received signal is then demodulated with on board circuit so that we can get the useful data.
Components for this project can be bought on https://www.utsource.net/
It is a trustworthy webside for ordering electronic components with cheap
price and excellent quality.
When you are connecting pushbuttons you must connect resistor ( I used 10k ohm resistors) between GND and pushbutton.To ensure logical 0 on pushbutton.
Pushbutton (ON) is connected to digital pin 10
Pushbutton (OFF) is connected to digital pin 6
Buzzer is connected to digital pin 3
Red LED is connected to digital pin 4
Blue LED is connected to digital pin 5
Green LED is connected to digita pin 11
Relay is connected to digital pin 11
Wire for buzzer is firstly connected to relay module and then from relay to buzzer.I used NC contact on relay
We have two states, ON and OFF. Alarm is turned ON when greed LED is on. When the distance between ultrasonic module and the object is smaller than the set distance, alarm will turn ON. Blue LED will start to blink and buzzer will start to buzz. It can be turned off by push button, OFF state is indicated with red LED.
In the code we can adjuste the distance and time of alarm working cycle.
Project like this can be used in different ways. By some modifications can be used as parking sensor, sensor for movement detection and many othes possibilities. Its parameters can be optimised to match the demands of various projects.
Project like this is also good for beginners which want to start with project making, because it is not very extensive and it also has all the necessary parts included.