A customer created this fun tripwire using Raspberry Pi via One Million Monkeys:
My latest project has involved setting up a laser tripwire that will do something when the laser beam is broken. Ultimately, I plan to wire up a motorized Nerf dart gun to fire a couple of darts when the beam is broken. For now, though, it sounds a buzzer. Here’s how it works:
The basic principle is straightforward. The laser beam, which is powered by two AA batteries, is adjusted so that it shines on a CdS light-dependent resistor (LDR). If the voltage across the LDR falls below some threshold value, determined by experimentation, then some action is initiated, in this case a buzzer is powered on for two seconds.
One small complication is that the Raspberry Pi only has digital IO pins, and reading the voltage on the LDR requires an analog input. The way I have dealt with this is to use an MCP3008 analog-to-digital converter. Adafruit sells these for $3.75, and has a good tutorial on using it with an analog temperature sensor. In this case just remove the temperature sensor, and connect one lead from the LDR to an ADC input pin, and the other LDR lead to the Pi’s 3.3 volt power. I also put a 10K Ohm pull-down resistor on the ADC input pin. I connected my LDR to two of the four wires inside an old telephone cable to give some extra space, and mounted the business end of the LDR inside a hole I drilled in a small block of wood. This helps block out some of the ambient light that might otherwise mask the breaking of the laser beam.
I’m also a big fan of Adafruit’s Pi Cobbler for connecting things on the breadboard to the Pi’s GPIO pins. If you don’t have one of these, do yourself a favor and spend the 8 bucks. For me, it had the added benefit of making me learn how to solder.
Each Friday is PiDay here at Adafruit! Be sure to check out our posts, tutorials and new Raspberry Pi related products. Adafruit has the largest and best selection of Raspberry Pi accessories and all the code & tutorials to get you up and running in no time!
Have an amazing project to share? Join the SHOW-AND-TELL every Wednesday night at 7:30pm ET on Google+ Hangouts.
Join us every Wednesday night at 8pm ET for Ask an Engineer!
Learn resistor values with Mho’s Resistance or get the best electronics calculator for engineers “Circuit Playground” – Adafruit’s Apps!
Maker Business — Amazon’s Domination is Blocked by a Delivery Truck
Wearables — Special servo movement
Electronics — Alternate Triggering
Biohacking — Exist.io – Track Everything Together
No comments yet.
Sorry, the comment form is closed at this time.