Automatic IoT Staircase Glowing Lighting




About: The opinions in my posts are personal and not necessarily shared by the company I work for. Sometimes I don't agree with myself either. PhD in Computer Science and Engineering.

Hi all,
This is my first Instructable, hope you like it. It is based on ideas and animations taken by another old project of mine:

From the above first version of that lamp (dating back one year ago), I took general concept and ideas, and part of the mobile app code.

For this project, I have changed the microcontroller (it's now a Wemos D1 R1 instead of an Arduino Uno + ESP8266), I have added some animations (some make sense only on the stairs), and I have added the motion detection plus alarm feature.

Then, this project gave the inspiration for the second version of the lamp: which is made with a Wemos D1 R2, has different animations, and has the improved version of the mobile app.

Part of the animation code is by Adafruit (their strandtest example
in the Neopixel library). The Larson effect code is inspired by:

Getting the outside temperature with openweather was inspired by:




Automatic connected staircase lights. I wanted to build a project having in mind three objectives:

1) it must be useful: many projects we can find on Internet are scientifically challenging, and many times they are cool&fun. But they may miss the long-term usefulness, or large audience impact. I wanted to build something me and my family would use everyday, so that readers would find it useful too.

2) it must look cool: I didn't want to end up with something which looks patchy, ugly, that nobody would like to show in his/her own house. Something as close as possible to a real product.

3) it must be fun: this is really for the builder :) something which you'd enjoy replicating and playing with, while meeting the criteria above.

I tried to fulfill the above as much as possible, you're the judges, your views, favorites, and votes will be my measure of success! :) enjoy!


I like the idea of walking through the house without having to press a button to switch on the lights. I wanted to have something like this on our staircase, also having in mind you may walk the stairs with your hands busy with something (or someone :) ). I wanted to make my own automatic switch to enable animations and effects (hence a micro-controlled solution) and I like LEDs in principle but the dots are too geeky (hence a LED strip in an aluminum profile with a glossy diffuser). Plus, I wanted to have an extra motion-detection alarm for our house (hence a wifi-enabled micro-controller, the IFTTT integration, so finally an IoT solution).


I used the following components, scroll down for the building steps:

1) 2 x 4m ws2813 rgb LED strips:

get the non waterproof version, with 60 leds/m. Also, I found a cheaper 5m version and just cut 1m from the end of both the strips. Note you can do this with ws2812 and ws2812b LEDs as well, the light will be exactly the same and these are cheaper. The ws2813 are just more reliable, as they have a redundant data connection, so if you break one LED, the rest of the strip will keep working.

These were roughly 27$ / 25€ each.

2) 4 x 2m U-line aluminum profiles, 14mm x 13mm:

These were 20€ each, roughly 22$. I have also bought the terminal caps and the fitting screws. The screws couldn't be installed on the side I needed them, they are supposed to be installed on the side opposite to the diffuser, so they were of no use for me. Instead, thanks to the slope of the stairs and some friction provided by the skirting board, some pieces of bi-adhesive scotch tape was enough to fit the profiles over the skirting boards.

3) 2 x cat-5 Ethernet cables :

I have no idea which length was used here, I guess around 2m, the electrician and the carpenter installed the cables under the floor, going from the skirting boards of the stairs, to the room with the hotpress. Note that too long cables will reduce the current and you'll need some more sophisticated setup to provide the correct current and to avoid breaking the data connection.

4) spare assorted dupont cables:

5) as wifi-enabled micro-controller, I have used the first version of the Wemos D1, now discontinued, which you can still find online:

For future readers, if you don't find it, version R2 of the Wemos D1 should work as well.

6) 2 x PIR motion sensors for Arduino:

7) one 5v, 40a, 200w power supply:

This was 21.5£, roughly 25€ or 27$. You probably need less than 40A, but this was cheaper than a 20A, and with the amperes, it's always better to oversize, so the power supply will run cool and live longer.

Teacher Notes

Teachers! Did you use this instructable in your classroom?
Add a Teacher Note to share how you incorporated it into your lesson.

Step 1: Wiring

You need to realize the following connections:

1) LED strips - Wemos D1

2) LED strips - power supply

3) PIR sensors - Wemos D1

4) PIR sensors - power supply

5) Wemos D1 - power supply

6) power supply - house power network

