# DIY Laser trip wire trigger



## dmcke5 (Aug 17, 2015)

Okay so lets start by looking at the 3 main items this project uses. This is an Arduino Nano (some of the clones may look slightly different, but the pins should be labelled the same and in much the same place).







This is the brain of our project, it controls the laser and reads the sensor and makes the decisions based on those inputs/outputs. This tiny device has huge amounts of potential and can be used for just about anything that requires automation of some sort. Last year I used them in my smoke machine controllers to automate them and in all of my moving props (and even some DIY Strobe lights). It has 13 "digital" pins (which can be used as both an input or an output) and is a simple on/off signal. There's a lot more to them than that too, but we will only be using the digital pins in our project.








This is our laser module, its an extremely simple device. The three pins in order from Left to Right are: Negative(-), Positive(+, 5V) and Signal. The first two pins are used to supply 5v to the module and the last pin is used to turn the laser on and off.








And finally this is the laser sensor module. Again quite a simple device with just three pins in order from left to right: Positive (+, 5V, VCC), Negative (GND, -) and finally the signal pin again. Like the laser module the first two pins are used to supply the sensor with power whilst the third pin toggles between on and off when the laser (or any other light source) hits the sensor.

I'll do up a simple wiring diagram tonight and include it in the next post.

- Daniel


----------



## dmcke5 (Aug 17, 2015)

Please excuse the awful photoshop job, but this seemed like the easiest way to show you where to hook up your sensors. The block of 6 pins on the end (also known as the ICSP port) isn't really meant to be used like this but as it has an extra ground and 5v connection we can use it to simplify our wiring.









I'd like to point out also that our sensor and laser signal wires can be connected to any one of the Digital pins (Labelled 1-13) however a line or two will need to be changed in the program to allow for the different pins in use.

Also worth noting that you don't actually need to use a laser module or even have it connected to the arduino at all. You could get away with just using a regular laser pointer if you'd prefer, the arduino module just provides a simple way to power the laser and not need to worry about any additional batteries on the night. It also gives us the benefit of being able to switch the laser on and off from the program or whatever you'd like really.

Next step will be the programming!
- Daniel


----------



## Dartman (Jul 15, 2016)

this is really cool will the program be posted


----------



## dmcke5 (Aug 17, 2015)

Dartman said:


> this is really cool will the program be posted


Hi mate, I'd pretty much forgotten about this! Yeah If you want to use it, I'll happily post some code for you. My arduino knowledge has increased dramatically since last year and I'm actually in the process of building a complete Maze control system based on arduino that I will eventually release when its finished. Feel free to PM me about what you want to control and I'll do the code for you.


----------



## mprewitt (Sep 26, 2017)

I love the tutorial, by chance could you provide the programming part of this write up?

Thanks,


----------



## dmcke5 (Aug 17, 2015)

mprewitt said:


> I love the tutorial, by chance could you provide the programming part of this write up?
> 
> Thanks,


Sure mate, I've been helping a few people through PM but I'll try and get something up on here today for everyone to see.

- Daniel


----------



## dmcke5 (Aug 17, 2015)

Alright guys, sorry its taken this long. Work has been busy and with my own absurdly complicated Halloween maze slowly coming together I haven't had a heap of time for this tutorial but I'll do my best to finish it off ASAP.

Now I've realised that most of you are probably just going to want to trigger stand alone hardware (CD players, existing props etc) so I think the best way to go about that would be with a relay board. Here's a link to a relay board that will work for this project, I've been buying most of my arduino stuff from these guys lately and have had good luck with all of it. 
https://www.banggood.com/5Pcs-5V-Relay-5-12V-TTL-Signal-1-Channel-Module-High-Level-Expansion-Board-For-Arduino-p-1178210.html?rmmds=search

You'll need to wire that relay up to the arduino in a similar way to the other sensor, just double up the 5v and GND connections with one of the other sensors since we are going to run out of pins otherwise. Hook the signal wire in to pin 4 on the board. You can now wire that relay in line with your prop to use as a simple switch or you can put it inline with input power for your prop if the prop doesn't have a trigger button.

I'll put some code in the next post later tonight, once I've had a chance to set up my test arduino and make sure its all working properly. I'm including a post-trigger delay, a reset delay and a trigger length setting which can all be changed fairly easily. Let me know if you think of any specific requirements you have and I'll try and write it in. Keep in mind, I'm trying to keep this fairly generic so if you need anything more specific it might be best to PM me.

