Motion Sensing LED Hallway
Robert BoscacciRobert Boscacci
Tl;dr: I covered the perimeter of my apartment hallway in fancy LED strips. I installed motion sensors above all the doorways. I wrote a bunch of Arduino code. Now when you trip one of the motion sensors, the hallway lights up from that point outward, creating a “runway” effect. This is how.
A few weeks ago I took an intro to Arduino class at my local hackerspace, NYC Resistor, and got inspired!
I’d like to install motion sensors and smart LED strips in our apartment’s entrance hallway. I’ll make them do a runway/chase effect, where the lights spark up sequentially (outward) in both directions, from the location at which the motion sensor is tripped. There could also be a button that forces the lights to stay on indefinitely, like…a light switch! And a way to change colors.
Here’s our entrance hallway today, with ugly glaring “boob light” visible:
I haven’t seen anything on Instructables quite like what I’m envisioning. This is the most similar precursor example that I could find, and it’s an educational one, but it’s a stairway (not a hallway), with many separate LED strips. Here’s the video demonstration:
This stairway is a really helpful example, and I think I’ll end up using a lot of the same parts. But my setup will be sort of different.
Below is an example with longer LED strips (more like the kind I want to use) lining a hallway, but there’s no “animation” other than fading all LED’s together from 0 to 100% brightness upon tripping the sensors:
While it works, I don’t think it’s the most elegant installation job. The under-glow lighting is also a little too sci-fi for the home, in my opinion; I’d put the strips by the ceiling, like normal home illumination.
We’ll use some aesthetically pleasing hardware to diffuse light and hide ugly wiring, like this metal channel that my roommate Ryan found on Alibaba:
The previous video example also doesn’t take advantage of individually addressable LED strips, like the NeoPixel products that Adafruit offers:
Addressable LED strips are the cat’s pajamas; the bee’s knees.
I need that pixel-level control. With NeoPixels, a super-long series of LED strips can be controlled from just one data pin on an Arduino board!
After some tabulating and scheming, I order these parts:
I hope I’ll be able to get these bits powered and communicating with each other, if only because those LED strips aren’t the cheapest. I took a 4-month data science boot camp recently, so I have some programming experience. Arduino code is more like C++ than Python. However, I know abysmally little about electrical engineering, which is sort of critical here. I guess I’m supposed to wire everything to a common ground or I’ll have weird sync issues.
I am using this guide on the Adafruit site to estimate the amperage I will need.
The two LED strips I just ordered are the longest ones available from the AdaFruit site at 5 meters each, and they recommend feeding each strip some power every meter or so. I don’t know how to physically do that while testing: Alligator clips? Implementation won’t be super easy for me. I tried to solder once before, it didn’t go well. Will the power and data cable run-lengths cause problems?
Adafruit strongly recommends buffering power to the NeoPixel LED strips with 1K-μF capacitors to prevent power blowouts on startup, so I picked up a 5-pack. Will I need one for every spot where I feed a strip power? Or just one capacitor for each power supply? Will I need more wire in general? Only time and testing will tell!
For now, I will just have to wait for my parts to arrive. Hopefully, if I bother them, the nice people at NYC Resistor or the Arduino parts shop in Manhattan (Tinkersphere) will lend some guidance while I break things.
Things have already begun to arrive!
Got some wires, LED strips, power supply; most of what I need. Adafruit is just across the East River, in Manhattan, which might explain how their stuff showed up just as quickly as the Amazon Prime deliveries.
The first roadblock I hadn’t anticipated is that the power supply I bought doesn’t come with an easy way to plug it into a wall outlet. This should have been obvious looking at photos of the product on Amazon. Oops. Luckily this is easy to remedy, given some loose 18awg wire and a spare Edison wall plug stolen from some other device. In my case I cannibalize a short 6" extension cord, keeping the male end, chopping off the female end, and hooking up the three wires accordingly to the PSU. I followed this video tutorial:
In a very janky breadboard/jumper cable fashion, I make the necessary data and power connections between the Arduino board, an LED strip, and the power supply. I load up some example code from the Neopixel Arduino library. With some small modifications to the code, I’m starting to see something like the chase effect I was imagining for the hallway!
For now, I have to use my imagination to picture a motion sensor located near the middle of the LED strip triggering all the lights to turn on in sequence from that point outward.
Very stoked on this small success! I wasn’t even sure I’d be able to get the strip to turn on, but here it is, lighting up, talking to my Arduino board, and generally showing lots of promise. No smell of burning electronics either. Big win for today.
Roommate Ryan lends a hand while I demo the LED strip in the hallway, just to see how it might end up looking. Got some feedback from my first “user”:
I go on Alibaba and place an inquiry about some mega-cheap addressable LED strips:
The Most Comprehensive IoT Newsletter for Enterprises
Showcasing the highest-quality content, resources, news, and insights from the world of the Internet of Things. Subscribe to remain informed and up-to-date.
New Podcast Episode
Related Articles