Exploring Arduino Uno Motion Detector Options

As part of the Creepshow bav-o-rama installation for the bavastudio, I’m trying to get a motion detector hooked up to an HDMI switcher that will change inputs based on motion on the other side of the diorama window. It’s what Michael Branson Smith has termed an “aspirational goal” for this installation, and he may be right, but hope springs eternal in the bava’s breast. If nothing else, it’s given me an excuse to play with the Arduino Uno Rev3, which is a pretty amazing little gadget.

So, for the last week much of my free time has been dedicated to testing out a variety of scripts folks have shared to create a simple motion detector using the Arduino. My favorite so far is  “How to Setup an Arduino Motion Sensor” from PiMyLifeUp. I like this one because it has the motion detector connected to both an LED light and a tiny piezo speaker, so whenever motion is detected the light and speaker are activated. I used the above video and linked guide to create it, but left the resistors out of the circuit because I knew this was just a test and wouldn’t be running for any significant amount of time.

The above video is my test of the motion detector, and it’s amazing how something seemingly so complex as a motion detector can be made so simple and entertaining. That’s the magic of the Arduino.

Some notes on were I’m so far on my quest. The above build is using a PIR motion sensor, or a passive infrared motion detector, which picks up on change of radiation levels based on a person’s movement. These sensors are quite cheap; I was able to get a 5 pack for 10 euros. The tiny piezo speaker and LED light were taken from the Sparkfun Inventor’s Kit George Meadows so generously donated to Reclaim many years ago. I bought a breadboard separately because the one that came with the Inventor’s Kit was long gone. I now understand just how useful a breadboard is for experimenting with all these circuits, it allows for quick connections without ever having to solder a thing.

I figured out almost immediately that the PIR motion sensor will not work for my project because they are activated by energy displacement. Given my diorama will be trying to detect motion on the other side of an insulated window, this means energy/heat detection will be difficult, if not impossible, to pickup. In other words, this is a no-go for my use case.

The SHARP GP2Y0A21YK0F is an easy to use IR distance sensor with a range of 10 – 80 cm

But this led me down a rabbit hole of other options for motion activation using the Arduino. Another sensor I had hanging around that might work is the SHARP GP2Y0A21 proximity sensor. This sensor has a range of 10-80 cm, and according to this thread might work at a distance of 30 cm from the window and angled at greater than 30 degrees from the glass surface:

I have had good luck using sharp gp2 series proximity sensors behind glass in museum display cases for triggering exhibits.  Typically incline them at greater then thirty degrees to the glass surface to avoid measuring the reflection.   Range from 30 cm in.

The proximity sensor measures distance, and when an object breaks the pre-defined distance it creates a reading that can then become an input that triggers an action, so if an object gets closer than X do Y. For example, if someone approaches beyond the distance X the diorama window the action Y can be triggered, such as the TV they’re looking at switches to a shot of them looking at the exhibit. Once again, aspirational, but it could work.

“Laser.”

The other kind of sensor that might work is a laser. Laser’s should be able to pass more easily through an insulated window, so when someone walks by and breaks the path of the laser the switch can be triggered. That’s Mission Impossible shit right there, but I’m a little hesitant to have a laser shooting out of the window across the street given the red dot might seem like a European hitman is stationed in the diorama—creating a bit more attention than necessary. What’s more, not sure if you look directly into the laser there could be any undesirable side effects, but this is where I am probably showing my ignorance—so more research needs to be done on this option.

Yet another option I have read about is video-based motion detection that depends on a establishing shot of the window environs without anyone in the frame. At the point someone passes by the window, or stands in front of it, the difference is detected which then triggers an action. I tried something like this with OBS when I started researching motion detection, and some folks have got this working. But I’d prefer an option that doesn’t depend on something as CPU-dependent as OBS, so I would need to explore what other options are out there for video-based motion detection.

Anyway, the quest continues, and at least now I know there are several options. What’s more, they’re all pretty cost effective, which brings me back to how amazing the Arduino is for such projects.

This entry was posted in Arduino, bavastudio and tagged , , , . Bookmark the permalink.

2 Responses to Exploring Arduino Uno Motion Detector Options

  1. Awesome. Something like this python computer vision script thing might do the trick – it detects motion by comparing recent frames from a webcam, so it doesn’t rely on a pristine “normal” photo. If people stop moving, they become part of the background and are picked up again when they start moving again. I can dig up the code if you want to try that approach.

    https://darcynorman.net/2016/05/26/prototyping-an-atrium-sized-theremin/

    • Reverend says:

      I would love to see that code and test it out, it might be just what I need. I would love to know the details how how you hooked the camera up to the code, and some of the finer details given I am using an Arduino Uno, and have nothing like the Python chops you seem to. WWDND?!

Leave a Reply

Your email address will not be published. Required fields are marked *

This site uses Akismet to reduce spam. Learn how your comment data is processed.