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


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


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 )

Twitter picture

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

Facebook photo

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

Google+ photo

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

Connecting to %s