Preparation: I had two cat 5 Ethernet cables ( installed under the floor between the skirting boards of the staricase and the hot press by the carpenter and the electrician before the carpenter installed the wooden floor. One cable per side of the staircase, popping out from the tip of the skirting board on one end, and from a hole in the wall of the hot press on the other end. A cat 5 cable has 8 small cables in it, divided into 4 twisted pairs using 4 different color bases and 2 color patterns (solid color, or dashed line). Remove 8-10 cm of rubber from each end of each of the cat 5 cables, so to access the 4 twister pairs. Un-twist each pair, so to end up with 8 indipendent tiny cables. Remove about 1cm of plastic only from each tip of each tiny cable, at both ends of each of the two cat 5 cables. This step is quite time consuming and I recommend using a proper cable peeler to do it quickly. I used scissors.

For the connection listed as 1), I picked the 4-way connector (plus the two extra power cables) from the LED strip, and connected the green cable from the LED (the data cable) to one of the 8 tiny cables from the cat 5 cable. I chose the white-orange pins of the cat 5 cable for this.

For the connection listed as 2), I picked the 4-way connector (plus the two extra power cables) from the LED strip, and connected the red cable from the LED connector (the VCC cable) to *two* of the 8 tiny cables from the cat 5 cable, re-twisted together. I chose the blue and white-blue pins of the cat 5 cable for this. Also, I connected the white cable from the LED connector (the GROUND cable) to *two* of the 8 tiny cables from the cat 5 cable, re-twisted together. I chose the brown and the green pins of the cat 5 cable for this. Lastly, to bring even more current to the strip, I connected the extra white cable from outside the LED connector (the extra GROUND cable) to one of the tiny cables from the cat 5 cable (I chose the white-green pin of the cat 5 cable for this), and the extra red cable from outside the LED connector (the extra VCC cable) to one of the tiny cables from the cat 5 cable (I chose the white-brown pin of the cat 5 cable for this). The reason for powering the LED strip with 3 cables bringing the positive, and 3 bringing the ground, is to distribute the current over more pins, to avoid over-heating and to make sure enough current reaches the LEDs. This could have been achieved by running a thicker cable just for power, but then I would have needed to run too many separate cables (a thick one for power, a thick one for ground, one data cable for the LEDs, one data cable for the PIR sensors. I preferred to pay the electrician less and have only 1 cable per side installed :)

For the connection listed as 3), I connected the "out" pin of the PIR sensor to one of the tiny cables from the cat 5 cable (I chose the orange pin of the cat 5 cable for this).

For the connection listed as 4), I connected the "vcc" pin of the PIR sensor to the white-brown tiny cable of the cat 5 cable which was already connected to the red cable from the LED strip, and the "ground" pin of the PIR sensor to the white-green tiny cable of the cat 5 cable which was already connected to the white cable from the LED strip.

All the above connections could be made more tidy by using heat-shrinkable tubes. I'm not using them, as I plan to cover everything with a white MDF board placed on top of the aluminum profile, so to embed the profile into the skirting board. This will hide all the cables and will leave me access in case repairs or further developments are needed.

These first 4 connections were replicated exactly on the other side of the staircase, where the other PIR sensor is.

Note also that the blue cable from the LED connector is left without a connection, as that's the redundant data from the ws2813 strip.

To realize the other sides of the connections (i.e. in the hot press), I have:

a) twisted back together the blue, white-blue, and white-brown pins of the cat 5 cables and I have inserted the result into one of the three "+V" ports of the power supply.

b) twisted back together the green, white-green, and brown pins of the cat 5 cables and I have inserted the result into one of the three "COM" ports of the puwer supply.

a) and b) were replicated for the other cat 5 cable corresponding to the other side of the staircase. I have used another "+V" and "COM" port(s) of the power supply.

c) the two orange pins of the two cat 5 cables were insrted into pins 4 and 5 of the Wemos D1

d) the two white-orange pins of the two cat 5 cables were twisted back together and inserted into pin 1 of the Wemos D1. Now, if I had used a regular Arduino Uno with a wifi shield or external esp8266 module, I could have left the two strips independent, not twisting the two cables, and connecting the two pins to pins 1 and 2 of the Arduino. This way, I could have controlled the animation of the two sides of the stairs separately. I decided to simplify, though, and kept them joined. This is a limitation of the Wemos D1 R1, that can drive a Neopixel-compatible LED strip only from pin 1. I'm not sure if they fixed this into R2, that's possible, if you end up trying with an R2 let me know if this works.

For the connection listed as 5), I had many possible options (like using a spare usb power supply for a phone and using directly the microusb port in the Wemos D1), but, since I had the last (third) pair of +V and COM ports from my 40A power supply unused, I decided to connect the 5v pin of the Wemos to the +V port of the power supply, and the GND pin of the Wemos to the COM port of the power supply. Please note this bypasses the internal voltage regulator of the Wemos and will only work if the power supply has a pretty constant voltage, which was my case. If not, you risk to burn the Wemos D1. Note that in the picture you'll see a microusb cable connected to the Wemos D1. Well, it's not connected to anything on the other side, I just left it there for when I have to plug the Wemos to the laptop to program it. As you'll discover in the later step, I am programming the Wemos wirelessly OTA (Over The Air) now, so that cable can be removed for good.

