Introduction: Arduino Laser Tripwire

Picture of Arduino Laser Tripwire

Hey, there makers, hackers, and just plain inventors! This instructable is a fun and easy Arduino project for beginners (or advanced) that shows you how to make...ahem...drum roll please!
An Arduino Laser Security System! Bah, Bah, Bah,Baaaaaaaahhh! It uses simple electronic components, and an easy-to-use sketch. Basically what happens, is the laser shines on a photoresistor that sends an output to the Arduino. When the beam is interrupted, the arduino tells the buzzer to buzz, and the LED to light. So, without further ado, lets get started!

P.S. I wuz having trouble getting a video on here if it doent work, go to this link:

Step 1: Materials

Picture of Materials

This is an easy project, and requires a small amount of materials/tools. They are:

Altoids Tin x 2 (one big, one small)
Battery cord
3 volt button cell battery
Wire (any gauge will do)
Circuit board
Photo resistor
Laser diode
Stay-on push button
10k resistor

Wire cutter
Soldering iron
Hot glue gun/glue sticks

Step 2: Laser Housing

Picture of Laser Housing

Okay, let start! Begin by nailing two holes into the side of the smaller Altoids tin. make them as low as possible, so that the top doesn't get in the way.

Step 3: Solder and Install Laser

Picture of Solder and Install Laser

Solder together the laser diode, the stay-on push button, and the button cell battery. Install them in the two holes you made earlier with hot glue.

Step 4: Reciever Housing

Picture of Reciever Housing

Nail two holes in the bigger Altoids tin (one on each side in opposite corners). Now cut a piece of foam or rubber and place it on the bottom of the Altoids tin to insulate it.

Step 5: Reciever Schematic

Picture of Reciever Schematic

Solder together your photo resistor,LED, Buzzer, and 10k resistor according to this schematic.

Step 6: The Sketch

This is the sketch for the Arduino. Copy and paste it into the sketch environment. Then upload it to the Arduino.

//Laser Tripwire sketch

#define LED 13 //LED is connected to pin 13

#define Buzzer 7 //Buzzer is connected to pin 7

#define Sensor 0 //Photoresistor is connected to pin 0

int val = 0; //val is used to store state of input pin

