Laser Based Security System With Arduino

by Utsource in Circuits > Arduino

1125 Views, 0 Favorites, 0 Comments

Laser Based Security System With Arduino

20191126_171115.jpg
Hi guys in this instructables we will learn how to make a laser based security system with Arduino.
So basically we will use a laser and ldr laser to radiate light in a straight line and ldr to detect the laser light and if someone crosses it which means laser light will be blocked and LDR will not able to detect it then the buzzer will alert us that somebody crossed or blocked the laser.

Things You Need

Km5Zu-2RIncAUweU7uG7IhyWPySZ0SqIgAI0-vk9w7767_IkthCPCcsirj2GGmXF4IdQDg8UVpHVLVM6CXnzFsG1hnAdSkK7BIhIOtEldXoZiDsvzsPo-6o0rD6Mda7UyOE=w456-h323-nc.png
images(107).jpg
images(106).jpg

For this instructables we will need following things :

Arduino UNO Board :



LASER Diode Module KY-008 :



Buzzer :


LDR :



Resistors (10k)
Push Button Switch


Bread Board :


Connecting Wires :

Schmatics

20191126_171629.jpg
Please connect everything According to the shown schmatics.

Code

20191121_193959.jpg
Please copy the following code and upload it to the arduino Board :


int laserPin = 3;
int sensorPin = A0;
int buttonPin = 12;
int buzzerPin = 11;

int laserThreshold = 10;

void setup() {
pinMode(laserPin, OUTPUT);
pinMode(buttonPin, INPUT_PULLUP);
Serial.begin(9600);
}

boolean alarmState = false;

void loop() {
if (! alarmState) {
delay(1000);
digitalWrite(laserPin, HIGH);
delay(10);
unsigned long startTime = millis();
while (millis() - startTime < 1000) {
int sensorValue = analogRead(sensorPin);
Serial.println(sensorValue);
if (sensorValue > laserThreshold) {
alarmState = true;
break;
}
delay(10);
}
digitalWrite(laserPin, LOW);
} else {
tone(buzzerPin, 440);
if (! digitalRead(buttonPin)) {
alarmState = false;
noTone(buzzerPin);
}
delay(10);
}
}

Testing the Security System

20191126_171115.jpg
20191126_171859.jpg
The project basically works on the principle of interruption. If by any means the LASER light is interrupted the alarm will start unless it is reset with push button. The laser is a concentrated light source that puts out a straight beam of light of a single color.



The LDR is sensitive to light and puts out a voltage when the laser light hits it. When the laser beam is interrupted and can’t reach LDR, its voltage output changes, and eventually the alarm will ring.