Automated LED stairs

After seeing the lovely LED stairs at interactivefurniture.de, I decided to make my own, open-source version. Here is a video of them in action. I am not an expert videographer and cannot do the stairs full justice, but they came out exactly as I wanted.

In this clip I use a very simple lighting sequence without any dimming. However it is easy to program the stairs to do any light sequence desired, with up to 34 LEDs per controller.

My build was featured in Make: Online.

This is the schematic. I wired it up with perfboard and used screw terminals to connect to the external LEDs and PING sensor. The Eagle schematic file is here and should have the correct footprint for the chips; if you plan to make a PCB version it would need to be edited and checked, as I did not use it for that.

LED stairs schematic. Click on the image for a larger view.

My code for the Arduino Processing environment can be found here. You can edit this to add more lights, or to use a different lighting sequence. This code uses the Lightuino source code to drive the M5451 and I am very grateful to have it, as it saved me writing hardware-level code. NOTE: The Ping library here is outdated and uses the BYTE keyword that is no longer supported by recent Arduino releases. I recommend using the NewPing library instead.

Materials:

  • Arduino Mini Pro. Any Arduino should work; this was the right size and price for me.
  • M5451 (available at multiple suppliers; use Octopart.)
  • NorthStar 12V LED lights
  • Bell wire rated for indoor use. Get more than you think you need.
  • PING ultrasonic sensors (2). The circuit will work with other sensors as well, just change the code accordingly. PINGs are not the cheapest option but I had them handy.
  • Perfboard
  • Screw terminals

I also used a ground bar for the 5V needed by the LEDs and sensors. To keep things simple, I powered the M5451 with 5V like everything else; even though the LEDs are specified for 12V, this worked just fine. However, you can feed up to 15V into the M5451 at VDD if you want more powerful lights.

For a deeper understanding of how the circuit works, please see Expanding the Arduino: cheap ways to add output pins and power. For details on the build process, here is the complete list of LED stair posts.

Important safety note: In any project that goes into the walls of your home, an electrical fire is the greatest risk. Please be sure to use a fuse on the power input to your circuit (I used 1A on mine), and ideally your power supply will be self-limiting as well. This is more than just theory. I had a connector go bad after installation, creating a short. The fuse blew, as it should, preventing a more dangerous situation.

If you find this information useful, please let me know. Comment here (with a link to your project if you have one), or e-mail me: erica AT thekanes.org.