- Daniel


----------



## mprewitt (Sep 26, 2017)

Thanks a lot!


----------



## dmcke5 (Aug 17, 2015)

Okay, code tested and ready to go! Here's the download link: https://www.dropbox.com/s/9wqy5zzsbm1n1mj/Prop_Controller.ino?dl=0
You'll need to open that file in the arduino IDE, connect your arduino to the computer and select the correct serial port for it. Then, press the little arrow button towards the top left of the screen (upload) and the program will then compile and upload. And that's it! If your wiring is done, it should all work just fine.
Make sure you read the notes in the file so you understand how the program works and so you can configure the length of the delays.
Let me know if you have trouble and I'll try and help!

- Daniel


----------



## Dartman (Jul 15, 2016)

That's Great Thanks


----------



## Dartman (Jul 15, 2016)

hey Daniel 
I set up the trigger today and used the code you made with a couple of value changes and
it works great

Thanks again


----------



## dmcke5 (Aug 17, 2015)

Quick update guys! 
Added the option to send status updates to the Serial Port for debugging. If debugging is enabled the Arduino's onboard LED will also come on when the Relay is activated. If you don't wish to use these functions, set the value for enableDebug to equal false instead as its enabled by default.
The file in the link has been updated and I've also added the link to the first post in this thread to make it easier to find.


----------



## lizzyborden (Sep 17, 2009)

Would the code also work with an UNO?


----------



## dmcke5 (Aug 17, 2015)

Yep, 100% compatible between the two boards. Just use the same pins as specified on the Nano and you'll be right.

- Daniel


----------



## cody1073 (Jan 17, 2018)

OK. First this is great, thanks for putting all this information here for us!

I don't know much about all the technical aspects of this project (like 0), but I have managed to build the laser trigger. I have purchased the relay that you talked about and am having issues figuring out how to connect it like you posted. Is there a way you could post another diagram of that? Anyone? Thanks!

