Sean Hodgins’ Haunted Jack in the Box
After making a delightful Bitcoin lottery using a Raspberry Pi, Sean Hodgins brings us more Pi-powered goodness in time for every maker’s favourite holiday: Easter! Just kidding, it’s Halloween. Check out his hair-raising new build, the Haunted Jack in the Box.
Haunted jack-in-the-box?
Imagine yourself wandering around a dimly lit house. Your eyes idly scan a shelf. Suddenly, out of nowhere, a twangy melody! What was that? You take a closer look…there seems to be a box in jolly colours…with a handle that’s spinning by itself?!

What’s…going on?
You freeze, unable to peel your eyes away, and BAM!, out pops a maniacally grinning clown. You promptly pee yourself. Happy Halloween, courtesy of Sean Hodgins.

Eerie disembodied voice: You’re welco-o-o-ome!
How has Sean built this?
Sean purchased a jack-in-the-box toy and replaced its bottom side with one that would hold the necessary electronic components. He 3D-printed this part, but says you could also just build it by hand.
The bottom of the box houses a Raspberry Pi 3 Model B and a servomotor which can turn the windup handle. There’s also a magnetic reed switch which helps the Pi decide when to trigger the Jack. Sean hooked up the components to the Pi’s GPIO pins, and used an elastic band as a drive belt to connect the pulleys on the motor and the handle.
Sean explains that he has used a lot of double-sided tape and superglue in this build. The bottom and top are held together with two screws, because, as he describes it, “the Jack coming out is a little violent.”
In addition to his video walk-through, he provides build instructions on Instructables, Hackaday, Hackster, and Imgur — pick your poison. And be sure to subscribe to Sean’s YouTube channel to see what he comes up with next.
Wait, how does the haunted part work?
But if I explain it, it won’t be scary anymore! OK, fiiiine.
With the help of a a Camera Module and OpenCV, Sean implemented facial recognition: Jack knows when someone is looking at his box, and responds by winding up and popping out.

Testing the haunting script
Sean’s Python script is available here, but as he points out, there are many ways in which you could adapt this code, and the build itself, to be even more frightening.
So very haunted
What would you do with this build? Add creepy laughter? Soundbites from It? Lighting effects? Maybe even infrared light and a NoIR Camera Module, so that you can scare people in total darkness? There are so many possibilities for this project — tell us your idea in the comments.
5 comments
Helen Lynn
I love the idea of making one with a Pi NoIR camera, so this thing you don’t even know you’re looking at knows that you’re looking at it.
Alex Bate
Way to give me nightmares tonight, Helen. Wow.
Peter Mx
Hours of coding and a lifetime of trust issues for the unlucky target! haha
Joe
Make it so it shakes a little when someone looks at it, then as soon as the look away, start cranking, when they look back, stop. timer for 5 seconds or so, and then keep winding and surprise!
Joe
Never mind, just watched the you tube video, seems like you are already doing that. Thumbs Up Sean!