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