Laser Based Security System With Arduino

Introduction: Laser Based Security System With Arduino

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.

Teacher Notes

Teachers! Did you use this instructable in your classroom?
Add a Teacher Note to share how you incorporated it into your lesson.

Step 1: Things You Need

For this instructables we will need following things :

Arduino UNO Board :

LASER Diode Module KY-008 :

Buzzer :


Resistors (10k)
Push Button Switch

Bread Board :

Connecting Wires :

Step 2: Schmatics

Please connect everything According to the shown schmatics.

Step 3: Code

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);

boolean alarmState = false;

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

Step 4: Testing the Security System

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.

Be the First to Share


    • Trash to Treasure Contest

      Trash to Treasure Contest
    • Raspberry Pi Contest 2020

      Raspberry Pi Contest 2020
    • Wearables Contest

      Wearables Contest