--> Project V - 5. Anti Theft Alarm (Arduino Based) | basic arduino tutorial

Thursday, August 10, 2017

Project V - 5. Anti Theft Alarm (Arduino Based)

| Thursday, August 10, 2017
Anti Theft Alarm




Ultrasonic sensors installed in the passage are roughly passed by people. Can be fenced or front door. If anyone passes, then it will cut the sensor measuring distance and detected as a thief. Alarm in the form of buzzer will be active. Set the position of the sensor with the distance between the sensor with the wall or a 2.5 m barrier.

Hardware Requirement
  • Ultrasonic Sensor HC-SR04
  • 16 x 2 LCD Module
  • A Buzzer
  • Power supply +5 Volt
  • Jumper

                      Ultrasonic Sensor HC-SR04 | Source             Buzzer | Source


Block Diagram


Schematics



Arduino - LCD Wiring



Arduino - Ultrasonic Sensor Wiring


Arduino - Buzzer


Source Code/Sketch

#define TRIGPIN 8
#define ECHOPIN 9
#include <LiquidCrystal.h>
LiquidCrystal lcd(2, 3, 4, 5,6,7);
unsigned int jarak, timer;
void setup(){
lcd.begin(16, 2);
lcd.print(" ALARM ");
lcd.setCursor(0, 1);
lcd.print(" ANTI MALING ");
delay(2000);
lcd.clear();
lcd.print("Kondisi=");
pinMode(ECHOPIN, INPUT);
pinMode(TRIGPIN, OUTPUT);
pinMode(11, OUTPUT);
}
void loop(){
digitalWrite(TRIGPIN, LOW);
delayMicroseconds(2);
digitalWrite(TRIGPIN, HIGH);
delayMicroseconds(10);
digitalWrite(TRIGPIN, LOW);
timer = pulseIn(ECHOPIN, HIGH);
jarak= timer/58;
if(jarak<200) {
lcd.setCursor(8, 0);
lcd.print("Bahaya");
while(1){
digitalWrite(11,1);
delay(50);
digitalWrite(11,0);
delay(50);
}
}
else{
lcd.setCursor(8, 0);
lcd.print("Aman");
delay(500);
}
}

How it Works

1. Connect the Arduino with Peripherals needed
2. Plug in the Power Source on the device
3. Compile and upload the script program above to your arduino

4. First initial LCD display

5. After 2 seconds the ultrasonic sensor instantly reads the distance and displays its condition, If the
    distance between object with sensor is greater than 250 cm (distance> 250cm) then buzzer does
    not ring and LCD shows "Condition = Secure".


6. If the distance between the object with the sensor is smaller than 245 then the buzzer goes off and
    the LCD displays "Conditions = Danger".


7. buzzer will sound continuously, to turn off buzzer press RESET button on arduino.



Video for Project V - 5. Anti Theft Alarm (Arduino Based)






Required File


Related Posts

No comments:

Post a Comment