DSC02876.JPG
The Arduino is great, you can make it do pretty much anything you want.

I wanted a tripwire. This is just the circuit and the code, you can use it for quite a few things, like a trigger for a camera, or you could make it shut down your computer if someone crosses it.

When I have the time, I want to hook it up to an electric airsoft gun with a relay and have it shoot you when you break the beam. I suppose I'll add to the Instructable when that happens.

So let's start!
 
Remove these adsRemove these ads by Signing Up

Step 1: Components Needed

DSC02876.JPG
This is what you need for this project:

-Arduino
-10k Resistor
-Photo resistor (Practically any value will work, the program will just need to be changed slightly)
-Laser Pointer
-Jumper Cables
-Alligator clips
1-40 of 73Next »
FlipFlop says: Apr 6, 2013. 12:45 PM
I think this is not good enough for security proposes unless the laser is modulated and the receiver knows the modulation frequency.
thereturnofthewill says: Oct 26, 2012. 10:44 PM
thanks worked great!

cclick1 says: Aug 7, 2012. 9:57 PM
I looking to do something like this for a project with 6 different lasers to trigger 6 different sounds from a wave or MP3 shield. Is it just the software I need to tweak or totally redo the hardware?
lhakim2 says: Jul 15, 2012. 7:01 PM
helo. i would like to request the circuit schematics. email me at luqmansemidin@gmail.com . thanks in advance :)
R. Butch says: Jun 20, 2012. 7:51 PM
Would this work with a variable light resistor instead of the photo resistor. (They might even be he same thing, I'm new to this type of thing).
hill says: May 1, 2010. 8:15 PM
 hey there thanx for this awesome tut but when i try to run the sketch in arduino its says "error: redefinition of 'void setup()'

and wont run

please help ?

thanx
Archive555 in reply to hillMay 27, 2010. 6:06 PM

If you just copy and paste the code has there, it won't work.

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

void loop(){
digitalWrite(4, HIGH);
if(analogRead(0) < 750){
digitalWrite(13, HIGH);
} else{
digitalWrite(13, LOW);
}
}

void setup() {
pinMode(4, OUTPUT);
Serial.begin(9600);
}

void loop(){
digitalWrite(4, HIGH);
Serial.println(analogRead(0));
}

Those two seperate sections of code need to be combined, as thse are both programs in their own right. From memory it should be something similar to this:

void setup() {
pinMode(4, OUTPUT);
pinMode(13, OUTPUT);
Serial.begin(9600);
}

void loop(){
digitalWrite(4, HIGH);
if(analogRead(0) < 750){
digitalWrite(13, HIGH);
} else{
digitalWrite(13, LOW);
Serial.println(analogRead(0));
}
}

Please not though that each of those segments of code were designed for a seperate task; one to simply trigger an LED when the beam is broken, the other to send data from the LDR to the computer so that Processing may be used. The combined code does both of these tasks, although you pobably don't need the serial transfer section if you had an error like that that you couldn't fix. Most of the people who will want to try this will be content with the first segment of code; that is, just turn on an LED or similar device when the beam is broken. The second piece of code is for more advanced users who wish to create a monitoring program in Processing (probably not you).

Hope this helped.
       -Archive

frankhiggins in reply to Archive555Jan 5, 2011. 8:33 AM
Hi, this sounds great and perhaps just what I'm looking for. I'm doing a project at university using Arduino and Processing and want to use a camera triggered by motion to produce an effect like the one shown below (by Magritte).
What I want to achieve is to have a computer screen using the mirror function in Processing and camera that is triggered by a person entering the space. Ideally the camera should track the person so that they can never see their own face in the mirror but that might be a bit ambitious for my skils / knowledge level at present.

Thanks in anticipation,

Frank
magritte.jpg
idee17 in reply to frankhigginsMay 23, 2012. 7:57 PM
hey you should check out the website http://projectsentrygun.rudolphlabs.com/
from the motion and tracking thing. I bet you could modify his code for what your wanting to do.
gallactronics says: Apr 16, 2012. 1:09 AM
Hi! This is a wicked LASER project. Actually you can make something very useful this circuit. You can make a LASER counter and use it for counting people or objects on a conveyor! And you don't even require an Arduino for it. There is a step by step guide on how to make a LASER trip wire counter in this site:

http://gallactronics.blogspot.in/2011/11/laser-people-counter.html

Thanks
cpoplawski says: Jan 22, 2012. 7:07 PM
Can someone add in the ability for it to tweet when the alarm gets tripped? That would make it sick!
VrIgHtEr says: Feb 2, 2010. 5:21 AM
it can be modified to be kind of self calibrating. Just a software thing xD. Turn on the laser, read the value, turn off the laser and read the value again, choose a threshold somewhere in between the two values, turn the laser back on and start the main loop
NoseyNick in reply to VrIgHtErApr 17, 2011. 7:36 AM
Another common technique is to do this continuously - deliberately strobe the laser (possibly so fast that PoV makes it look continuous) and alarm when you can no longer "see" your strobing. Then day/night variations, lights on/off, and even people waving torches around won't affect it.
anonymouse197 in reply to NoseyNickAug 13, 2011. 9:57 AM
I love the idea, I'm breaking out the old laser pointer now! :)
iEdd in reply to NoseyNickApr 17, 2011. 2:19 PM
More importantly, people waving a laser around won't affect it. You can't simply hold a laser pointer on the LDR as you walk through the beam.

You're onto a very smart idea to make it frequency dependent. Then there would be a good reason to use the Arduino. (The project as it is can be done with a transistor, trimpot, couple of resistors, LDR and LED)
VrIgHtEr in reply to NoseyNickApr 17, 2011. 8:10 AM
Interesting idea. 10x :D
notgeek says: Jul 28, 2011. 10:35 AM
What kind of Arduino should I get for this?
notgeek says: Jul 28, 2011. 10:32 AM
Where is the video?
NCGeek says: Jul 2, 2011. 3:12 PM
I think this is a great idea, and I have just the right application for it. Problem is, I am having trouble finding a photo resistor like the one in your video. I have some photo resistors I got from Adafruit, but they are tiny, and I am afraid I will have difficulty with allignment. Could you recommend where I could get a larger one, like you have?
JOBGG says: Apr 19, 2011. 2:19 AM
I personally think that an Arduino is overkill, one proably could do that with an LDR. Even the idea with a oscilator should be possible to implement without an arduino.
I do think that's a great instructable though.
American Eagle in reply to JOBGGJun 27, 2011. 12:58 PM
I disagree... The Arduino allows you to do hundreds of different things JUST with this concept.
Electrified Geek says: Apr 18, 2011. 11:44 PM
Hey, where could I get the Arduino thing? Could i find one on eBay?
MCUman says: Apr 17, 2011. 10:47 AM
I built a football trainer years ago that used IR emitters modulated at something like 35KHZ aimed at tuned receivers from Sharp at the same freq. There were 8, multiplexed in an array. Both emitters and receivers were placed in 2" tubes and placed 6' apart from each other, forming a 6' X 6' opening. The brain was a Motorola HC705J1A MCU that fed a main MCU HC705C8 over one I/O line. It worked very well in bright sun light. The fun part was the power usage was very low as only one IR led was ever ON at any given moment. I ran some tests and was able to get a distance of 20' separation outdoors using nothng more than run-of-the-mill IR LEDs. The trick was using those tubes.
betwys1 says: Apr 17, 2011. 8:27 AM
If possible add a weak lens as a beam expander, so the laser spot just covers the active area of the photo resistor. That will give much greater sesistivity, and will propbably ease even remove the need for calibration altogether.

Brian Whatcott
kellergrrl says: Apr 12, 2011. 5:59 PM
would an arduino NANO 3.0 work?
transuranic says: Mar 12, 2011. 2:33 PM
it looks like your using the uno.I guess ill use the uno to.
Chowmix12 in reply to transuranicMar 18, 2011. 1:03 PM
This was published in 2008.. the UNO was released 2 years after.. .It doesn't matter which board you use.
transuranic says: Mar 12, 2011. 2:30 PM
Does it matter wich arduino you use?
lemon rind says: Jan 10, 2011. 2:13 AM
He He... If someone could rig this so it shot the person with something (nerf gun? Paintball?) when set off, they would be a legend...
Ora says: Dec 15, 2008. 8:11 PM
Great idea! As an improvement, could you add a second photoresistor that just takes a reading of the ambient light in the room, and use that reading instead of having to calibrate the arduino?
DIY-Guy in reply to OraDec 23, 2010. 1:40 AM
Simple solution may not require additional electronics-
Place the sensor at the back end of a black tube to block ambient light.
wiren in reply to OraMar 5, 2009. 4:43 PM
Even better is to add a startup test code to setup(), that will measure when laser is on and off to different variables, then the variables can be used everywhere.. :) Hw costs money, software cost our time :)
Mechroneal in reply to wirenJun 25, 2009. 1:34 PM
The catch to that is if the system is on for several hours, daylight changing could cause it to set off. Could you set it up so the system: 1-Checks the sensor with no laser 2-Turns the laser on 3- Checks for a fault (tripped laser) 4- Cycles off the laser and repeats? I would think something like this repeating several times a second would be accurate enough to detect faults, it would increase the battery life of the laser, and would not be set off by changes in lighting caused by the sun moving. Does this make sense?
Login258 (author) in reply to OraDec 16, 2008. 12:12 PM
Oh geez that's genius! I didn't even think of that. Earlier I used a relay to shoot an electric airsoft gun with the Arduino, perhaps I"ll make a tripwire somewhere that shoots you when you cross it?
amando96 in reply to Login258Mar 4, 2009. 1:31 PM
how could you do that? like:

if(analogRead(0) = analogRead(1)) {
digitalWrite(13, LOW);

it doesnt work though! :S but the principle is close right? lol
Login258 (author) in reply to amando96Mar 7, 2009. 8:14 AM
Well first of all, if you're comparing two values you would use '==' not just '='.

And I would turn on the light if they are within a certain percentage of each other, so it would be:

if(analogRead(0) - (.25 * analogRead(1)) < 0) {
digitalWrite(13, LOW);
}

Or at least something like that
Ora in reply to Login258Apr 26, 2010. 8:17 PM
I just completed a modified version of this. I modified the original code to check the value of the photoresitor with the laser on and then off, it averages the values, and then checks if the value of the photoresistor with the laser on is less than that value. If the beam is broken, the arduino triggers the button on a wireless doorbell using an optoisolator, which in turn chimes the door bell.
geeklord in reply to Login258Jan 27, 2009. 5:32 PM
You think that that would work with a 2N3904? I've been wanting to do that for a while now but have worried about takin apart my airsoft gun, because I have taken apart the electric ones before and have had problems putting them back together with all the uncooporitive springs...
Login258 (author) in reply to geeklordJan 14, 2009. 7:36 AM
Yeah I don't see why it wouldn't. I'm sticking with a relay though (mainly because I don't have a 2N3904) Maybe you could just pull the trigger with a servo then
geeklord in reply to Login258Jan 14, 2009. 10:59 AM
yeah, I'm having trouble with learning how to interface an arduino with RC servo motors.
1-40 of 73Next »
Pro

Get More Out of Instructables

Already have an Account?

close

PDF Downloads
As a Pro member, you will gain access to download any Instructable in the PDF format. You also have the ability to customize your PDF download.

Upgrade to Pro today!