Engineers Garage

  • Electronic Projects & Tutorials
    • Electronic Projects
      • Arduino Projects
      • AVR
      • Raspberry pi
      • ESP8266
      • BeagleBone
      • 8051 Microcontroller
      • ARM
      • PIC Microcontroller
      • STM32
    • Tutorials
      • Audio Electronics
      • Battery Management
      • Brainwave
      • Electric Vehicles
      • EMI/EMC/RFI
      • Hardware Filters
      • IoT tutorials
      • Power Tutorials
      • Python
      • Sensors
      • USB
      • VHDL
    • Circuit Design
    • Project Videos
    • Components
  • Articles
    • Tech Articles
    • Insight
    • Invention Stories
    • How to
    • What Is
  • News
    • Electronic Product News
    • Business News
    • Company/Start-up News
    • DIY Reviews
    • Guest Post
  • Forums
    • EDABoard.com
    • Electro-Tech-Online
    • EG Forum Archive
  • DigiKey Store
    • Cables, Wires
    • Connectors, Interconnect
    • Discrete
    • Electromechanical
    • Embedded Computers
    • Enclosures, Hardware, Office
    • Integrated Circuits (ICs)
    • Isolators
    • LED/Optoelectronics
    • Passive
    • Power, Circuit Protection
    • Programmers
    • RF, Wireless
    • Semiconductors
    • Sensors, Transducers
    • Test Products
    • Tools
  • Learn
    • eBooks/Tech Tips
    • Design Guides
    • Learning Center
    • Tech Toolboxes
    • Webinars & Digital Events
  • Resources
    • Digital Issues
    • EE Training Days
    • LEAP Awards
    • Podcasts
    • Webinars / Digital Events
    • White Papers
    • Engineering Diversity & Inclusion
    • DesignFast
  • Guest Post Guidelines
  • Advertise
  • Subscribe

DIY – LASER Based Security System using Arduino

By Ashutosh Bhatt March 3, 2017

Just consider the scenario that you are entering into any suspicious place and suddenly, by mistake, you interrupt an invisible LASER beam and an ALARM or SIREN blows. Nowadays this is a very common scenario. Many people secure their home, office, shops, warehouses, etc with the LASER beam security system. Not only buildings or premises, but many precious things like jewellery, diamonds, precious antique items in the museum, etc many other things are also secured using such invisible LASER beam.

In this system, there is an invisible LASER beam that is continuously ON and it is detected by any light sensor. Whenever any object or person comes in between LASER and sensor the beam interrupts and the sensor does not detect LASER light. And that’s ALL!!!! As soon as the beam interrupts (cuts) the siren blows for intruder alert.

We can build very simple such system using keychain LASER and LDR (light dependent resistor) as a sensor. Just we need is a very simple circuit built using few common components like transistor, resistors, buzzer, relay etc.

Here the given project demonstrates one of such LASER security system. It is built using arduino. It also includes matrix keypad to enter the password to enable or disable the system. Means the system can be turned ON (enabled) or turned OFF (disabled) by entering the correct password only. In this, the security system can be turned ON at any convenient time and also can be turned OFF by the user. Just he has to enter the correct password. If the password is wrong the system can not be enabled or disabled.

So let us see how it is done.

CIRCUIT DESCRIPTION

As shown in the figure, the circuit consists of Arduino board, matrix keypad, laser torch (keychain laser type), LDR and few other components.

• The 3 columns of matrix keypad are connected to arduino digital pins 0, 1 and 2 and 4 rows are connected to pins 3, 4, 5 and 6 as shown

• One 8Ω speaker is connected to digital pin 7 directly

• One LED is connected to digital pin 19 (analog input pin A5) as shown for indication of intruder

• The LDR is connected in pull down configuration using a pull down resistor. The output of pull down resistor is given as input to analog input pin A0

• The four data pins D4 – D7 of LCD are connected to arduino pins 10 – 13. Control pin Rs of LCD is connected to arduino pin 8 and En pin of LCD is connected to pin 9 of arduino. One more control pin RW of LCD is connected to ground to enable LCD write always.

Here is the snap of circuit and other arrangements.

 

Prototype of Arduino based LASER Security System

Fig. 1: Prototype of Arduino based LASER Security System

CIRCUIT OPERATION

• When the circuit is given supply through USB, initially the security system is disabled. The message is displayed on LCD as “System is disabled. Enter password to enable system”

• At this moment, if laser light (beam) is interrupted, the alarm does not sound

• When the user enters the correct password, the system enables. The message is displayed on LCD as “System is enabled. Enter password to disable system” 

