About Lesson
Burglar Alarm
Introduction
In this project, we are going to make an intruder detector that can be used to detect the presence of any human being at a place of safety. For making this project we are going to use an IR sensor, LCD 16*2, Kblox Neo, 1K resistors, and jumper cables for connections. IR sensor uses IR rays for detecting the presence of any human being in its range. As soon as the IR sensor detects the presence of anyone it sends a signal to the Kblox Neo which in return blows the buzzer and the LCD shows “intruder detected”. If the IR sensor detects nothing, the LCD shows No intruder.
Components required
- Kblox Neo
- IR Sensor [Qty-1]
- LCD (16*2) Display
- Battery 9V
- Battery clip
- A to B USB cable
- Resistor 1K [Qty-1]
- Jumper wires [M-F, Qty-15] [M-M Qty-2]
Code
#include "kblox.h"
kblox kit;
kblox_lcd lcd(12, 11, 6, 5, 3, 2); //define led pin
void setup() {:
kit.ir_begin(7); // define ir pin
pinMode(4, OUTPUT);
Serial.begin(9600); // initialize serial monitor
lcd.begin(16, 2) // initialize lcd
lcd.setCursor(5, 0);
lcd.print("welcome"); // print on lcd
delay(2000);
lcd.clear(); // clear lcd
}
void loop() {
int ir = kit.ir_read(); // read ir sensor data and stored in variable
Serial.print(ir); // print ir sensor data
if (ir == HIGH) {
lcd.setCursor(0, 0);
lcd.print("Intruder");
lcd.setCursor(0, 1);
lcd.print("detcted");
digitalWrite(4, HIGH); // set buzzer pin high
}
else {
lcd.setCursor(0, 0);
lcd.print("No");
lcd.setCursor(0, 1);
lcd.print("Intruder");
digitalWrite(4, LOW); //set buzzer pin low
}
delay(400);
lcd.clear(); // clear lcd
}
Applications
- Can be used for making Path following robots.
- Can be used for making People counter.
- Can be used for making a smart parking system