(I have also built a four banger controller following precise directions, down the road i will probably need more help to actually connect devices/props to the relays but in haven't got that far yet)


----------



## dmcke5 (Aug 17, 2015)

cody1073 said:


> OK. First this is great, thanks for putting all this information here for us!
> 
> I don't know much about all the technical aspects of this project (like 0), but I have managed to build the laser trigger. I have purchased the relay that you talked about and am having issues figuring out how to connect it like you posted. Is there a way you could post another diagram of that? Anyone? Thanks!
> 
> (I have also built a four banger controller following precise directions, down the road i will probably need more help to actually connect devices/props to the relays but in haven't got that far yet)


Hi mate, can definitely post a picture if you need once I have time to draw it up. What part of the wiring for the relay are you struggling with? There should only be 3 wires connected to the arduino, +5v, gnd and a signal wire. You then hook the two wires from whatever you're trying to trigger into the screw terminals on the relay board (one to GND and the other wire to either NC or NO depending on if you want the relay to be normally open or closed). For most professional Halloween props I've seen with a trigger button you'll want to use the NO terminal.


----------



## cody1073 (Jan 17, 2018)

dmcke5 said:


> Hi mate, can definitely post a picture if you need once I have time to draw it up. What part of the wiring for the relay are you struggling with? There should only be 3 wires connected to the arduino, +5v, gnd and a signal wire. You then hook the two wires from whatever you're trying to trigger into the screw terminals on the relay board (one to GND and the other wire to either NC or NO depending on if you want the relay to be normally open or closed). For most professional Halloween props I've seen with a trigger button you'll want to use the NO terminal.


Hello! Thanks for the response!
OK so solder pin 4 on the board (signal wire). I found another spot labeled gnd not being used second spot over with spot labeled vin to the right of it, I will solder a pin there (gnd). Finally splice into the 5v line going to the laser sensor (5v). ???
Like below?


----------



## dmcke5 (Aug 17, 2015)

cody1073 said:


> dmcke5 said:
> 
> 
> > Hi mate, can definitely post a picture if you need once I have time to draw it up. What part of the wiring for the relay are you struggling with? There should only be 3 wires connected to the arduino, +5v, gnd and a signal wire. You then hook the two wires from whatever you're trying to trigger into the screw terminals on the relay board (one to GND and the other wire to either NC or NO depending on if you want the relay to be normally open or closed). For most professional Halloween props I've seen with a trigger button you'll want to use the NO terminal.
> ...


Looks good to me!


----------



## cody1073 (Jan 17, 2018)

I was thinking that using a 5 volt battery would be the best option to power this device. Which 2 pins would I connect the battery connectors to?


----------



## dmcke5 (Aug 17, 2015)

cody1073 said:


> I was thinking that using a 5 volt battery would be the best option to power this device. Which 2 pins would I connect the battery connectors to?
> 
> [iurl="http://www.halloweenforum.com/attachment.php?attachmentid=537578&stc=1&d=1519155837"]
> 
> ...


Vin and Gnd for the power wires, but if you have a regulated 5v output you should connect the positive of your supply to the 5v pin instead. 
If you just want to run off a battery use the Vin pin but a higher voltage battery (9v would be a good size) so the internal voltage regulator has enough voltage to operate properly.


----------



## cody1073 (Jan 17, 2018)

dmcke5 said:


> Vin and Gnd for the power wires, but if you have a regulated 5v output you should connect the positive of your supply to the 5v pin instead.
> If you just want to run off a battery use the Vin pin but a higher voltage battery (9v would be a good size) so the internal voltage regulator has enough voltage to operate properly.


As for battery: Pin 29 is already used, so is it fine to use pin 4 (gnd). And then pin 30 is Vin. Thanks!?


----------



## dmcke5 (Aug 17, 2015)

Yep, any GND is fine. You do tend to run out of GND and 5V pins on these things when doing little projects like this. For some of the more complex ones I've done I have had to use prototype board to give myself room for all the extra wires required.


----------



## Dartman (Jul 15, 2016)

hey guys will this board handle a 12 v power supply and would I use the same pins 29 30, like my 9 v battery, because my whole front yard haunt runs on 12 v


----------



## dmcke5 (Aug 17, 2015)

Dartman said:


> hey guys will this board handle a 12 v power supply and would I use the same pins 29 30, like my 9 v battery, because my whole front yard haunt runs on 12 v


Yep, these boards are suuposed to be able to handle up to 20v on the Vin pin (although its not recomended) but 12v will be fine. I had everything in my maze last year running of a single 12v Server power supply (which is good for about 50 amps) and didn't have any issues (had about 10 of these nano boards throughout the whole thing). Just make sure your sensors are being supplied by the 5v pin as they won't like the full 12v.


----------



## pick5716 (Sep 24, 2018)

Any chance you could put together a YOUTUBE video showing the construction and it activating a prop. That would be amazing and your information is great. Thanks


----------



## dmcke5 (Aug 17, 2015)

Before Halloween? No chance, already running out of time for this year and we are still a month out!
I also hate the sound of my own voice on camera so I'm not sure how I could get around that...

Since I completed this tutorial, I've made a lot of other bits and pieces for halloween all based around arduino and I'm going to try and produce some more tutorials in the coming year. Maybe even some circuit board kits to make building these things a bit easier?
Either way, if you have any specific questions feel free to ask here and I will answer as best I can!



pick5716 said:


> Any chance you could put together a YOUTUBE video showing the construction and it activating a prop. That would be amazing and your information is great. Thanks


----------



## pick5716 (Sep 24, 2018)

I appreciate all of your info and will give it a try and let you know if any issues come up. I have always been a more visual learner. Keep up passing out the great information we really do appreciate it.


----------



## dmcke5 (Aug 17, 2015)

No worries. I will try and at least take some photos for my future tutorials! My biggest problem is most of these things normally get built at the last minute and sometimes they are connected to cables that are many meters in length (which makes it very difficult to photograph). What I need to do is come back later and build one neatly with short wires, specifically for the tutorial. When I first wrote this tutorial I couldn't afford to go out and buy extra bits just for the sake of a tutorial so I opted to do it this way instead. These days I buy most of these things in quantities of 10 or more so I'm sure I'll have some spare after halloween this year for the next tutorials I'm planning.


----------



## pick5716 (Sep 24, 2018)

Thanks and pics do help......Good luck with all your builds this year.


----------



## pick5716 (Sep 24, 2018)

*will this work???*









Do you think this set up will work???


----------



## dmcke5 (Aug 17, 2015)

pick5716 said:


> View attachment 568765
> 
> 
> Do you think this set up will work???


Yep, looks good to me!


----------



## Martymart (1 mo ago)

I'm having trouble getting this working - i'm using a photo resistor instead of the laser sensor module, is this the problem? i thought it would work regardless. i'm also using a laser pointer, not the laser module.


----------

