Introduction: Stair Lighting With Motion Detection and Following Lights
(this is my first instructable and english isn't my native language)
i've made a stair lighting controlled by Arduino and triggered with two motion detectors.
The lights are WS2801-Stripes -cutted and re-aranged.
It took me way more time as i would have expected. But to be honest, i didn't knew much about programming at all.
The result is a lighting which runs in front of you and gets off behind you. Stair by stair. Triggered with motion.
I've played around with ultrasonic and photocell. But none of them worked as good.
So: let's go.
Step 1: Materials and Skills
At least as much WS2801-LEDs as stairs.
I've used 26 LEDs, with two on each stair. 13 Stairs -> 26LEDs.
An Arduino. A nano or smaller will do. We only need a hand full of in/output pins.
i don't know how to translate, so on top is a picture of them.
reusing old IDE-Cables from computerparts is a good start. They are flat, and you can solder them.
And jumper-wires to make a detachable system.
To hide everything, i've cleaned a battery-holder and put all the electronics in it.
That way i could make it all detachable to programm it.
My railing is made of steel, so magnets are a good way to stick things at a place
Most of my magnets are from old harddisks.
- you need two of them. Any will do which are compatible with arduino or a raspberry
... and of cours a soldering station, soldering iron and something to measure.
Step 2: Make a Plan and Think It Through
At first start to think about, how the light should "work".
My lights shine on the wall and the reflecting light shines back to the stair . So it's all indirectly.
Another way would be to attach the lights directly under the stair. But that way they could dazzle and you will probably see them, even when they are off.
So .. think of it, measure it and write everything down.
Step 3: Soldering
So now you've got all your dimensions you need?
Start cutting youre desired number of LEDs per stair, bring them in a 90° angle and solder them to your LED-Angles. (First picture). Repeat untill all are done. (second picture).
!Be aware of the direction! There should be an arrow printed on each part.
Now get your IDE-Cables, cut them, and solder them again in a 90° angle to your LED-Angles. (3. picture)
And now LEDs to Angle to IDE (4. picture). As you guessed: 90°
Be as exactly as possible. When its all done, you'll end up with an stair-like chain of lights.
When you are in reach of a multimeter, it's now a good idea to measure it all through.
The + and - V will "beep" through. The data and clock will only show numbers (no beeping).
Step 4: Box
All electronics fit into an AA-Battery holder.
Just get rid off all stuff in it and drill a hole on each site (for usb connection). (picture 1-3)
My magnet from an old hard-drive fits too. Arduino and magnet are fixed with double-sided glue from 3M. (4)
To get electricity to every part i've taken a pinheader. First three will be "-", last three will be "+".
Fits in the box just perfectly. (6).
Good time to destroy some jumper-cables (or to use them not as intended).
Take 8 male/female with different colours. Cut them in half. Choose one side (male or female) and put the other side away.
Two of them need to go through the front, where the usb-port looks through. Those will be the powerwires.
6 of them need to go through the back. They will bring out some electricity, data and clock.
Bring them in place and write down your colour and your pin.
On your arduino you'll need pin 2,3,5,6, power and ground. (So 6 to go out on the left.)
You can take any colour and any pin. This is just what i've used and how the code is used.
The arduino needs power too, so the little pinheader comes in now. "-" to the left. "+" to the right.
Again. i've used old IDE-cables. (the grey cables in the picture)
In the end it should look quite like picture 9. You can use some hot-glue to hold all wires in place.
My colours and used pins:
red: + (5 Volt)
blue: data (WS2801)
white: clock (ws2801)
orange: data motion sensor 1
green: data motion sensor 2
Step 5: Connecting to Stair-chain of Lights
On the left/outside of our little box we'll need to connect everything to the chain of lights and the motion detectors.
At first: connect the second detector with volt and ground to the end of the chain.
The power goes right through the chain, so you can get it from there.
The data need to be connected with a seperate wire. Probably a very long one. To use my coloursystem: orange wire. Make it as long as needed in your case.
The WS2801 needs 4 connections. +5V, ground, data and clock.
There could be printed something else on your stripes, but you will for sure find out, which is which.
The last cable (green) goes straight to data on the first motion detector.
In my case i'm going into the first detector, from there to the box and from there out to the lights and the second detector.
You can probalby use the usb-connection from the arduino to power it all, but be carefull, how many LEDs you use. Too much could kill your arduino, when powered through it.
The save way is to use a seperat connection for power.
By now it's running with a powerbank, because i didn't yet find a way to get constant power at that place without drilling holes in our walls.
Step 6: Programming and Testing
Arduino IDE installed?
You'll need the Adafruit_WS2801.h library, too. So go and get it now.
Fine, all you need is the attached code and flash it.
In Line 28 you can change the speed from up to down.
In Line 37 you can change the speed from down to up.
In Lin 46 you can change the ON-Time, when it started from "up".
In Lin 53 you can change the ON-Time, when it started from "down".
The timing now is how slow i walk :)
The Stripe will light up immediately. So if you are using a lot of LEDs, you should power them external AND push out your USB-connection.
Test it, if all works as expected. Maybe you've reversed blue and white? No problem. Change the code or the wires. You won't destroy anything. Believe me. I've made all of it wrong and nothing went into flames.
I've used paper-rolls to get a "real" detection from each motion-detector.
Step 7: Get It on Your Stairs
To hide all cables i've choosen a self sticking film from avery fascal.
It's black matte (820). You can get it from ebay or a local signmaker. Its very durable.
To bring all LEDs in the same place you can use a piece of cardboard. Cut it in your desired lenghts (90° ;) ) and you can use it for positioning.
My box  sticks under the rail. Magnets.
The seonsors are "hidden" under the first stair and the rail. To find the best position, you will have to test and test and test...
That's it. It is easy to modify in any way. Even the colour could be changed.
The biggest problem: get all wires as long as needed. Not to short, not to long.
I have to say THANKs to ClaudiaF from kodinerds.net. The code is all from her.
Participated in the
Lights Contest 2017