How to Assemble Stair Lights

In this video, I provide a complete tutorial on how to assemble your own stair lighting, featuring block diagram, code overview, testing and final layout. Code and schematic can be found on this page.

Table of Contents

Problem Statement
Design Choices
Input Device
Output Device
State Machine
Frequently Asked Questions
Problems Encountered
Potential Improvements
Success Stories

Problem Statement

The stairs at night were really dark. It was bad enough that we had to put lights next to it. However, these lights shined in your face and not the stairs. I wanted to light up the actual steps. I really thought the German video was cool, so I aimed for that animation as my goal.

Design Choices


I chose the ATmega328P firstly because it was on the Arduino. It had the hardware SPI, a ShiftPWM library and good enough speed. If I was mass-producing these, I would probably have chosen a microcontroller with less pins.

Input Device

I had some choices when looking for “person detectors”. I could have used laser sensors, IR beam sensors like they use at the store, or the PIR motion detectors. I initially wanted to use the laser sensors because they show absolute presence vs just motion like the PIR sensors, but they were too finicky. The laser sensors had to be positioned just right on the photodiode, and I didn’t know where to buy the IR beams. The PIR motion detectors actually work very well.

Update 2014-11-09 Since the time of this post there has been a new product in the Adafruit store called a “laser break beam sensor”. If the delay on the motion detectors is completely intolerable then you could try one of these:

Output Device

For output devices, it was clear that I wanted to use the strip LEDs vs the regular point LEDs. I saw some previous implementations like this one and gawked because they didn’t even light up the stairs, only the walls next to the stairs!

This person lit up the wall.

This person lit up the wall.

State Machine

Stairs State Machine 2 - New Page


Code that runs on the microcontroller may be found on Github:

Here is a video to help you run the code:


I laid out a board but never had it printed. It should be completely functional, but have a look before you print it, especially the minimum distance between traces etc.

EDIT 2014-10-28: I have finally tested the board and it almost works! This was one of my first PCBs and I messed up in my definition of the 2N7000. As a result, you have to solder in the transistors backwards in version 1.0 of the PCB. In version 1.1 this is fixed.

The small rectangle on the left side is a matching through-hole resistor for the photoresistor. I recommend populating the LED headers at the bottom with 2×40 male headers and using black female jumper wires to connect the LEDs. Or you could modify the board to make screw terminals.

Version 1.3:



  • Fixed “photoresistor always reads zero” problem


  • Added footprint for voltage regulator just in case someone fries the one on the Arduino Pro Mini


  • Fixed backwards transistor problem
  • Added more labels for power, motion detectors
  • Added labels for MOSFET source, gate and drain just in case you want to use a different MOSFET.



PCB with connectors. I originally wanted to use the red connectors but I didn't realize they were too thick, so now I recommend the black connectors on the right side.

PCB with connectors. I originally wanted to use the red connectors but I didn’t realize they were too thick, so now I recommend the black connectors on the right side.

When you solder everything correctly, this should happen:


You will need:

1x Arduino Pro Mini 5V, find on eBay
5m 3528 white LED strip, find on eBay
1x 12V 3A Power supply, find on eBay
PCB, $30 from OSH Park, see Schematic section for link
Enough wire for your stairs, you can also buy similar from Home Depot
2x PIR sensor or Laser sensor

PCB parts:
20x 2N7000 MOSFET or any other pin-compatible MOSFET. SOT-23 packages work well on the PCB too.
1x Single row female header
1x Double row male pin header
1x Single row male pin header
1x (Photoresistor and 10k resistor) (optional)
1x Switch (optional)
1x Screw terminal
2x 16-pin socket
2x 74HC595 Shift register
1x (LM7805 regulator  and 0.1uF capacitors) (mandatory)
20x Female Jumper wires (one item comes with several wires)

1x USB-to-UART
Soldering iron
Heatshrink and lighter – use the smallest size and cut into 3 pieces each
Wire stripper

I recommend buying 2 or 3x everything in the “PCB parts” section in case you decide to start over.


Assembly video and more detailed instructions coming in the future when I have time

  1. Assemble Arduino Pro Mini–solder male headers below on the long sides and above on the short sides
  2. Set jumper on USB-to-UART to 5V
  3. Connect USB cable > USB-to-UART >  Arduino Pro Mini and program it with Blink sketch
  4. Assemble PCB (refer to photo in PCB section)
    1. Solder female headers in the “Arduino Pro Mini” slot
    2. Solder LED+ and LED- with double row male headers
    3. Solder side pins like “motion” “switch” etc with male headers
    4. Solder in sockets for shift registers and insert the shift registers
    5. Insert Arduino Pro Mini with FTDI header in the middle of the PCB
    6. (optional) Solder in regulator and capacitors
  5. Assemble LEDs
    1. Cut a female jumper wire in half
    2. Put heatshrink on the half-jumpers
    3. Solder half-jumpers to a 2-conductor wire, then solder 2 conductor wire to LED.
    4. Connect your jumpers to the PCB male headers
  6. Repeat step 5 for however many stairs you have

Frequently Asked Questions

How do I adjust the number of steps? Only nine of the steps turn on.

One of my lights doesn’t turn on/off or it flickers.

If it’s just one light then it’s a hardware problem. Try replacing the transistor that controls the flickering light or the light itself.

My lights stay on and never turn off.

Your transistors may be inserted backwards. Check the pinout on the datasheet.
Your transistors might be P-channel instead of N-channel. Check the datasheet.

One of my motion detectors does not trigger or has many false positives.

If the bottom stairs sensor does not work well, first I suggest swapping the top and bottom sensors to make sure you don’t have a bad sensor. Same behavior after swap means the wire to the bottom sensor needs to be thicker or the bottom of stairs need an environment change to accommodate the sensor, like a reflector on the other side of the step. Different behavior after swap means you have a bad sensor.

Problems Encountered

My choice of female headers as connectors for the LEDs was really bad. The headers are very secure, however all the wires are exposed and it is hard to place one in the middle. Other than that and the point-to-point soldering, I really did not have any problems.

Potential Improvements

Like stated in the video, I would have improved these things:

  • Use constant-current LED drivers
  • Add second override switch
  • Feature: first step always on at night
  • Route PCB with FTDI, ISP or Arduino socket on it.
  • Made duty cycle vary exponentially with brightness to cancel out the logarithmic perception of brightness. I almost did this, but the effect was not noticable enough for me to spend a lot of time on it. I left it in the code as a large array. (it should be placed in program memory)


Screen Shot 2013-07-29 at 1.21.40 PM

I accomplished the objective of lighting up the stairs as well as adding some extra features like daylight detection. After a long time, I finally completed the documentation and edited together the film I captured so long ago! I feel accomplished.

Success Stories

People like you and me have succeeded in banishing the darkness! Publish a video to YouTube, link to it in the comments, and I will showcase it here. Include a link to this page in your video.

Boštjan Perme 2017-02-27

Joshua Mauldin 2016-10-16

troysbucket 2014-11-25:

Screen Shot 2015-10-18 at 15.00.08

msvetec 2015-10-04

stairs lights demo

SG 2015-12-01

sample stairs lights

Gökhan ÜNAL 2021-07-05


567 thoughts on “How to Assemble Stair Lights

  1. tcarnal

    Hi Andrew,

    thanks for designing and programming this awesome unit.
    Ive build two but had some issues with the PIR’s (due to the environment)

    Ive tried to solve this with other sensors GP2Y0A21YK0F
    the Work awesome but just up to 25 centimeters
    The problem lies in that the analog voltage out will range from 3V when an object is only 4″ (10 cm) away and 0.4V when the object is 32″ (80 cm) away.

    Unfortunately the Arduino has High on its input only when 3v is send to it.

    Im trying to read the code, and can read some of it, but i have no arduino experience and its and couldn’t quiet get it unfortunately.

    Could you spare me some thoughts?


  2. Rainer Spuul

    Hey Andrew. What do you think, is it possible to use these laser switches to trigger the lights:

    My stairs lights are working well but there are still issues where sometimes they wont trigger to movement and sometimes they trigger themself. So i’m in search of better triggering system.

    Thank you!

    1. Andrew Post author

      Yes it is possible. If you know how to wire up the photoresistor such that it produces a high/low for the microcontroller and you run a wire to the other side of the stairs for the laser then it will work.
      My PIRs work fine if I angle them downward. No false triggers and they trigger every time.

  3. Danny Graham

    Would it be possible for you to contact me through email….? I am getting the Brightness not declared in this scope error. I have read EVERY comment and your answers just to familiarize myself with ALL the issues identified with different experimenters and tried all the suggested remedies for this issue with no luck. From my conjecture, it seems the Arduino IDE is looking for a “brightnessSM.h” file for a library, but I have none in the unzipped collection of files. Is it possible that the “brightnessSM.ino” has to be pasted into the Stairs_Shift.ino and declared as an .ino?
    Thnx, Danny

      1. Danny Graham

        Yes….I opened everything that was showing in your screenshot and it finished compiling without error. Having that brightness.ino open while attempting to compile wasn’t mention in the workflow. If it was…I must have missed it. Working with known to unknown approach, I had the suspicion that the compiler was looking for code from that .ino
        Thanx for the reply….now I just have to build the board.
        Stay tuned….I know about as much about Arduino as I do brain surgery, so this may turn out to be a painful experience.

  4. Danny Graham

    P.S. I’m sure it will be worth the pain…your project looks so cool it ain’t funny!! Additionally, it appears looking at the schematics that is can be tweaked to add quite a few other options as well.

  5. Danny Graham

    Just to clarify….the board you have designed appears to accommodate up to 16 steps or channels. Is editing Line#22 to express the exact number of channels desired the only thing that needs to be done to utilize all 16?

    Thnx again, Danny

    1. Danny Graham

      One last question for the time being until I get the board built and the Pro Mini ready to program……
      Is it possible to adjust + and – the time between when the first LED comes on/off and the successive ones after that? Looked thru the code and can’t discern where the timing is specified.
      Thnx, Danny

      1. Andrew Post author

        Yes it’s possible, but not by adjusting one variable. I did not have adjustment in mind when I coded it. I’m working on a new version that allows it to be changed but it’s not ready yet.

      2. Danny Graham

        Mr. Andrew…Would it be possible to update the color image of the circuit board on this web page that illustrates the top and bottom traces in red and blue to Ver: 1.3?
        When I print the Eagle prints, the silkscreen obscures the traces that include the 7805 and caps that are on the project image site where the newer board file is downloadable. Or define point to point connections where the regulator and caps are incorporated into the existing color image or even a pencil line drawing of the addition to the 1.1 schematic?
        Sorry to pester…at work stoppage at this point until clarified.
        Thnx, Danny

  6. speed57

    Hi Andrew. I designed your PCB board accommodate my needs, but I have one problem though which is 1.3v you mentioned that voltage regulator and cap is mandatory. So I could not find it on your schematics. Can you able to share your 1.3 version schematics?
    That would be huge help.
    Thank you in advance.

  7. Danny Graham

    I see. Well, is it worth building the project the way it is currently or will the “new & improved” be coming out soon enough to be worth waiting for instead?
    And…how did you learn your coding skills?

    1. Andrew Post author

      The new version will come out in maybe a month and cost a lot more but it will be targeted toward people who don’t want to solder. I would just make it now and replace the code that adjusts the brightness. You’ll like it more.

      I learned from my high school teacher! =)

  8. Danny Graham

    Well…I must say…it is quite a gift….I am just beginning to dabble in it. Would also like to be able to do PIC programming as well. However, for an old fart like me…the learning curve seem overwhelming.

    1. Andrew Post author

      This is a nice and friendly beginner project to introduce you to the world of Arduino. Props for learning at “old fart” age. My parents dont learn anything new anymore.

      On Mon, Feb 26, 2018 at 6:34 PM, Speedy Signals wrote:


  9. Danny Graham

    Just curious…what other projects have you published? I’ve looked through all your archives and didn’t see anything on par with this stair light project.

    1. Andrew Post author

      Did you check out the Electronic door lock project? It has a video too. To be honest I haven’t published much more because it takes weeks to make a video and I’m not sure what projects people want to see.

      On Mon, Feb 26, 2018 at 8:32 PM, Speedy Signals wrote:


    1. Andrew Post author

      It won’t happen any time soon. Try writing it yourself. That’s one purpose of this project. To help you understand basic timing code.

      On Thu, Mar 15, 2018 at 10:36 PM, Speedy Signals wrote:


  10. Amila

    I like your lighting system and i just want to build one too
    Can you please tel me what Arduino pro mini version should i buy and do you have any new PCB board design or i can use the V1.3
    Thanks in advance …

    1. Andrew Post author

      Buy a 16MHz 5V Arduino pro mini. I have a newer PCB, v7.0, but it costs about $100 and it is fully assembled instead of the current v1.3 board that you have to buy and assemble yourself. The new PCB has no documentation yet and is not online, and it only works with 16 steps max. If you are interested, I can produce more documentation and ship you one for $100 and you can be an early access user. Or you can just order v1.3, which several people have used at this point.

      1. Amila

        Thanks your feed back but i need 20 steps other wise it not nice with my staircase. Can I modify your PCB with extra 74HC595 Shift register and increase the steps count ? Is it possible?

      2. Andrew Post author

        It is possible but you will also need 4 more MOSFETs to go with the shift resisters. See the schematic for how to chain them.

  11. Amila

    One more i have 20 steps in diagram it show only 16 led . can i extend it easily to 20 steps
    is it same as PCB board design

    1. Andrew Post author

      It’s not very easy to extend it to 20 steps. You’d have to edit the EAGLE file and fabricate a new PCB with OSH Park. The existing PCB will not work.

  12. Pingback: Stairs Lights Kit is ready to be commercialized! | Speedy Signals

      1. Martin

        Hi Andrew, I have tried to load the code to Pro Micro, but I constantly get an error. Even when I try to compile the code with Leonardo (bootloader for micro) I get an error that it is not compatible with this board. I have checked the bootloader on the board and everything is OK. Do you have any idea what could be wrong. Is there some changes that needs to be changed in the code itself?

  13. Fred

    Hello Andrew

    After a year of good lighting of my stairs, the lights are constantly lit.
    I replaced the motion detectors because I thought a false positive but it did not change anything
    I also changed the arduino the result is the same.

    You or the community would have a track to solve this dysfunction?

    thank you in advance


    1. Andrew Post author

      If you unplug and plug in the circuit, does it fade on and off? If so then the main circuit still works and there is a peripheral malfunction. It could be the override switch. Did you plug those in?

      1. Fred

        Hi Andrew, sorry for the time of response but my lighting system of my stairs is given to it works alone. I preferred to test a few days before drawing conclusions. yet it did not work for several days before I did tests and I contacted. I do not complain it works 😉 thank you again you were really the person who allowed me to make this staircase !! Thank you !

  14. Trevor

    Hi Andrew, hope you’re still following this thread and are well. Due to the current pandemic, I decided to continue with this project after buying the boards back in 2015. Ive almost finished now and will be posting the results. Can I ask, after setting the new light level by adding the serial command in the loop() section, is it wise to remove the line, in other words, clean up the code before commissioning the project. Regards

  15. MADHAV

    Hi Andrew, hope you’re still following this thread and are well. I want to complete this project since i left. so,when i tried to compile this code it shows brightnessSM not i rectify this error.I am using arduino ide version 1.8.10 and also i want to complete for 23 stairs so i have to just edit line no 22 and increase the circuit diagram…..?

      1. madhav

        thanks for the reply and one more thing i have to make for 23 steps so what i have to change in the code.

      2. madhav

        thanks once again and last question do i have to increase no of 74hc595 ic in order to increase steps and what is registers in code do i have to change also…? if i am not wrong here registers refers to no of 74hc595 ic used in circuit.

  16. Jan

    Hi Andrew , i like your project very much , i all ready have a led controller but yours is more compact then mine. I orderd the pcb and all the parts , i solder the parts on the pcb and programmed the arduino mini. All went well but , i turn the power on and the led’s start with flikker ing and then burn constant. What did i do wrong ? I used V1.3 pcb , i made no changes in the file. Can you help with this ? O perhaps someone who made it with succes.

      1. jan

        Wow thanks for the fast reply , i did not now if it whas still active.

        I have checked the board but cant find a bad spot , i will remove the parts of this pcb ( i have 10 pcb’s ha ha ) and solder a new one. If it does the same i come back with pictures. I assume i dont have to change anything in the sketch if i use it for 8 stairs ?

        Best wishes to all and a corona free 2021.

      2. Andrew Post author

        The PCB will work without anything soldered to the “SWITCH” contacts. Try turning it on without anything there. And share a video of the behavior because I’m not sure what “flickering” means.

      3. jan

        What i mean with flickering is , when i power up the board the led’s go on and off realy fast and then they just stay on.

  17. Emily

    Hi! I am attempting this project and each step is taking me a long time as I am a true novice. Anyway, when powering up the printed circuit board, the transistors caught fire. Should I get a voltage reader and confirm the electrical output? I’m wondering if the voltage is higher than advertised for the lights I purchased. Any other suggestions? Thanks

  18. PursuitOFmonday

    Hi! I love your tutorial. I had a question. The first attempt to power the circuit, a transistor caught flame. Do you have any recommendations? Has anyone used a fireproof project box? Should I verify that my volt output is as advertised on the product labels for the LED strips I purchased with a voltage meter? Thanks for reviewing?

    1. Andrew Post author

      If the transistors caught fire then you may be using them above their maximum current limit. Or you inserted them backwards. or both. Make sure the source and drain are inserted correctly. I put little S and D on the circuit board for that purpose. Take a photo with the transistor part number showing and I’ll verify it.

  19. PursuitOFmonday

    We have another issue. We removed the transistors, and yet the lights still turn on. Did we create a short? Before removing the transistor, we tried using a new transistor in the alternative direction (reversal), and then the lights never went off. Initially, We followed the schematic diagram to determine order for the transistor. The transistor has a round side and a flat side. Should it be aligned with the rounded sides on the circuit board, or is it reverse? Thank you for your review.


Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s