ad space

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 and 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 per-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.
 
Laser Diode & LDR based alarm system using Arduino
 
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.

Laser Diode,LDR, Arduino alarm system circuit diagram
 
In the above circuit drawing, at the laser diode transmitter, the LM317 voltage regulator is used for driving constant voltage and current into 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 sound buzzer for the alarm is connected to pin 4 of Arduino Nano.

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.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.println("--------------------------------------------------\n");
}

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

    if(ldrValue <= 350){
        digitalWrite(buzzerPin, HIGH);
      }
    else{
        digitalWrite(buzzerPin, LOW);
      }
    Serial.println(String(ldrValue)+","+String(ldrVoltage)+"V");
    delay(100); 	//100ms delayto prevent any duplicates
}
 

Proteus Simulation

 The following video shows simulation of the laser diode and LDR based alarm system using Arduino Nano concept in Proteus
 

 
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 Light Dependent Resistor (LDR) Light Detector Alarm with Arduino). Other alarm system can be designed using Infrared sensor and/or Photo Diode(Photodiode Light Detector with Arduino). Yet another kind of another alarm system was illustrated using keypad in the tutorial Password based Door Locking System using Arduino.

5 Comments

Previous Post Next Post