fardinanam / Laser-Security-System-With-Arduino

CSE316 project of level 3 term 1

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Laser Security System With Arduino

Introduction

This is a simple project to control a laser security system with Arduino. The laser is controlled by an ATmega32 which enables the laser to blink at a certain rate. This laser is sensed by an LDR sensor from the other end and detects the rate at which the laser blinks. The LDR sensor is connected to the Arduino which controls the alarm system. Whenever someone interrupts the laser, the Arduino does the following:

  • Turns the buzzer on
  • Turns the red light on
  • Sends an SMS to the owner
  • Calls the owner

The alarm can be turned off by pressing the push button on the Arduino. There are switches to turn off the security of any specific edge of the boundary. Watch the demonstration of the project here.

How to reconstruct the project

Required Hardwares (One Unit)

  • Arduino (Recommended - Arduino Uno)
  • ATmega32
  • GSM module (Recommended - SIM900)
  • Laser
  • LDR (Recommended - LDR module)
  • Buzzer
  • Red light
  • Relay module
  • Push Button
  • SPST swithches
  • Power adapter (output 5V, 2A)
  • USB cable
  • Wires

Required Softwares

Setting up the alarm unit

  • Download the project.

  • Open the Arduino IDE, connect your Arduino to your computer and upload the sketch laser_security_system.ino.

  • Now connect the following components to the Arduino as follows:

    • LDR: D0 of LDR1 (LDR module) to pin 3. D0 of LDR2 to pin 2. VCCs of both the LDRs to Arduino's 5V. GNDs of both the LDRs to Arduino's GND.

      Note: The LDR connection described above is for LDR module. For more details, see the documentation.

    • Buzzer: VCC to pin 13 and GND to the GND of Arduino. You can also connect it to the relay if you want a better buzzer that requires higher voltage.

    • Red Light: Relay modules' IN to pin 13 parallely with buzzer. VCC and GND of the relay module should be connected to Arduino's 5V and GND. COM of the relay module to external power's + end and the NC of the relay module to the red light's + end. The red light's - end should be connected to the - end of the external power directly. For more details, see the documentation.

    • Push Button One end of the stop button (push button) to pin 4 and the other end to the 5V pin. Note that the end which is connected to pin 4 must be connected with a pull-down resistor as shown in the image below.

    • Switches: One end of both the SPST switches should be connected to the 5V of Arduino and the other ends to pin 5 and pin 6. These also require pull-down resistors as like as the push button.

    • GSM module: TX pin of the GSM module to pin 8 and RX pin of the GSM module to pin 7. GND of the GSM module to GND of Arduino. The power port's VCC and GND of the SIM900 should be connected to the VCC and GND of the adapter.

      Note: The GSM module requires the current supply to be 2A. So, an appropriate power adapter is required.

    alarm system

Setting up the laser unit

  • Open Microchip studio and open laser_unit.cproj.

  • Build the project.

  • Connect an ATmega32 using a USBASP programmer.

  • Open Extreme Burner.

  • Open the .hex file created in the laser_unit\Debug folder by Microchip studio. Then burn it to the ATmega32.

  • Now connect the following components to the ATmega32 as follows:

    • It is recommended to use an adapter to power the ATmega32 as the security system should be turned on all the time. So connect the pin 10 (VCC) of the ATmega32 to the VCC of the adapter and the pin 11 (GND) of the ATmega32 to the GND of the adapter.
    • The positive + ends of the laser to ATmega32's pin 40 (A0) and pin 39 (A1). And the negative - ends to the ground of the power system.

    laser unit

How to use the project

Every unit of the alarm system has two LDR sensors, which means one unit can secure two edges of the boundary. So a total of 2 units are required to secure a boundary of rectangular shape. The same is the case for the laser unit. See the image below for a better understanding.

schematic diagram

Problems faced and how we solved them

  • The GSM needs a current supply of 2A continuously. A battery is not enough to power the GSM. So, we had to use a power adapter or a power bank that can supply 2A continuously.
  • The LDR sensor is too small. It is difficult to exactly point the laser to the LDR sensor from a long distance. So we have used a glass that can convege light (like the one in a torch light) to the LDR sensor.
  • It is not possible to detect the exact timing of the laser's blink by the Arduino. Because there is a delay caused by the LDR and also in executing the code. We have seen that there is an error of 10-100ms. So, we had to use an error factor of 100ms while making a decision whether there is a breach or not.

Contributors

About

CSE316 project of level 3 term 1


Languages

Language:C++ 92.7%Language:C 7.3%