void setup() {
  pinMode(LED, OUTPUT); //sets digital pin as output
  pinMode(Buzzer, OUTPUT); //sets digital pin as output
  pinMode(Sensor, INPUT); //sets analog pin as input

void loop() {
  val = analogRead(Sensor); //read input value of sensor and store it
    if (val<100) // if the sensor goes below 100...
    digitalWrite(LED, HIGH); //turn on LED
    digitalWrite(Buzzer, HIGH); //turn on buzzer
else if (val>100)
      digitalWrite(LED, LOW); //else, keep LED off
      digitalWrite(Buzzer, LOW); //else, keep Buzzer off

Step 7: Install Reciever Circuit and Arduino

Picture of Install Reciever Circuit and Arduino

Make your connections to all the pins on the Arduino, then insert it into the Altoids tin. Make sure to cut two holes in the top of the Altoids tin for the buzzer and LED. You also will need to bend the photo resistor to align with your hole.

Step 8: Finishing Touches

Picture of Finishing Touches

The last step is to solder the switch and battery to the cord coming from the Arduino. Congratulations! You have just successfully made an Arduino Laser Tripwire! Have fun, and catch people in the act!


kidokwan (author)2016-08-13

hey, this is a great idea. Can the code be modified somehow to activate a small servo motor instead of an LED and buzzer? I want to activate a servo to turn instead of a led and buzzer. Any code for this somewhere?

_PJ007 (author)2014-10-17

i want to do it with a Gsm Module... Can you give suggestions and programs for making so for perimeter protection

atharva12 (author)2014-03-08

hi you can make this a lot cheaper watch this

Thanks KipKay

rondacosta (author)2013-01-24

very nice 'able.
Two things: First, no laser diode, no project. Therefore, if you do not provide any info on the heart of the circuitry, it becomes a novelty to only talk about,,,,
Second, the Purpose was to provide perimeter security (?). how far can you put the beam source from the detector circuitry and trip it? if no information, it may not be worth trying just to try. Any help o these questions?

Adum24 (author)rondacosta2013-01-26

Hey rondacosta, thanks for checking out my project! As for the laser diode, I merely pulled it out of a toy, but they sell ones at dollar stores for a buck that will suffice. If you wanted to buy one on ebay or something, I would not be able to tell you specifics, sorry. Again, I pulled it out of a toy, so, I didn't really know the specifications. In regards to the distance between the diode and the detector circuitry, I never really tested it, but I'm sure it could go more than a few feet. Seeing as its only really suppose to go in one doorway, it shouldn't really be an issue. I hope this answers your questions!

HavocRC (author)2013-01-06

You should make the code so that once the beam is broken the alarm stays on for like say 5 seconds. Then it could actually be useful as a burglar alarm!

Just a suggestion!

Adum24 (author)HavocRC2013-01-20

Thanks for the suggestion. That does make more sense :D I made this a while ago, so there are many improvements that could be made.

HavocRC (author)Adum242013-01-21

Haha, I could see burglars going, "Alright, JUMP AS FAST AS YOU CAN!" Haha, I like this project. I think I'll make it today :D

Snortimer (author)2013-01-06

Nice 'ible! I plan on using a laser tripwire for Halloween next year, and this is a great start on how to do it! As per a suggestion below (and which I had thought of), I'll probably mount the laser in an enclosure with a laser, so that all of the electronics are together, and use a mirror to guide the light. If I get ambitious, I might add a prism and monitor different light colors to detect exactly where my victi... Er, "subject" is. Then I can trigger some fun stuff, as the noise sensors don't work the way I'd like. Also, one thing doesn't have a sensor at all, and just runs continuously (so annoying).

Snortimer (author)Snortimer2013-01-06

Plus, by monitoring different wavelengths this way (or just aiming different beams at different sensors), I could use one Arduino (more likely just the ATmega328p) to control a few different baddies. Of course, I'd have to somehow mount mirrors outside with some precision.

Adum24 (author)Snortimer2013-01-20

NIce! I like your line of thinking!! Yeah I made this a while ago, so there are obviously many improvements that I see now looking back on it. I hope your project goes well!

jensenr30 (author)2011-01-25

Isn't Arduino just BOSS?

Adum24 (author)jensenr302011-01-25


GameNox (author)Adum242011-06-11

I want to get Arduino but if I buy 1 other projects will say I need a different type. Should I just buy any one?

GameNox (author)GameNox2012-03-08

Yay!!! They are finally selling Arduino at RadioShack :D (Happiness!)


jensenr30 (author)GameNox2012-03-15

really? wow. radioshack just got 20% cooler.

MackeFeet (author)jensenr302012-06-28

Amen. Lol. :)

GameNox (author)jensenr302012-03-15

I know!!!

facilitator476 (author)GameNox2011-08-16

I recently got the arduino uno for my birthday and it is worth every penny. Which board you get depends on what you plan to do. Look at their website to get some ideas

If you get an arduino you'll want to download Ubuntu (a spin-off of Linux) which has a free App made to program arduinos. The OS only takes up a few GBs and you can run it side-by-side with any other OS, If my netbook has enough room your computer should too

jensenr30 (author)GameNox2011-06-15

buy an "Arduino Mega 2"
They kick a*s

Adum24 (author)GameNox2011-06-14

You can really buy any one you like! The newest is the Arduino Uno, which i reccomend for starters. The ones that say u need a certain kind are probobaly reffering to the Arduino Mega, which is a super-sized arduino with a lot of extra ports. You probobaly wont need for when you're learning, but if you get really involved and need to do a big project, thats the way to go. The Aruino Nano is also available for when space is an issue. Its tiny! Hope this helps

iApple guy (author)2012-03-04

Why not just make a sheiled for the arduino?

Adum24 (author)iApple guy2012-03-15

too much work ;)

iApple guy (author)2012-03-04

Is the LED needed?

Adum24 (author)iApple guy2012-03-15

Nah, just an added effect.

Ugifer (author)2011-10-20

This is a neat little project, but I wonder whether it might be made even more cunning:

How about mounting the laser with the Arduino and using a mirror (or even a whole bunch of mirrors) to send the beam around and return it for sensing.

If you powered the laser from the Ardu', you could control it so that it just flashed for a moment, say every tenth of a second, and took a reading each time. That would save a lot of power and avoid overheating the laser diode. Also it means that you only needed one "active" box, battery etc.

Just a thought.

diy_bloke (author)Ugifer2012-03-04

Good idea, added bonus is that it would be harder for Catherine Zeta Jones to crawl under and over the laser beams :-) We would have missed some nice shots though :-)

Adum24 (author)Ugifer2011-10-22

Hmm... yeah that would be more efficient. If you actually make that, send me a pic or something and I'll give you a patch!

04mewm (author)2011-01-24

Good write up on a nice simple arduino project, but how about making it a bit more useful by programming it to keep the buzzer on after it has been tripped and adding a reset button? Or if you haven't got an extra button to hand you could just use the existing arduino reset button.

Adum24 (author)04mewm2011-01-24

Oh, good point. I'll look into it. Great suggestion! I think I'll leave it like that for now, but great idea!

Biscuitus (author)Adum242011-12-08

It's nothing you really have to add. Just send the buzzer output to a relay that is normally open, the impulse will flip to a normally closed. Wire your buzzer to that and voila, buzzer on. Program a LOW for a certain time period to shut it off or just let it go until the battery dies. The point of this instructable is to encourage people to expand on it. He's done the heavy lifting, it's up to you to fine tune it.

BdSquirrel (author)2011-12-03

You can build this with a couple of 555s. One 555 modulating a train of pulses on the laser in astable mode, and another 555 wired in "Missing pulse detector" mode on the receiver end. That way it can't be foiled by shining another laser onto the sensor.

GameNox (author)2011-06-11

You don't even need Arduino...

bchong (author)2011-03-24

Hello, i noticed u have an arduino book laying down there could u please tell me the name and its author? thanks im looking forward to learn how to program my arduino.. xD thnks again awesomeproject

Adum24 (author)bchong2011-03-27

Hey, bchnog. Thats great that you want to get into the arduino! The book is called Getting Started With Arduino by Massimo Banzi. Now, although this helped, there are MUCH better books on learning the arduino language out there. I recommend the book Beginning Arduino by Michael McRoberts. It is a very good beginner book. Thanks for the compliment. Good luck with your Arduino!

iceng (author)2011-02-14

What was the longest distance that your 'Tripwire' worked on? I ask, because I can plink ( ie light-up ) a stop sign over a block away with a small $3 laser pointer.

Adum24 (author)iceng2011-02-17

Yeah, same here. IT just depends on battery life and your laser. It will go very far.
Although, its harder to line up with the hole.

1324itouch (author)2011-02-02

were did you get that laser ?

Adum24 (author)1324itouch2011-02-04

I got it out of a cheap light up top. When you spun it, the laser made a circle around the top because it was spinning so fast. Why?

MPaulHolmes (author)2011-01-25

Boy, I can think of a lot of fun uses for a laser trip wire. I could get a bunch set up in my room, and keep the valuables right in the open, adn people could try to steal them, or I could do dive rolls, and try to defeat it! This sounds so fun! Thank you!! My son is going to love this one.

Adum24 (author)MPaulHolmes2011-01-26


jensenr30 (author)2011-01-23

Subscribed on youtube and instructables!!

Adum24 (author)jensenr302011-01-24


Jedrokivich (author)2011-01-24

Whoa, where can I get those Dark Chocoate Altoids?

Adum24 (author)Jedrokivich2011-01-24

LOL, Im not sure. My science teacher has like 3 gazillion she's not sure what to do with, so I asked for one. She said,"Yes, please take it!" I think you can get it at walgreens or someplace like that, though.

About This Instructable




Bio: I love doing anything with electronics. You're throwing away an old computer? I'll take it! I also love robots, sci-fi, and EDM music ... More »
More by Adum24:Raspberry Pi Rain BoxEasy 30 Minute Pocket Digital MicroscopeWhiplash Costume (From "Iron Man 2")
Add instructable to: