1

Laser Diode & LDR based alarm system using Arduino

 In this Arduino electronics tutorial it is illustrated how to make laser based alarm system using Laser diode with LDR(Light Dependent Resistor). This can be useful to make security system for home usage or industrial application. It may also be useful in counting mechanism and control application. Arduino code for laser diode with LDR for alarm system is provided. Schematic wiring diagram of interfacing Arduino with LDR and buzzer, laser driver circuit with video demonstration are provided.

 

How it works

During normal operation, the laser beam from the laser diode hits the LDR. But when the laser beam is obstructed, LDR detects this because then it's resistance increases. This increase in resistance and hence increased voltage is detected by the Arduino ADC. When the increased voltage becomes higher than some pre-defined voltage at normal condition, alarm is sounded using a buzzer by the Arduino. Hence whenever intruder crosses the laser beam line, alarm is sounded.

Interfacing & Schematic wiring drawing of interfacing Arduino, LDR, buzzer and laser driver 

The following picture shows implementation of interfacing Arduino with LDR and buzzer at the receiver and the laser diode driver circuit for the transmitter.
 


The following is the circuit schematic diagram of wiring Arduino with LDR and buzzer at the receiver and the laser diode with laser diode driver circuit for the transmitter.
 
 

In the above circuit drawing, at the transmitter, the LM317 voltage and current regulator is used for driving constant voltage and current to the laser diode. The two resistors used in the laser driver circuit is 220Ohm and 270Ohm. The input supply is 5V and the output voltage is 2.78V. At the receiver, the LDR along with 10KOhm resistor forms a voltage divider circuit between 5V and ground. The middle of the voltage divider is connected to the Arduino analog pin A3. The Arduino ADC samples the voltage from this voltage divider. The buzzer is connected to pin 4 of Arduino.
 

Video demonstration of laser based alarm system

 

 

Arduino Code for Laser Diode LDR based alarm system

 
The following is the Arduino code for the laser based alarm system.
 
//Program for laserdiode based Alarm using LDR, Arduino, Buzzer
//Source: https://ee-diary.blogspot.com


const int ldrPin = A3;
const int buzzerPin = 4;

void setup(){
  Serial.begin(9600); //set Serial output baud rate
  pinMode(buzzerPin, OUTPUT);
  //For output format
  Serial.println("nADC value, Voltage(V):");
  Serial.print("--------------------------------------------------n");
}

void loop() {
    int ldrValue = analogRead(ldrPin);
    float ldrVoltage = (ldrValue/1024.0)*5;

    if(ldrValue > 300){
        digitalWrite(buzzerPin, HIGH);
        delay(500);
        digitalWrite(buzzerPin, LOW);
        delay(500);
      }
    else{
        digitalWrite(buzzerPin, LOW);
      }
    Serial.println(String(ldrValue)+","+String(ldrVoltage)+"V");
    delay(1000); //delay 2000ms to prevent any duplicates
}
 
 
The laser based alarm system is suitable for application where detection based on light beam are useful. Similar alarm system can be designed using only LDR(see ). Other alarm system can be designed using Infrared sensor and/or Photo Diode(). Yet another kind of another alarm system was illustrated using keypad in the tutorial .


[fixed][/fixed]