Any sufficiently advanced hack is indistinguishable from magic, a wise man once observed. That’s true with this cool build from [Jasmeet Singh] that magically opens a box when you wave a Harry Potter magic wand in the right way. Is it magic? No, it’s a neat hack that uses computer vision to track the wand and recognize when you make the magic gesture.

The trick is based on the same technique that Universal Studios use in their Harry Potter theme park, as detailed in a patent with the snappy title of “System and method for tracking a passive wand and actuating an effect based on a detected wand path“. The basic idea is that a retroreflective dot on the end of the wand reflects light from a set of infra-red LEDs around the camera. An infra-red sensitive camera detects this reflected light as a bright dot. This camera is tied into a computer vision system that tracks the path of the dot, then triggers the action if it follows a certain pattern.

The version that [Jasmeet] built uses a Raspberry Pi NoIR camera, and a Raspberry Pi 3 running OpenCV. This feeds into a machine learning graph that detects the letters of the alphabet. If the detected letter is an A (for Alomahora, the Harry Potter open spell), then the box opens. If it is a C, the box closes. This is all tied together using Python.

It’s a neat build that ties together a number of interesting techniques, and which could keep the kids amused for a while. You could also expand it further, such as adding a death ray that triggers if you trace an S for Sectumsempra. That’ll teach them not to mess with the dark arts.


Scroll to Top