Smart Vehicle Garage Security System: Arduino & Laser Tripwire

Model Picture

 1. Introduction

Garages are often the most vulnerable part of a home, housing expensive vehicles and tools. This project builds a comprehensive Garage Security System using an Arduino, a Laser Module, and a Magnetic Reed Switch. It monitors if the garage door is opened and uses an "invisible" laser fence to detect any movement inside the garage, triggering a loud siren and high-brightness LED strobe.

2. Components

  • Arduino Uno or Nano

  • Laser Diode Module (650nm 5V)

  • LDR (Light Dependent Resistor)

  • Magnetic Reed Switch (For the garage door)

  • Active Buzzer (5V) or 12V Siren

  • Relay Module (1-Channel)

  • 10kΩ Resistor (for LDR voltage divider)

  • Jumper Wires and PVC pipe (to house the laser/LDR)

3. Circuit and Connections

Arduino Uno Pinout Diagram
Arduino Uno Pinout Diagram

Laser Tripwire  Module and LDR
Laser Tripwire  Module and LDR

Magnetic Reed Switch
Magnetic Reed Switch


Pinout Diagram of Single Channel Relay Module
Pinout Diagram Relay Module

  • Laser Tripwire (LDR):

    • One side of LDR → 5V

    • Other side of LDR → Analog Pin A0 (and to GND via 10kΩ resistor)

  • Magnetic Reed Switch:

    • One side → GND

    • Other side → Digital Pin 2 (Use internal INPUT_PULLUP)

  • Laser Module:

    • VCC → 5V, 

    • GND → GND

  • Relay (Siren Control):

    • VCC → 5V, 

    • GND → GND, 

    • NPUT → Digital Pin 8

4. Detailed Step-by-Step Circuit Working

  1. Door Monitoring: The Magnetic Reed Switch is placed on the garage door frame. When the door is closed, the magnet keeps the switch closed (LOW). Opening the door breaks the connection (HIGH).

  2. The Laser Fence: A Laser Diode is pointed directly at an LDR across the garage. As long as the laser hits the LDR, the resistance stays low.

  3. Intrusion Detection: If a person or vehicle passes through the laser beam, the LDR resistance spikes instantly.

  4. Logic Processing: The Arduino checks both the door state and the LDR value. If either is triggered while the system is active, it sends a signal to the Relay.

  5. Alarm Activation: The relay switches on the 12V siren, creating a loud deterrent.

5. Libraries to be included

This project relies on standard Analog and Digital I/O functions. No external libraries are required, which ensures the code is highly responsive for real-time security.

6. Code

C++
const int ldrPin = A0;
const int reedPin = 2;
const int relayPin = 8;
const int threshold = 500; // Adjust based on your laser brightness

void setup() {
  pinMode(reedPin, INPUT_PULLUP);
  pinMode(relayPin, OUTPUT);
  digitalWrite(relayPin, HIGH); // Relay Off (Active Low)
  Serial.begin(9600);
}

void loop() {
  int ldrValue = analogRead(ldrPin);
  int doorState = digitalRead(reedPin);

  // Trigger if laser is blocked OR door is opened
  if (ldrValue < threshold || doorState == HIGH) {
    Serial.println("ALARM TRIGGERED!");
    digitalWrite(relayPin, LOW); // Siren ON
    delay(10000);                // Alarm for 10 seconds
    digitalWrite(relayPin, HIGH);
  }
}

7. Detailed Step-by-Step Code Working

  1. INPUT_PULLUP: We use the Arduino's internal resistor for the Reed switch to simplify the wiring.

  2. Analog Threshold: The ldrValue < threshold logic detects the "shadow" created when the laser beam is broken.

  3. Logical OR (||): This is the key to the security system. It tells the Arduino to sound the alarm if either the door opens or the laser beam is interrupted.

  4. Relay Latching: The 10-second delay ensures the siren is loud enough to be heard before the system resets.

8. Tips

  • Alignment: Use a small piece of PVC pipe to shroud the LDR. This prevents ambient garage lights from interfering with the laser detection.

  • Mirrors: You can use small mirrors to bounce the laser beam around the garage, creating a "grid" of protection with just one laser module.

  • Placement: Place the Reed switch at the very top of the garage door to detect even a small opening.

9. Uses

  • Vehicle Protection: Detects if a car is being moved out of the garage.

  • Workshop Security: Protects expensive power tools and machinery.

  • Automatic Lighting: Can be modified to turn on garage lights automatically when you drive in.

10. Conclusion

The Garage Security System combines magnetic and optical sensing to create a robust shield for your vehicles. It is a practical application of Arduino that demonstrates how multiple sensors can work together to solve real-world problems.


Similar Posts you May Be Interested:

https://simplebasicelectronics.blogspot.com/2 026/03/arduino-pir-motion-sensor-alarm.html

https://simplebasicelectronics.blogspot.com/2026/03/arduino-gas-leak-detector-using-mq-2.html

https://simplebasicelectronics.blogspot.com/2026/03/arduino-flame-sensor-fire-alarm.html

https://simplebasicelectronics.blogspot.com/2026/04/arduino-driver-drowsiness-detection.html

https://simplebasicelectronics.blogspot.com/2026/03/diy-arduino-rain-alarm-yl83.html

https://simplebasicelectronics.blogspot.com/2026/04/touch-sensor-burglar-alarm-using-arduino.html

തുടക്കക്കാർക്കായി ഇലക്ട്രോണിക്സ് ലളിതമായി പഠിക്കാം.

Empowering students in Kerala with hands-on technical skills.