A Raspberry Pi Pico-based laser tripwire system that detects changes in ambient light using an LDR sensor and triggers a visual alert with LEDs. Designed for creative projects, desk setups, or simple security triggers.
- π· Light detection via photoresistor (LDR)
- π Button-activated desk light (on/off)
- β‘ LED fade-in/out alert sequence
- π§ Smart alert triggering using lux percentage threshold
- π₯οΈ Debug info printed in the console
- Raspberry Pi Pico
- LDR (photoresistor GL5516)
- WS2812 LED strip (64 LEDs)
- Push button
- Jumper wires
- Resistors (as needed)
- Light source (preferably a laser diode 5v / 5mW)
Included are 2 3mf files that can be printed on a 3D Printer. The files are a 6mm tube for the laser emitter, and another tube for the LDR. The tubes help to regulate the ambient light to eliminate false positives.
Component | GPIO Pin |
---|---|
Photoresistor | 26 |
LED strip (WS2812) | 22 |
Button | 14 |
The system reads light intensity from the photoresistor and converts it into a percentage. If light levels drop below trigger_value
(default 50.00
%), an alert is triggered through LED color fading.
- Desk light color: Soft white (
255, 160, 135
) - Alert start: Bright red fade to original state (on or off)
- π‘ LDR monitors ambient light continuously.
- π²οΈ The button toggles the desk light, but does not interfere with alert logic.
- π If the light drops below the threshold, the system initiates an alert.
- π LEDs change to red then fade from red to white (Lights are On).
- π LEDs change to red then fade from red to black (Lights are Off).
- Connect all components to the Raspberry Pi Pico.
- Flash the
laser_trip.py
script onto the board. - Open serial monitor for debugging output.
- Watch LEDs respond to light changes and button input!
Created by SilentWoof
Inspired by practical light-sensitive triggers and LED control using PIO on the Pico.
Enjoy tinkering with this light-activated tripwire project! π οΈβ¨