A Passive Infrared Sensor Adds an Extra Dimension to Halloween Props

By Jeremy S. Cook

Freelance Tech Journalist / Technical Writer, Engineering Consultant

Jeremy Cook Consulting

October 20, 2016

Blog

Recently I constructed an "infinity mirror," a mirror configuration with lights inside that appears to stretch to infinity. 

Recently I constructed an “infinity mirror,” a mirror configuration with lights inside that appears to stretch to infinity. As neat as that was visually, with Halloween coming up, I thought it could make an excellent display if it was somehow triggered to come on when a person walked up to it. Although I’d never used one before, a passive infrared (PIR) sensor seemed like the ideal solution.

These sensors work by detecting the change in infrared light around them, caused by how much energy an object is giving off in the form of heat. Since humans, and everything to some extent, is either absorbing or emitting energy from the environment, this is a great way to detect when something moves. Commonly, these sensors are used in motion detectors meant for security applications, but they can be useful to activate other devices.

[The HC-SR501 sensor. Note the white covering that acts as a lens to focus infrared energy. Photo by Jeremy S. Cook]

To automate my mirror, I chose the commonly available HC-SR501 module, which I ordered from Amazon in a 5-pack. At well under $2 per sensor with free shipping, this seemed like a great opportunity to order several. As seen in the product’s datasheet, it can be powered via a generous 5-20 V, and gives a discreet signal when it observes a change in the environment. Sensitivity and how long the signal stays on (useful when triggering something directly) can be adjusted as needed via two potentiometers.

Setup seemed simple enough from the documentation, and I’m happy to report that hooking it up to an Arduino board was almost as easy as I anticipated, with one very minor complication. Power and ground were fed from the Arduino board, and the output was fed into one of the Arduino’s input pins. The very minor complication was that a resistor had to be hooked up from the Arduino input it used to ground, compensating for stray voltage that could give an occasional errant signal. Once this was done, the sensor was able to trigger my mirror lighting correctly, hopefully meaning a successful Halloween implementation in a few weeks!

Since lights by themselves might not be shocking enough, I decided to also add a voice playback module. For this purpose, I purchased this type of board from eBay. It comes with a microphone and speaker, and allows one to record his or her voice to be played back later, similar to what comes in some greeting cards. As with the PIR sensor, how I was going to hook it up was a bit of a mystery, but it was pretty easy once I got my hands on it.

[Though functional, my wiring could perhaps be improved. Photo by Jeremy S. Cook]

So now I have a fun mirror that will light up and say something scary to whoever decides to come to my door on Halloween. On the other hand, I’ve tried putting stuff that I’ve made out on my porch for Halloween before and no one came. Perhaps they didn’t know what to make of it, or were simply intimidated by the fact that I lived at the end of a very steep driveway. Maybe the kids saw easier targets across the street!

Regardless of what happens on October 31, I was happy to have a chance to experiment with these excellent sensors. As a MakerPro, it’s always good to have one more tool or component that you’re comfortable with using. You never know when you might need it!

Jeremy S. Cook is a freelance tech journalist and engineering consultant with over 10 years of factory automation experience. An avid maker and experimenter, you can see some of his exploits on the Jeremy Cook’s Projects YouTube Channel.

Jeremy Cook, Engineering Consultant

Jeremy Cook is a freelance tech journalist and engineering consultant with over 10 years of factory automation experience. An avid maker and experimenter, you can follow him on Twitter, or see his electromechanical exploits on the Jeremy S. Cook YouTube Channel!

More from Jeremy