Build a giant Spooky Eyeball
If you want to be known for having the Halloween house in your neighborhood — the one that kids beg their parents to drive them to from miles around in hopes of snagging some full-size candy bars—then you might just have to step up your decorating skills.
Kids today are not easily impressed. A row of jack-o’-lanterns, a fake spider web, and a jointed, paper skeleton hanging on the front door just is not going to cut it anymore. To capture the attention of a tablet wielding, smartphone swiping tot, you need to incorporate some interaction into your displays.
YouTuber Makers Mashup has created a spooky, giant inflatable eyeball that moves to keep watch over little trick-or-treaters paying a visit on Halloween night — and it just might convince them to take their tricks elsewhere. The eye locates nearby ghouls with a directional motion sensor, and then adjusts its position to look in their direction.
Makers Mashup first tested out PIR and ultrasonic sensors for motion detection, but found the range too limited to operate reliably from a distance outdoors. A camera-based solution might typically be thought of as overkill for motion detection, but an ESP32-CAM can be had for under ten dollars, and since it is only limited by visual range, it is perfect for detecting passersby.
A simple algorithm was created that squishes image data down, along the horizontal axis, into a one-dimensional array. The components of the array represent ten degree wide visual regions, and the value is a measure of light intensity. By examining how these values change between frames, it is possible to detect motion in specific regions.
Once motion has been localized, the next step is to use the ESP32 microcontroller onboard the ESP32-CAM to drive a servo motor that spins the giant eye into the correct position. By doing so, the eye appears to be looking right where the motion (i.e. an approaching person) is currently located. The effect of the watching eye is sufficiently creepy to amuse child and adult alike, but is unlikely to send too many children running away screaming for Mommy.
But wait a minute, trick-or-treating is at night, and last I checked, night time is dark! How could a camera work at night? Turning on a floodlight would ruin the ghastly ambiance of All Hallows' Eve. Rest assured, Makers Mashup has a solution for this as well — by using an infrared floodlight, the entire area can be illuminated for the benefit of the camera, without shining any light visible to humans (or zombies or vampires, either).
The entire project is open source, so check out the description in the video for all the tricks (and treats?) you need to make your own.