Here’s a fun project from a customer who is clearing setting up a secret lair — why else would you need a laser tripwire that will eventually fire Nerf darts?
From 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.
Featured Adafruit Products!
MCP3008 – 8-Channel 10-Bit ADC With SPI Interface: Need to add analog inputs? This chip will add 8 channels of 10-bit analog input to your microcontroller or microcomputer project. It’s super easy to use, and uses SPI so only 4 pins are required. We chose this chip as a great accompaniment to the Raspberry Pi computer, because its fun to have analog inputs but the Pi does not have an ADC. We have a tutorial and code example for wiring this chip to a Raspberry Pi. (read more)
Adafruit Pi Cobbler Breakout Kit for Raspberry Pi: Now that you’ve finally got your hands on a Raspberry Pi® , you’re probably itching to make some fun embedded computer projects with it. What you need is an add on prototyping Pi Cobbler from Adafruit, which can break out all those tasty power, GPIO, I2C and SPI pins from the 26 pin header onto a solderless breadboard. This mini kit will make “cobbling together” prototypes with the Pi super easy. Designed for Raspberry Pi Model B Revision 1.0. This Cobbler is in a compact shape, which is the least bulky way to wire up. We also have the fancier T-Cobbler. (read more)
Laser Diode – 5mW 650nm Red: You have some frickin’ sharks at your lair, and you’re thinking “it would be really great if I could attach some lasers to them” and then you see these little laser diode modules: what great timing! These encapsulated laser diodes are Class IIIa 5mW, with a 650nm red wavelength. They can be driven from 2.8V to 5.2V so they’re great for your embedded electronics project. You can use these for laser harps, electronic ‘trip wires’, laser-vision guidance, and more! Simply connect power to the red and black wires and you will be lasing in no time. (read more)
Each Friday is PiDay here at Adafruit, be sure to check out our posts, tutorials and new Raspberry Pi related products. Have you tried the new “Adafruit Raspberry Pi Educational Linux Distro” ? It’s our tweaked distribution for teaching electronics using the Raspberry Pi. But wait, there’s more! Try our new Raspberry Pi WebIDE! The easiest way to learn programming on a Raspberry Pi.
Want a FREE RASPBERRY PI? All orders over $350 get a FREE Raspberry Pi Model B with 512MB RAM!Related
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!
No comments yet.
Sorry, the comment form is closed at this time.