For the connection listed as 6), the electrictian left a white cable plugged to a fused switch, carrying 220v, popping out from the wall. So all I had to do was to take some of the rubber out at the end of the white cable, remove about 1 cm of rubber from each of the three contacts, then connect the brown into the "L" port of the power supply, the blue into the "N" port, and the yellow-green into the "earth" port.

This was by far the most time consuming step, also because I didn't use the proper tools for peeling off the cable rubber, I just used some kitchen scissors. I have always done it that way so my error rate was only 3/35 (where 35 is 8 pins from each cat 5 cable and each end of them, plus the 3 pins from the house network cable), i.e. I only had to re-cut 3 pins in total out of 35 connections. However, you can do it probably faster with a proper cable stripper.

Step 2: Fitting the LEDs and the Aluminum Profiles

This is rather easy once you figure out the best sequence of steps. I recommend the following:

1) with the help of another person, take both the profiles to install on one side, put them over the skirting board with the diffuser pointing towards the other side of the stairs, decide which area of the stairs you want to cover (our stairs were 4.4m long and we only had 4m of aluminum profiles) and mark it with a pencil.

2) place 3 or 4 chunks of bi-adhesive scotch tape along the length of each of the two aluminum profiles (or on the skirting board directly). Ok, I lied, I didn't have bi-adhesive scotch tape so I just ended up using regular scotch tape roled over itself to form a bi-adhesive patch. It works.

3) gently remove the diffuser from the aluminum profiles (watch your fingers!)

4) place the profiles onto the skirting board (i.e. onto the scotch tape), making sure the scotch tape is hidden between the profile and the skirting board. Make also sure that the diffuser is pointing towards the other side of the stairs, not pointing up, otherwise you won't get the desired effect. In other words, the attached picture here is just for reference, don't follow the image with the measurements as that installs the diffuser pointing up.

Now you need to take some confidence in doing the next steps, my advise is to get help from a second person, and get the person with the smaller fingers to do these:

5) unroll the LED strip, place it next (but outside) of the aluminum profile and make sureall the LEDs will properyl end up inside the U-line. at the top end of the strip, you have the connector, which is thicker than the aluminum profile. Take note of where that will end up once the strip will be inside the U-line.

6) remove the cover of the bi-adhesive tape that you find behind the LED reel (if you don't have a bi-adhesive tape here, get one and fit it along the whole length of the reel. No sporadic patches, you need the full lenght covered by tape). I had 3M quality bi-adhesive so there was very little room for error. If you don't pay enough attention, the tape will stick to either the profile, or the skirting board, or to another piece of the strip itself, or to the steps, and it's not too easy to remove it.

7) insert the top connector of the LED strip by sliding it together with the first 2-3 pixels into the end of the profile. Make sure you match the level that you took note of in step 5)

8) now have the person with the smaller fingers gently press each pixel against the end of the U-line. Take your time while doing this.

If you took note of all the lengths correctly, you'll end up with the last LED just 2-3 mm inside the U-line on the other end. :)

Step 3: Programming the Wemos D1 Microcontroller

Load the attached "instructables.ino" file into the Arduino IDE, connect your Wemos D1 via usb (make sure you have followed the Wemos installation guide first: and upload the sketch.

You'll need to configure three things in the sketch:




note that the sketch is not really optimized, as the various blocks are copy-paste from other projects I had in my library.

Also, you'll notice there is more than just "switch on the light automatically and send a trigger to IFTTT". For example, you can control the lights from the web by sending a command in JSON format and turn on the lights with different glowing colors. I have developed a simply mobile app to interface with the stairs, it's shown in the videos in the next steps, though the app itself is out of scope for this instructable. Also, the mobile app is developed reusing another project of mine here:

The "glowing" effects of the lights on the stairs is provided by the combination of the following:

1) I have chosen the 60 led / m version of the strip. With 30 led / m it wouldn't have been the same, as you would have seen the dots of the LEDs.

2) I have chosen the U-line as opposed to the mini-U-line, which is much narrower, so the LEDs are closer to the diffuser and you see the dots

3) I have chosen the opal diffuser. With a frosted or semi-transparent diffuser, the effect wouldn't have been the same.

4) I hope it's visible in the video, the effect when the lights turn on or off is that of a glowing light switching on, rather then a mere, raw, switch on altogether.

