Fancy making a motion-tracking eye in a jar?

Using motion detection and a Raspberry Pi Zero W, Lukas Stratmann has produced this rather creepy moving eye in a jar. And with a little bit of, ahem, dissection, you can too!

Floating Eye in a Jar With Motion Tracking

Made for an Arts seminar I attended for my General Studies, i.e. classes not organized by the faculty for CompSci: “Interaktive Exponate entwickeln mit dem RaspberryPi” (translation: Development of interactive exhibitions with the RaspberryPi). Music: Rise by Meydän: CC-BY I embedded some neodymium magnets in a ping-pong ball that I’d cut open.


We hear you. Among the Raspberry Pi projects we’ve shared on this blog, Lukas’s eye in a jar is definitely one of the eww-est. But the idea and the tech behind it is quite fascinating.

Here’s what we know…

Lukas hasn’t shared the code for his project online. But with a bit of sleuthing, we’re sure the Raspberry Pi community can piece it together.

What we do know is that the project uses a Raspberry Pi Zero W, a camera, some magnets, a servo, and a ping pong ball, with a couple of 3D-printed parts to keep everything in place. Lukas has explained:

I embedded some neodymium magnets in a ping-pong ball that I’d cut open. The magnets and weights (two 20 Euro cent coins) are held in place by a custom 3D-printed mount. Everything is glued in with hot glue, and I sealed the ping-pong ball with silicone sealant and painted it with acrylic paint.

Beneath the jar, a servo motor is connected to a second set of magnets. When the servo moves, these magnets cause the eyeball to move in tandem, by magnet magic.

eye in a jar raspberry pi

Using this tutorial by , Lukas incorporated motion detection into his project, allowing the camera to track passers-by, and the Pi to direct the servo and eyeball.

Build your own eye in a jar

The best skill of makers is their ability to figure out how things work to recreate them. So if you’re up for the challenge, we’d love to see you try to build your own tribute to Lukas’s eye in a jar.

And why stop there? Using magnets and servos with your Raspberry Pi opens up a world of projects, such as Bethanie’s amazing Harry Potter–inspired wizard chess set!

Wizard's Chess gif

How would you use them in your builds?