Introduction: Another Arduino Laser Tripwire

Picture of Another Arduino Laser Tripwire
This is my version of login258's laser tripwire at

I've made a couple of modifications: the laser is now independent from the Arduino so that it can be placed anywhere in the room and I've changed the LED to a buzzer.


Step 1: Parts

You will need:

Laser emiter, 3v battery and on/off switch OR Laser pointer and electrical tape

Photocell (a big one because it makes an easier target)
2 10k resistors
peizo buzzer
Battery to power the arduino with a jack
Various short jumpers
Elastic bands
Bored kids
Wet sunday afternoon

Step 2: Build the Circuit

Picture of Build the Circuit

Connect the peizo's positive wire to pin 11 via a 10k resistor and ground wire to ground on the breadboard.
Connect one leg of the photocell to the 5v pin on the arduino.
Connect the other leg to analog pin 0 AND to ground on the breadboard via the second 10k resitor.
Connect ground on the breadboard to ground on the arduino.
Plug the battery (I used 12v because that was what was to hand) into the arduino power jack when you want to use it away fronm the computer but to get it up and running it can take power through the USB for now.
Strap it all together with an elastic band.

If using a laser emitter wire it to a 3v battery pack and add lots of blu-tac to make aiming it easier later on.

Step 3: Calibration

Photocells differ so you need to calibrate yours to your laser. Run the following sketch from Login258 or use the one on the arduino website at