• Now as the laser beam is interrupted, the light does not fall on LDR, and its resistance increases. So the analog input voltage at A0 pin of Arduino falls down to certain threshold value

• This triggers the alarm and turns ON the LED. The alarm sounds for 5 – 10 seconds

• If the laser beam is resumed, both alarm and LED turns OFF. Otherwise, both remains ON till beam is interrupted

• Once again to disable the system, the user has to enter the correct password through the keypad. When correct password is entered, the system is disabled and the same initial message is displayed on LCD

• If anyone enters the wrong password, the system does not enable or disable. It gives “wrong password message” on LCD and gives audio notification.

Project Source Code

###


#include <Keypad.h>

#include <LiquidCrystal.h>

#include<String.h>


const byte ROWS = 4; // Four rows

const byte COLS = 3; // Three columns

// Define the Keymap

char keys[ROWS][COLS] = {

  {'1','2','3'},

  {'4','5','6'},

  {'7','8','9'},

  {'#','0','*'}

};

char set_pswrd[5] = "1234";

char pswrd[5];

int d=0,sys_en_flag=0,count=0;

// Connect keypad ROW0, ROW1, ROW2 and ROW3 to these Arduino pins.

byte rowPins[ROWS] = { 3, 4, 5, 6 };

// Connect keypad COL0, COL1 and COL2 to these Arduino pins.

byte colPins[COLS] = { 0, 1, 2 }; 


// Create the Keypad

Keypad kpd = Keypad( makeKeymap(keys), rowPins, colPins, ROWS, COLS );

LiquidCrystal lcd(8, 9, 10, 11, 12, 13);

#define ledpin 19

void setup()

{

  pinMode(ledpin,OUTPUT);

  digitalWrite(ledpin, LOW);

  lcd.begin(16, 4);

  lcd.clear();

  lcd.print("System Disabled ");

  lcd.setCursor(0,1);

  lcd.print("Enter Passward");

  lcd.setCursor(0,2); 

  lcd.print("to Enable System"); 

  lcd.setCursor(0,3); 

}


void loop()

{

  int i;  

  int sensorValue = analogRead(A0);   

  if((sensorValue<350) && (sys_en_flag == 1))

    {

      for(i=0;i<5;i++)

        {

          digitalWrite(ledpin,HIGH);

          tone(7,1500,1000);         

          digitalWrite(ledpin,LOW);

          tone(7,750,1000);         

        }

    }

  char key = kpd.getKey();      

  if(key)  // Check for a valid key.

  {

    switch (key)

    {

      case '*':

          break;

      case '#':

        if(strcmp(set_pswrd,pswrd)==0)

          {

            count++;

            if((count%2)==1)

              {

                lcd.setCursor(0,0);

                lcd.print("System Enabled  ");

                lcd.setCursor(3,2);

                lcd.print("Dsable");

                lcd.setCursor(0,3);

                lcd.print("    "); 

                lcd.setCursor(0,3);               

                sys_en_flag=1;

              }

            else

              {

                lcd.setCursor(0,0);

                lcd.print("System Disabled ");

                lcd.setCursor(3,2);

                lcd.print("Enable");

                lcd.setCursor(0,3);

                lcd.print("    "); 

                lcd.setCursor(0,3);  

                sys_en_flag=0;

              }

          }

         else

           {

               lcd.clear();

               lcd.print("wrong passward");

               tone(7,500,1000);

               delay(2000);

               if(sys_en_flag==0)

                 {

                    lcd.clear();

                    lcd.print("System Disabled ");

                    lcd.setCursor(0,1);

                    lcd.print("Enter Passward");

                    lcd.setCursor(0,2); 

                    lcd.print("to Enable System"); 

                    lcd.setCursor(0,3); 

                 }

               else

                {

                  lcd.clear();

                  lcd.print("System Enabled  ");

                  lcd.setCursor(0,1);

                  lcd.print("Enter Passward");

                  lcd.setCursor(0,2); 

                  lcd.print("to Dsable System"); 

                  lcd.setCursor(0,3);   

                }

           }

         d=0;

         break;

      default:

        lcd.print('*');

        pswrd[d] = key;

        d++;

        if(d==4) d=0;  

        delay(250);      

    }

  }

}

###

 


Circuit Diagrams

Circuit-Diagram-Arduino-Based-LASER-Security-System

Project Video

 


Filed Under: Electronic Projects

 

Next Article

← Previous Article
Next Article →

Questions related to this article?
👉Ask and discuss on Electro-Tech-Online.com and EDAboard.com forums.



Tell Us What You Think!! Cancel reply

You must be logged in to post a comment.

EE TECH TOOLBOX

“ee
Tech Toolbox: 5G Technology
This Tech Toolbox covers the basics of 5G technology plus a story about how engineers designed and built a prototype DSL router mostly from old cellphone parts. Download this first 5G/wired/wireless communications Tech Toolbox to learn more!

EE Learning Center

EE Learning Center
“engineers
EXPAND YOUR KNOWLEDGE AND STAY CONNECTED
Get the latest info on technologies, tools and strategies for EE professionals.

HAVE A QUESTION?

Have a technical question about an article or other engineering questions? Check out our engineering forums EDABoard.com and Electro-Tech-Online.com where you can get those questions asked and answered by your peers!


RSS EDABOARD.com Discussions

  • Finding past posts on edaboard?
  • Industrial Relay Board Design for Motorcycle Use
  • I think i have devised a new type of "super_transformer" for the Electricity grid?
  • What is the purpose of this relay?
  • mosfet driver problem in regeneration mode

RSS Electro-Tech-Online.com Discussions

  • Pic18f25q10 osccon1 settings swordfish basic
  • Sump pit water alarm - Kicad 9
  • Anyone jumped from Easyeda std to Easyeda pro?
  • turbo jet fan - feedback appreciated.
  • More fun with ws2812 this time XC8 and CLC

Featured – LoRa/LoRaWan Series

  • What is the LoRaWAN network and how does it work?
  • Understanding LoRa architecture: nodes, gateways, and servers
  • Revolutionizing RF: LoRa applications and advantages
  • How to build a LoRa gateway using Raspberry Pi
  • How LoRa enables long-range communication
  • How communication works between two LoRa end-node devices

Recent Articles

  • How IoT network topologies work
  • The top five AI startups to watch in 2025
  • STMicroelectronics unveils SoC based on secure MCU
  • Nexperia’s 48 V ESD diodes support higher data rates with ultra-low capacitance design
  • Taoglas releases Patriot antenna with 18 integrated elements covering 600 to 6000 MHz

EE ENGINEERING TRAINING DAYS

engineering

Submit a Guest Post

submit a guest post
Engineers Garage
  • Analog IC TIps
  • Connector Tips
  • Battery Power Tips
  • DesignFast
  • EDABoard Forums
  • EE World Online
  • Electro-Tech-Online Forums
  • EV Engineering
  • Microcontroller Tips
  • Power Electronic Tips
  • Sensor Tips
  • Test and Measurement Tips
  • 5G Technology World
  • Subscribe to our newsletter
  • About Us
  • Contact Us
  • Advertise

Copyright © 2025 WTWH Media LLC. All Rights Reserved. The material on this site may not be reproduced, distributed, transmitted, cached or otherwise used, except with the prior written permission of WTWH Media
Privacy Policy

Search Engineers Garage

  • Electronic Projects & Tutorials
    • Electronic Projects
      • Arduino Projects
      • AVR
      • Raspberry pi
      • ESP8266
      • BeagleBone
      • 8051 Microcontroller
      • ARM
      • PIC Microcontroller
      • STM32
    • Tutorials
      • Audio Electronics
      • Battery Management
      • Brainwave
      • Electric Vehicles
      • EMI/EMC/RFI
      • Hardware Filters
      • IoT tutorials
      • Power Tutorials
      • Python
      • Sensors
      • USB
      • VHDL
    • Circuit Design
    • Project Videos
    • Components
  • Articles
    • Tech Articles
    • Insight
    • Invention Stories
    • How to
    • What Is
  • News
    • Electronic Product News
    • Business News
    • Company/Start-up News
    • DIY Reviews
    • Guest Post
  • Forums
    • EDABoard.com
    • Electro-Tech-Online
    • EG Forum Archive
  • DigiKey Store
    • Cables, Wires
    • Connectors, Interconnect
    • Discrete
    • Electromechanical
    • Embedded Computers
    • Enclosures, Hardware, Office
    • Integrated Circuits (ICs)
    • Isolators
    • LED/Optoelectronics
    • Passive
    • Power, Circuit Protection
    • Programmers
    • RF, Wireless
    • Semiconductors
    • Sensors, Transducers
    • Test Products
    • Tools
  • Learn
    • eBooks/Tech Tips
    • Design Guides
    • Learning Center
    • Tech Toolboxes
    • Webinars & Digital Events
  • Resources
    • Digital Issues
    • EE Training Days
    • LEAP Awards
    • Podcasts
    • Webinars / Digital Events
    • White Papers
    • Engineering Diversity & Inclusion
    • DesignFast
  • Guest Post Guidelines
  • Advertise
  • Subscribe