I'm doing the setup work for using an Arduino to control high speed photography.
I have various types of photo gate sensors, plus a vibration/loud noise sensor using a Piezo element taken out of a cheap piezo buzzer. (You can get piezo vibration sensors from electronics suppliers, but these aren't very sensitive to sounds)
I wanted to be able to shine a laser beam across an arbitrary space into a photo sensor, and rig the Arduino to open my camera's shutter once the beam is broken.
I found these excellent "Optoschmitt triggers" on Mouser.com. ( http://www.mouser.com/ProductDetail/Honeywell/SD5600-001/?qs=%2Fha2pyFaduiEjZTzBoOKjYG9TK%2FZmMmmWGJyf4%252bzfsQ%3D) They take +5 volts and ground, and output a logic 1 (light detected) or a 0 (no light detected. They are most sensitive to IR, but work ok with red laser light.
They are built to snap cleanly from 0 to 1 and back again, and very fast. They are directional, so they are good at rejecting stray light.
The problem is that they are TINY (Maybe 3 mm in diameter) and just about impossible to aim a laser at without a very steady stand and a very precise screw-driven aiming rig, which I don't have.
So, DIY to the rescue. After some tinkering, I found that a piece of wax paper about 10 CM in front of the sensor diffuses the laser beam into a much larger spot. You can then aim the laser into a a circle of around 3 - 5 CM in diameter and the sensor still picks it up.
My first prototype had the wax paper held in a frame in front of the sensor. It was awkward.
The new, still decidedly home-brew looking sensor is build into a small rectangular cardboard box I found lying around. I took a small square scrap of "Luan" (thin fake plywood) and drilled a hole in it's center small enough that the sensor fit into the hole very snugly. Then I soldered some scrap 2 pair telephone wire to the leads, using red and black for power, and green for the signal output. Fool that I am, I cut off the yellow wire. Don't do that. (See below)
I cut a square hole in my box slightly smaller than my square of wood and hot-glued the wood piece over the hole, with the sensor facing into the interior of the box. On the opposite side of the box I cut a larger square hole, and taped some wax paper over the hole, making a little window into the inside of the box. I added aiming marks on the outside of the box just outside the window so you can more easily gauge where to aim the laser beam.
Next I made a mount to attach the sensor box to a tripod or lighting stand. Here in the US, tripod mounts use a 1/4 inch, 20 thread-per inch (TPI) bolt.
I took a scrap of sheet steel and drilled a hole slightly larger than 1/4". I hot-glued a 1/4 inch 20 TPI nut over the hole in the sheet metal so a bolt could come up through the sheet metal and thread into the nut. I then hot-glued the sheet metal into the bottom of the box after drilling a hole into that. I could now attach the bottom of the box to the mounting thread on a tripod.
I then stick the box on a lighting stand and adjust it to the desired hight. I attach a laser pointer or laser emitter to the head of a tripod and set the tripod so the laser pointer's hight is about the same hight as the middle of the wax paper window into the sensor box. Then I aim the laser pointer so it shines a dot in the center of the wax paper window.
Attaching the sensor to the Arduino is very easy. You wire black to ground, red to +5V, and the green wire to an available digital input. You can use an "FALLING" interrupt to trigger code when the beam is broken, write a while loop that uses digitalRead to wait for the pin value to drop low, or use "register-banging" code to check the pin's state directly. The "register-banging" approach is the hardest to implement, and least portable (port and bit assignments vary between Arduino models) but this is the fastest way to detect a change in an input, so I use the register-banging approach, since for my application, microseconds matter.
I wish now I had wired the yellow wire to the anode of a green LED, and attached the cathode to the black wire (through a ~250 ohm current limiting resistor)
Then I could have attached the green LED to the top of my box as an indicator light. When aiming the laser, I would set up the Arduino to read the light sensor, and light the green LED when the sensor detects the laser beam. I may go back and splice in a green LED. It would make aiming much easier.
Here are some pictures of my rig: