View Single Post
Old 03-28-2025, 05:05 PM   #662
RoadGame
Powerplay Quarterback
 
RoadGame's Avatar
 
Join Date: Aug 2005
Location: N/A
Exp:
Default

I have completed a new project... my kids have these Harry Potter wands with reflective tips and nothing really to do with them, so I built them this "magic" lamp.

Video: https://imgur.com/a/BvYUgms

NSFW!


The black part of the box emits IR light that reflects off the wand tip, and the camera attached to a raspberry pi (both hidden within the black box) detects the wand tip reflections and creates a digital trace. The trace is run through a classifier algorithm that decides whether it's looking at an L-shape, a figure eight or a triangle (in increasing order of difficulty to achieve as the wand user). Any outcome triggers a 2-minute long sequence of lights using a 60-LED neopixel. To add a bit of theming to it, the figure-8 is meant to trigger a Gryffindor themed, red-dominated light show. The triangle is a Slytherin-themed, green-dominated show. The L-shape triggers a rainbow-themed show (it's meant to be more generic rather than one of the houses).

To keep up some replay value, there are multiple different light shows coded along each of those three themes. Upon a given activation, a random number generator is used to pick the specific one. That way when you "cast a spell" with the wand you'll get a light show on the theme you selected (for the most part - classifier is about ~80% accurate), but the specific show within that theme will vary.

I have never worked with raspberry pi or python coding before. It took an immense amount of time to set everything up and troubleshoot it. Having said all of that, I'm happy to share the code and other files necessary to make it work, on the understanding I can't provide tech support. Having reverse-engineered other published code for some parts of it, one thing I have learned from the process is that as wonderful as open source stuff can be, it's constantly evolving so files that work now may get broken as underlying OS and package updates get published. If you've worked with python and/or RPi before I suspect you'd have a far easier time than I did getting this to work for your kids.

Last edited by RoadGame; 03-28-2025 at 07:53 PM.
RoadGame is offline   Reply With Quote
The Following 10 Users Say Thank You to RoadGame For This Useful Post: