How to Build a DIY Laser Tripwire Alarm with Arduino for Home Security


Building a laser tripwire alarm with an Arduino is an easy and affordable way to add an extra layer of security to your home. In this guide, I will walk you step-by-step through the process of assembling the components and writing the code to create your own DIY laser tripwire alarm.

This alarm system uses an invisible laser beam that, when broken, triggers an audible alarm through a buzzer or piezo speaker. The core components include an Arduino microcontroller, a laser diode, a laser sensor, and a few other inexpensive electronic parts.

With just a little bit of soldering and coding, you can construct a highly sensitive alarm that can notify you immediately when someone enters a protected room or area. A laser tripwire alarm is perfect for adding security to entryways, staircases, hallways, windows, or anywhere else an intruder may cross.

Benefits of a DIY Laser Tripwire Alarm

Constructing your own laser tripwire alarm has several advantages over purchasing a commercial system:

For those with a bit of technical skill, assembling your own laser tripwire alarm from an Arduino is a great alternative to costlier commercial systems. It's a fun DIY project that will provide real protection for your home.

How a DIY Laser Tripwire Alarm Works

A DIY laser tripwire alarm consists of a few key components working together:

The laser diode and sensor are placed facing each other across the area to be protected. The Arduino monitors the laser sensor. If the sensor goes LOW because the beam is blocked, the Arduino activates the buzzer to sound the alarm.

This simple setup provides an affordable yet effective perimeter alarm for detecting intruders. Now let's look at how to assemble the circuit and program it.

Components and Tools Needed

To build your own laser tripwire alarm, you will need the following components and tools:



Many of these components can be salvaged from old electronics or purchased inexpensively from online retailers. The most important pieces are the Arduino, laser diode and sensor, and buzzer.

Wiring up the Circuit

With all the components ready, we can start building the circuit on a breadboard or prototype board. The wiring diagram below provides a visual reference:

How to Build a DIY Laser Tripwire Alarm with Arduino for Home Security

Here are the step-by-step wiring instructions:

  1. Connect the ground rail on the breadboard to the GND pin on the Arduino.

  2. Connect the power rail on the breadboard to the Arduino's 5V pin if using a 5V power source. Use the 7805 voltage regulator if using a 9V battery or wall adapter.

  3. Install the 220 ohm resistor in series with the laser diode anode (A) pin. Connect the cathode (C) pin to ground.

  4. Connect the laser sensor power pin to 5V and ground pin to the Arduino GND.

  5. Connect the laser sensor signal pin to Arduino pin D2 through a 10K ohm pull-down resistor.

  6. Connect the positive lead of the buzzer, piezo, or speaker to Arduino pin D3. Connect the negative lead to ground.

  7. Connect a 0.1 uF decoupling capacitor across the power and ground rails.

Double check that all components are properly connected and in the right orientation. The circuit is now wired up!

Arduino Code

With the hardware assembled, we need to upload code to the Arduino so it can monitor the sensor and activate the alarm:

const int laserPin = 2; // Laser tripwire signal pin
const int alarmPin = 3; // Buzzer/speaker pin

void setup() {

pinMode(laserPin, INPUT);
pinMode(alarmPin, OUTPUT);


void loop(){

if(digitalRead(laserPin) == LOW){

digitalWrite(alarmPin, HIGH); // Sound alarm



digitalWrite(alarmPin, LOW);  // Disable alarm



This simple sketch continuously checks if the laser sensor pin goes LOW when the beam is broken. If so, it activates the buzzer or speaker to sound.

You can customize the code to change the alarm duration, add delays, or modify the sound in other ways. Upload this code to your Arduino and it's ready to detect any tripped laser beams!

Installing and Adjusting the Tripwire

Once the hardware and software are prepared, the last step is to properly install the laser tripwire:

Be very cautious to never look directly into the laser diode as it can seriously damage eyesight. Make sure the laser only shines on the sensor when aligned. Also avoid getting the beam at face level.

With some careful adjustment, you now have an effective laser tripwire alarm system to protect your home using just DIY electronics!

Expanding the Alarm System

A single tripwire is useful for small areas, but you can expand the system for more comprehensive protection:

With additional Arduinos, wiring, and sensors, the possibilities are endless for creating your own robust home security system. The DIY laser tripwire serves as the core detection mechanism.


Constructing a laser tripwire alarm with Arduino is an achievable weekend project that requires only basic skills in electronics and programming. This inexpensive DIY alarm system provides real protection against intrusions for your home or office.

I hope this guide gave you a good overview of how to assemble the circuitry, program the Arduino, and properly install the laser tripwire. With the right components and a bit of experimentation, you can build an effective alarm system customized exactly for your space.

Let me know if you have any other questions! I'm happy to provide guidance to anyone interested in constructing their own DIY Arduino home security devices. Stay safe!