Pumpkin Pi Follows Your Movement — Thanks to PIR Sensors and a Hidden Raspberry Pi
Maker Caleb Lemoine is getting a head start on Halloween with a Raspberry Pi-powered jack-o'-lantern build designed to track visitors' motions for a spooky surprise: the Pumpkin Pi.
"[This is a] Raspberry Pi project that controls [a] jack-o-lantern via servo motor and PIR motion sensors," Lemoine explains of the Pumpkin Pi, inspired by an earlier project to animate a mannequin head, "to simulate it 'watching' you."
The heart of the project is a Raspberry Pi 3 Model B+, to which a pair of passive infrared (PIR) motion sensors have been added. LEDs in the lantern provide a glow, while a Pimoroni Pan-Tilt HAT add-on controls the movement — after a little upgrade to a beefier servo motor — tracking the head left and right depending on input from the motion sensors.
"The sensors are much more reliable [than a camera] and doesn't require the beefiest Pi 4 to do image processing," Lemoine writes of his decision to use PIR sensors. "Using a camera resulted in processing 6 FPS [Frames Per Second] due to Pi hardware limitations and it didn't work very well. There's also lighting conditions to consider given this prop needs to work well in low/no light."
The code for the project is written in Go, and there are a range of configuration options — including the times during which the device should be active, delays in movement, maximum movement limits to the left and the right, and how long the lantern should wait after motion is detected before returning to its center point and waiting for the next victim.
The source code and schematic for the project are available on GitHub under the permissive MIT license.