Stair Lighting With Motion Detection and Following Lights

by doncore in Circuits > Arduino

8097 Views, 141 Favorites, 0 Comments

Stair Lighting With Motion Detection and Following Lights

photo_2017-05-28_14-18-32.jpg
MOV 0950

Hi there,

(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.

Materials and Skills

photo_2017-05-15_06-59-11 (2).jpg
photo_2017-05-28_14-18-28.jpg
photo_2017-05-28_14-17-16.jpg

-WS 2801

At least as much WS2801-LEDs as stairs.

I've used 26 LEDs, with two on each stair. 13 Stairs -> 26LEDs.

- adrduino

An Arduino. A nano or smaller will do. We only need a hand full of in/output pins.

-LED-Corner-Adapters

i don't know how to translate, so on top is a picture of them.

-Wires

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.

-Box

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.

Magnets

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.

Detection Sensors

- 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.

Make a Plan and Think It Through

photo_2017-04-04_09-49-47.jpg

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.

Soldering

photo_2017-05-15_06-59-24.jpg
photo_2017-05-15_06-59-29.jpg
photo_2017-05-15_06-59-27 (4).jpg
photo_2017-05-15_06-59-29 (3).jpg

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).

Box

photo_2017-05-28_14-17-22.jpg
photo_2017-05-28_14-17-29.jpg
photo_2017-05-28_14-17-39.jpg
photo_2017-05-28_14-17-35.jpg
photo_2017-05-28_14-16-36.jpg
photo_2017-05-28_14-17-25.jpg
photo_2017-05-28_14-17-19.jpg
photo_2017-05-28_14-17-04.jpg
photo_2017-05-28_14-17-45.jpg
photo_2017-05-28_14-17-14.jpg

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:

brown: -

red: + (5 Volt)

blue: data (WS2801)

white: clock (ws2801)

orange: data motion sensor 1

green: data motion sensor 2

Connecting to Stair-chain of Lights

photo_2017-05-28_14-17-11.jpg
photo_2017-05-28_14-16-39.jpg

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.

Red: +5V

Brown: ground

White: clk

Blue: dat

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.

Power:

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.

Programming and Testing

photo_2017-05-28_14-16-43.jpg
photo_2017-05-28_14-16-53.jpg

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.

Downloads

Get It on Your Stairs

photo_2017-05-28_14-17-57.jpg
photo_2017-05-28_14-17-52.jpg
photo_2017-05-28_14-18-22.jpg
photo_2017-05-28_14-18-25.jpg

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 [1] 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.