70 Comments

  • Vito says:

    Erica, realy very nice. I`m new in arduino and I try to use you code but whit SR04 (4 pin sensor), can you help me how to change the code. Thanks in advance.

  • Erica says:

    Dear Vito, the SR04 is the ultrasonic sensor,, you can certainly use something else. You simply need to find or create code to interface your chosen sensor to the Arduino. Be aware that my code is no longer compatible with the latest Arduino software release, it requires minor changes (see the previous comments on this thread).

  • Phil says:

    I was able to get it working a while ago, but I am curious if there is a way to have the distance detected by the sensor reset after it runs or after a certain period of time. Basically if you leave something close to the sensor it goes continuously until the object is removed. Any ideas?

    Vito, I also used the sr04 and had no issue just needed a bit of recoding and a different library. Though if Arduino has been updated I’m not sure if it’ll work either.

  • Erica says:

    You could put some code after the distance check to get and set some global flags, and millis() can be used to get a time value. Only trigger the liights if there is a state transition. Should be fairly straightforward.

  • David says:

    Hi there

    Very good job with the LED stairs!

    I’m trying to do the same sort of thing, however I am having trouble with the code (I’m still fairly new to this).

    On your schematic, you are using fewer leds than i need, and im having trouble understanding how the ledstate[] and the for loops determine which leds the M5451 turns on. Please could you help me with understanding how to only turn on pins 2 to 13 or a set number of pins (I either want 12 or 14 pins to light depending if i have the top and bottom stairs always lit)?

    Im also interested in having the steps fade in and out but after hours of trying im still no further. Would you have any pointers to get the fade working please?

    Thanks

  • Darren says:

    Due to your inspiration, I’ve successfully built my first Arduino project; an LED rope-light backlit headboard for our bed that’s enabled through PIR sensors on either side. Maybe someday I’ll get around to putting it on the web.

    I saw this today on Sparkfun, https://www.sparkfun.com/products/11723 and wondered if it would provide sufficient pins, etc in a similar fashion to what you built to obtain more pins and power.

  • Erica says:

    Darren, that’s wonderful! I hope you post a link.

    The MUX shield covers the extra output pins (and input) but not the power issue. It uses the exact same shift registers I describe in my post, but costs $25 instead of $0.25, and is much larger. I don’t desscribe input in my post, but you can get cheap input MUX chips as well. So it’s a matter of whether the convenience of just using a shield is worth the money and size.

  • Erica says:

    David, sorry I didn’t see this earlier. One of the posts I wrote goes into detail about the Lightuino source code — look there for more information. I agree ledState is not obvious.

    I didn’t use fading but for LEDs one usually uses PWM. The question again is how to do this in the context of using the Lightuino code. Lightuino has its own Google code page so I would check there.

  • James says:

    Hi Erica,

    Really like this project, so much so that after i can get my iddy biddy head around all the states, shifts and other tech head mumbo jumbo i would love to hook up a light sensor to only activate during certain levels of light and have larger arrays of lights and sensors around the whole house to activate as emergency lighting…..sneaking into the house without waking people up is considered an emergency :P

    MY problem at the moment is i have soldered it all up and it appears the code has uploaded correctly and the PING’s little LED’s periodically go ballistic but i can’t seem to get main LED’s to turn on.

    Besides including the Lightuino and Ping Library and changing the reoccurring syntax errors on one or two things, would any other code need to be changed? I come from 0 electrical background so the learning curve on this is huge for me but hope to make sense of it all.

    Also i was a little confused with the LED driver. I notice you feed a 5V into the bottom pin and then again into the brightness pin across a 1kw resistor. What’s the purpose of this?

    Thank you in advance with any light you could shed on this problem but understand if you are too busy to get back to me. Regardless, love the project and hope to see more wonderful creations in the future.

    Kind Regards
    James

  • Erica says:

    As far as debugging goes, I am a big fan of using lots of Serial.print statements. Are you actually getting to the part of the code where the lights are turned on, etc. Once you’ve confirmed that, you can start checking connections and voltages.

    You mention soldering — I’d start with a breadboard first, easier to fix if there are problems :)

    A link to the datasheet for the LED driver (M5451) is included on the project page, I would start there to get a deeper understanding of that. Basically though the bottom pin is the power supply for the chip, brightness is used to control the overall appearance of the LEDs. If that’s handled wrong that could prevent them lighting up.

  • James says:

    Hi Erica,

    Thanks for your speedy reply!

    I would love to tell you i have even the slightest idea as to what im doing but that would be a lie im afraid so your question regarding where in the code i am up to is impossible to answer as i simply do not know haha.

    I have been going through your code and my good friend google has been giving his fair share of help too but progress is slow.

    I suspect i may not have corrected the BYTE issue of the 1.0 release so am starting again to look through and better understand what is going on. On this note though, to solve the BYTE issue, would one simply just do a find and replace type of command or would something more drastic need to be implemented?

  • James says:

    YAY!!!! Lights are flickering away!!!!

    I think i understand the gist of it all now. My only concern is that it appears if nothing triggers the sensors they seem to switch off and i have to manually flick the reset on the board.

  • [...] http://www.thekanes.org/projects/automated-led-stairs-howto Share this:TwitterFacebookLike this:Like Loading… Filed under Uncategorized ← HR Giger [...]

  • Prabu says:

    Hi erica, i am looking forward in building your project and i was wondering if i could add 2 Push Button Switches (one on top and one at bottom or more like a 2 way stairs lighting switch) to bypass the Ultrasonic sensors to keep the lights permanently ON as i would like to keep the stair lights ON during parties (looks cool) and then switch back to the sensors once the party is over.

    How do i do it and which part of your code that i need to edit to enable such function and i am fairly new to arduino.
    looking forward for your reply.

    This is seriously a good project! Cheers!!

  • Erica says:

    Hi Prabu, thank you. Your idea should work. The loop() function is where you should start looking first as it determines when to fire the light sequences.

  • Anthony Fedele says:

    Dear Erica,

    Thank you so much for this webpage. You have inspired me to try my first Arduino project. I have some experience in Coding, Soldering, and fairly talented in construction. I am excited to try this and wanted to see if you have any changes that you would make in regards to updating this page.

    Thanks again!

    Anthony

  • Erica says:

    No changes, but I’d encouragee you to read through the several pages of ccomments on this project too ee what otheers have done. Thanks and good luck!

  • Evan says:

    Hi Erica, i really like your project and I really want to do it . I was trying to buy some 3 pin PING but very hard. Can I use 4 pin PING. And what I need to do for it . Please help me I’m really new for the arduino. But I’m little bit good for electronics. I like your project , that’s why I bought Arduino UNO. I need your help to get done this project. Thank you .

  • Erica says:

    Evan, a 4 pin unit should work fine. There are many librariies that should work with them, I believe Ping will, but I generally use NewPing theese days. Google and you will find it.

Leave a Reply

XHTML: You can use these tags:' <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong>

Copyright © 2014 NovoKane All rights reserved.
Desk Mess Mirrored v1.4.5 theme from BuyNowShop.com.