5) the other colors I have embedded as other possible choices to light the stairs are all "pop-electric" colors that give a modern look to the stairs.

To give you some hints for the mobile app and the web interface, I have:

1) made sure that my router assigns always the same ip to the Wemos D1 (check for the "reserve address" feature in the DNS page of your router)

2) specified a simple protocol to send commands: via web, you can send the "c" parameter from 1 to 13, will set the lights to 13 different colors (13 will set them off), according to their RGB values specified in the sketch.

To do this, simple access via web "http://192.168.YOUR_IP_HERE/?c=4" to set, for example color 4, which is

0xFF00FF, i.e. purple. The mobile app does exactly this, just with a nicer interface than a web url.

The embedded video here shows the result so far (without IFTTT).

Step 4: Interfacing With IFTTT

IFTT (If This Than That) is an online platform enabling actions in response to certain conditions (e.g. weather conditions, other actions, sensors, etc):

All you have to do is to specify the "This" and "That" in what's called a "recipe".

In order to create a custom recipe, you need to create a "Maker" account and get a maker key.

Go here:

then sign up, and get a maker key, which is a long alphanumerical string.

Place that string in the sketch from the step before, in place of "YOUR_IFTTT_MAKER_KEY_HERE".

Then create a "trigger", for simplicity create two triggers, one called "downstairs", one called "upstairs", they are already setup in the sketch for the Wemos. If you prefer to have only one trigger, just scroll the sketch and change "upstairs" and "downstairs" with something like "stairs" only.

Make sure you oriented the two PIR sensors one pointing downstairs, one pointing upstairs, and to match their pins so you trigger the "downstairs" event when someone is downstairs and climbing upstairs, and the other way around.

As "That", choose your preferred action. I chose Anroid notification. In this way, I get my IFTTT app installed on Android to notify me of the events. You can setup a notification string, I chose "OCCHIO SOTTO!" (it means: "watch downstairs!" in Italian) and "OCCHIO SOPRA!" ("watch upstairs!").

As a final touch, if you have a 24/7 connected linux system, install a cron job that forces the triggers to be checked every minute. In this way you will get notified within a minute when somebody walks the stairs. Otherwise, it's left up to the IFTTT timeout for that specific trigger. Usually this is 15 mins.

See this embedded video for the final result (there was a small delay before the downstairs sensor got me this time).

Step 5: Enhancements


When I first wrote this Instructable, I had a series of next steps which I planned do implement.

Now I have implemented most of them, so here they are (see the video for their final effect):

1) a "clock" animation, i.e. telling the stairs to display the current time by switching on different pixels

2) a "Larson" (aka Knight Rider) animation

3) an outside and inside temperature display, telling the stairs to light from the bottom up to the level of the current temperatures. Outside temperature could be taken by making the stairs even more IoT.

4) step-by-step animation when motion is detected

5) several other animations not motion based: 4m of Neopixel strandtest, a modified version of the strandtest that changes all the pixels colors at once, etc

See the updated Arduino sketch

Still left to do:

6) adding a light sensor, that would control the light switch to work only when the house is dark

Hope you enjoyed my first Instructable!

Step 6: Conclusions

I had fun building this project, hope you'll have too if you're going to replicate it.

Some highlights:

1) I believe it's useful. I walk the stairs at night for a glass of water, and I don't have to even remember where the light switch is while I'm asleep :)

2) The use of the Arduino-based micro-controller is not limited to just sending a signal, or switch on the lights. So far it handles the motion sensors, it implements the animations, it serves an http-based interface to control the lights, and it interfaces with IFTTT to implement the home alarm. Plus, it works as a clock and thermometer thanks to IoT :)

3) Its glowing effect looks really cool on our steps. It probably wouldn't be the same if we had carpet on the steps. The picture and the videos don't really show how they look live, I hope you'll enjoy replicating this project to see its real effect! :)

Final line: all of this is only possible thanks to the versatility of the genuine Arduino (originally started by Italian designer and enterpreneur Massimo Banzi, co-founder), Arduino clones, Arduino-based boards, and ESP8266-based Arduino-based boards. They really enable tons of applications and their limits is just your creativity!


Green Electronics Contest 2016

Second Prize in the
Green Electronics Contest 2016

Arduino Contest 2016

Participated in the
Arduino Contest 2016

Remix Contest 2016

Participated in the
Remix Contest 2016

Make it Glow Contest 2016

Participated in the
Make it Glow Contest 2016

First Time Authors Contest 2016