void setup() {
pinMode(4, OUTPUT);

void loop(){
digitalWrite(4, HIGH);

With the sketch running press Serial Monitor on the arduino window and make a note of the numbers that appear in the bottom of the window with the laser on the photocell and when it is off (ambient light).

Step 4: The Code

Upload the following sketch but adjust the value in the "if" statement to suit your photocell. Pick a number a bit above the ambient light number. This may need tweaking later, or, just pull a curtain or shrpud the photocell to lower the ambient light in the room.


int buzzPin = 11; // buzzer connected to digital pin 11

void setup() {
pinMode(buzzPin, OUTPUT); // sets the digital pin as output

void loop(){
if(analogRead(0) < 850){ // this number depends on calibration of the photocell
digitalWrite(buzzPin, HIGH); // turns buzzer on
delay(1000); // waits for 1 second
digitalWrite(buzzPin, LOW); // turns buzzer off

} else{
digitalWrite(buzzPin, LOW);


qwertymaker (author)2016-07-18

hey I'm trynna make this and I've done the exact same thing but when there's no laser the buzzer sounds, and it sounds louder when the laser is shone. I've copy-pasted the code. Please help it's really important.

I haven't looked at this since I posted it so am a bit rusty. It may be code is now deprecated and you need to find updated commands on the forums OR the cell is not calibrated as in Step 3. You need a clear differential in readings so the code knows what is high and what is low. If you copied the readings from my code they will be different for your laser and cell so won't work. Also I put my photocell down a short piece of plastic pipe to keep the cell in the shade which helped a lot.

andr3w99 (author)2013-02-28

Can someone make an instructable to help me run a code on an Arduino Uno? If would be very helpful! Thanks.
(I need fully detailed steps)

diy_bloke (author)andr3w992015-01-23

1 start Arduino IDE
2 open code you want
3 connect Arduino to yr computer with USB cable
4 in IDE select under 'Tools' the proper port and board
5 press 'upload' in yr IDE

andr3w99 (author)2013-02-28

Is there any code needed to make this work? Or can I just set it up & it will work?

diy_bloke (author)andr3w992015-01-23

yes you need code, otherwise the arduino has no idea what you want

Xanderone (author)2014-06-07

I can't get easy access to cheap laser pointers in my region (west Africa) but I sure have hundreds of faulty CD and DVD players lying around. Could I make use of the laser module inside these players? If yes, would I have to remove their lens system or just use it as it comes? A quick answer will be appreciated.

devilmaycry (author)2011-10-10

do you when the beam is broken, does the buzzer keep on buzzing or does it tur off after a while

yes it turns off

Login258 (author)2009-02-28

Thanks for the credit! I'm glad my Instructable actually made some sort of impact. Someone commented on mine and said that two photoresistors would work well, one for ambient light and one for the laser, so that's a good suggestion for you .

GreyGriff (author)Login2582009-03-17

Mr Login258......I just stumbled onto your little experiment. I have a need and I figured you seemed a lot smarter than I and could tell me if it is possible, how small could the devices be and how much would each cost? I want a laser beam that goes between 20" - 36" or maybe even 48" and when broken makes a noise. I need small....maybe the laser in one section and the "guts" in another place? Cost......are we talking $5, $10, $25 or $50? How do lasers perform outside; wind and sun? My email is on me if you can help.

akinich (author)GreyGriff2012-02-08

why not buy the arduino board and just get atmega's perloaded witht the bootloader.
make your prototype and look up for rrrrrrb arduino
slder the connections and you will have it ready for abt 10 $ max

asirota (author)GreyGriff2011-04-28

Grey, I spent about 50 dollars on the supplies for this whole project including an Arduino Uno (official version from Arduino) to make this. A green laser could go VERY far, lasers are not affected by wind/sun or anything. My cheap $2 red laser can definitely go about 200-300 fet.

Login258 (author)GreyGriff2009-03-18

You could make one pretty cheap. Well really, it depends. For the first one it might cost $50 total, but after that each would be less than $10. Only because the tools needed to program the microcontroller are a bit pricey. Distance isn't a problem, and it could be about the size of a thick cellphone (receiver) with a completely separate battery powered laser unit. And dinner definitely isn't required for my help.

Beats me. I live in Shanghai. I get them for about 3 dollars at the electronics market down the road. Wind doesn't affect lasers. Sunlight does. At night I lose sight of it after about 3 blocks.

inventorjack (author)Login2582009-02-28

Another thought is that since this is probably going into a case of some sort, drill a hole in the case for the photoresistor, and recess is into the case a bit so that ambient light is less of a factor.

Yes, recessing makes it a lot more flexible as to where you can place it.

TOCO (author)2010-02-20

is there a way to make the buzzer turn off when someone crosses back through the trip wire. That way if it is used for security it wouldn't turn off until the person leaves.

asirota (author)TOCO2011-04-28

Of course there is. The sketch needs to hold a counter in memory that gets switched once and switched again and set the pins appropriately to control the buzzer. Very possible, but the software is different.

jm1820 (author)2010-03-04

Thanks for the very helpful instructable.
Just wondering, if I could seperate the photocell and Arduino board, by about 20 metres (using wire) ?
Its just that I want to have the photocell at the top of my driveway, and the buzzer inside my house.
I have no idea, if a length of wire, would affect the voltage output of the photocell - anyone have a clue ?

dodich (author)jm18202010-08-25

Why not place a reflector 20[m] away and keep all the electronics together. Just a thought.

gaurangb (author)2009-07-21

dear from where i will get circuit for install photosell and buzzer to dedtect beam braking conditions.

james.mcglashan (author)2009-04-04

did u get the arduino at the maker shed or some were else and did u kno u can get an arduino mega it is so good i want 1.

what are the benefits from the arduno mega to the denou...(dont know its name)

it has many more pins and has more other pinsim not an exbert so goto for more info

p.s u need to look in the podcasts to find the 1 a little tricky to find

oh right did not know that thanks

there is evan a vidio lol

amando96 (author)2009-03-07

i placed a thermistor instead of the LDR, now i have a very sensitive temperature diference measurer :D next step, get an LCD, and make thermometer :D

About This Instructable




Bio: Science museum exhibit design and fabrication manager, stagehand, ballet shoe maker, theatre production manager, project manager and art director of the Beijing Aquarium rainforest exhibit ... More »
More by Jonathan Robson:Arduino Nerf Target PracticeArduino Personal Soundtrack HoodieArduino / Wii controlled Lego Star Wars rocket turret
Add instructable to: