Raspberry Pi Laser Tripwire #piday #raspberrypi @Raspberry_Pi
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!
Adafruit publishes a wide range of writing and video content, including interviews and reporting on the maker market and the wider technology world. Our standards page is intended as a guide to best practices that Adafruit uses, as well as an outline of the ethical standards Adafruit aspires to. While Adafruit is not an independent journalistic institution, Adafruit strives to be a fair, informative, and positive voice within the community – check it out here: adafruit.com/editorialstandards
Stop breadboarding and soldering – start making immediately! Adafruit’s Circuit Playground is jam-packed with LEDs, sensors, buttons, alligator clip pads and more. Build projects with Circuit Playground in a few minutes with the drag-and-drop MakeCode programming site, learn computer science using the CS Discoveries class on code.org, jump into CircuitPython to learn Python and hardware together, TinyGO, or even use the Arduino IDE. Circuit Playground Express is the newest and best Circuit Playground board, with support for CircuitPython, MakeCode, and Arduino. It has a powerful processor, 10 NeoPixels, mini speaker, InfraRed receive and transmit, two buttons, a switch, 14 alligator clip pads, and lots of sensors: capacitive touch, IR proximity, temperature, light, motion and sound. A whole wide world of electronics and coding is waiting for you, and it fits in the palm of your hand.
Have an amazing project to share? The Electronics Show and Tell is every Wednesday at 7:30pm ET! To join, head over to YouTube and check out the show’s live chat and our Discord!
Python for Microcontrollers – Adafruit Daily — Python on Microcontrollers Newsletter: The latest on Raspberry Pi RP2350-E9, Bluetooth 6, 4,000 Stars and more! #CircuitPython #Python #micropython @ThePSF @Raspberry_Pi
EYE on NPI – Adafruit Daily — EYE on NPI Maxim’s Himalaya uSLIC Step-Down Power Module #EyeOnNPI @maximintegrated @digikey