Congratulations! You should have a working set of piano stairs.





Troubleshooting tips:

You can hit the red “reset” button on your Arduino to recalibrate the light thresholds. Make sure nobody is on the stairs, and that the flashlights are turned on, when you do so!



FAQ



Isn’t it wasteful to use an Arduino and a Raspberry Pi? Why do you need both?

Yeah, it is, but I did this for a hackathon and this is what I had on hand! You could use an Analog to Digital Converter (ADC) and a Pi Cobbler Breakout Board in order to replace the Arduino entirely. (The RPi only has digital pins, alas, so you need an ADC — but that’s cheap.) Hopefully I’ll have an updated version posted soon, because I have an ADC coming in the mail.



This code is crap!

I’m supplying the code I used in the hackathon, so it’s a bit messy. I’m waiting to clean it up until I can switch to using an ADC and get rid of the Arduino entirely.



Can I expand the # of stairs?

Right now I’ve maxed out the number of analog pins on an Arduino. So yes, you could, and that would be awesome, but would require significant modifications.



Why flashlights?

You could also try using LEDs, or infrared sensors. But you need some kind of light source so that you can clearly differentiate, say, a sneaker, from just a shadow on the staircase.







