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!


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?


Norman Dunbar avatar

I. Love. This!

Meg avatar

Me too!!

Tony Martin avatar

Igor will be ecstatic

AndrewS avatar

Looks like there’s actually two servos, set up in a typical Pan/Tilt configuration?
This project would look even creepier if there was more of an effort to “hide” the camera ;-)

Very clever idea – definitely one to link back to when you do the traditional Halloween-projects roundup Alex :-)

Lukas Stratmann avatar

Correct! The original plan was to let the eye also tilt up and down, which worked fine (more or less) when I tested the concept with magnets on a table. Closing up the ping-pong ball was one of my last steps though, and it turned out that tilting doesn’t work so well if the magnets don’t sit on a surface with some amount of friction…

I agree, the camera should be more concealed. At the end of the class we made this for our projects were part of an exhibit at the university for one week. There were *a lot* of people who touched the lens, probably because they mistook it for a button.

Robert avatar

pinhole camera in the eye pupil. bluetooth or wifi to tell magnets where to go. Those RF chargers for the battery to keep it charged.

Comments are closed