Participated in the
First Time Authors Contest 2016



    • Indoor Lighting Contest

      Indoor Lighting Contest
    • Make It Fly Challenge

      Make It Fly Challenge
    • Growing Beyond Earth Maker Contest

      Growing Beyond Earth Maker Contest

    21 Discussions


    Question 11 months ago

    Im trying to do my driveway what equipment would i need.


    Question 1 year ago

    Is there a way to turn on the light at lets says 7 pm and turn off the ligths at lets say 6 am. I am trying to do this outdoor. I have wemos, i dont believe i will need PIR sensor since its time based not presence based. Also i do want remote functionality and physical switch capability.


    1 year ago

    I struggle with ifttt, I cant find how to configure trigger as per your instructions. Is somewhere describet in more detail?
    What service should I choose for trigger, how to configure. Where to get your app for color changing....?


    2 years ago

    I ran into this error when trying to upload sketch stairsIFTTT2.ino:

    E:\TEMP\instructables\instructables.ino:3:21: fatal error: TimeLib.h: No such file or directory

    #include <TimeLib.h>


    compilation terminated.

    exit status 1

    Error compiling for board WeMos D1 R2 & mini.

    1 reply

    Reply 2 years ago

    Please check if this information solves your issue


    2 years ago

    This is amazing!

    Is it safe using the cat. 5 cable for power?

    Each one of those wires are 24AWG and rated for .577A each. The 60/m LEDs pull around 15W/m. For 4m at 5V has a max of 12A. Even dividing by 3 for RBG is still 4 amps. That's just pretty high over the rating of 0.577A

    So have you had any problems with overheating or anything like that?

    3 replies

    Reply 2 years ago

    Hi thanks for you comment and interest!
    The brighest color I use (255,221,170) needs 50.7mA per led.
    50.7*240 (leds in 4m) = 12180mA.
    Then you see that in the code the maximum brightness for the fixed light mode is set to 60 (out of 255).
    12180mA *60/255=2865.
    I'm using 3 pairs of wires per side, so 2865/3=955mA, or, 0.96A per wire.
    Besides the fact that I have seen 2 different figures around for cat 5 cables (one is 0.557A as you said, one is 0.729), I'm still over the specs.
    But I never turn on the lights for 2 hours, and, so far, I have never experienced overheating (I did worry about it at the beginning and I was constantly monitoring the wires for it).
    I guess they either need more time to overheat, or they have large tolerance, or they are rated for more than 0.729.
    If in doubt, you can take that color out. The other ones (a part for one more) should be below 0.729 per wire.
    You can even keep the colors and reduce the max brightness even more.
    Does that answer your question? What do you think?


    Reply 2 years ago

    Thank you for the quick response! This answers my question very well. I missed the maximum brightness in the code.

    I do have one more question. The link for the LEDs isn't working for me. So I looked through AliExpress for similar lights. The ends of the ones I see have R,B,G,+. I'm a little confused about how those work. What would the data input be and what would the ground be?


    Reply 2 years ago

    Please share the link to the strip you are talking about, otherwise I'm not able to help.


    2 years ago

    i made automatic stair case lighting by using arduino and normal 5050 rgb led strip light . using 2 pir sensors on up stair and down stair ... i programmed the arduino but facing problem that when a person travels from down stairs to up stairs the down pir is detected and start processing and when person came to up stairs the up pir again detects and put in queue after down pir process completes it starts second process . i want to put one pir sensor on hold until one process fully complete even person cross the one of the second pir sensor ... . like down pir detects have to put on hold of up pir sensor as similar if up detected then down have in hold . hold means even person cross should not detect or send signal to arduino.... please share any code or solution ...

    1 reply

    Reply 2 years ago

    Hi, look at the code in the I'ble, it handles your situation already.



    2 years ago

    Very useful! I plan on duplicating this project on my basement steps. Many thanks!

    1 reply

    Reply 2 years ago

    Thank you, good to see you appreciate the usefulness.

    Basement, huh? I wonder if that opens new challenges, or opens the room for new addition. Let me know what's your setup (what kind of stairs you have, what's on the landing in the basement, etc, so we may work together on some ideas to implement in your case!

    cheers :)


    2 years ago

    Very nice! The diffuse effect from the profile comes out great on the picture. Might use this for one of my own projects. Thanks for sharing!

    1 reply

    Reply 2 years ago

    Thanks! Keep in mind the difference between the mini U-line and the U-line. You need the U-line for a better diffusion of the light. With the mini one, you'll most likely see the dots of the LEDs.

    Another option is to find thicker diffuser, but I was happy enough with this solution.

    enjoy! :)


    2 years ago

    Lights definitely add some class. Lovely project!

    1 reply

    2 years ago

    This is great! I'd love to set something like this up in our stairway :)