Piano Stairs with Arduino and Raspberry Pi
Who doesn’t love music? These Piano Stairs are an interactive, relatively portable, musical installation that can be applied to basically any stairwell. I built them for HackPrinceton and won 2nd place in the hardware track. I’ve had requests to share my code and diagrams, so I decided to make an Instructable!
These piano stairs use a light-based “tripwire” for each stair. The light sources should be on one side of the stair, the photoresistors on the other. In this setup, the Arduino reads from the sensors and passes the values to the Raspberry Pi, which generates the sounds.
What you need, assuming six stairs:
6 resistors, 1000 ohms each
6 light sources: I used flashlights, you can use bright LEDs
1 standard speaker set, w/ audio cable
1 Arduino Uno
1 Raspberry Pi
Step 1: Learn to read a light sensor from the Arduino
You’ll want to follow Adafruit’s photocell tutorial for this.
I suggest that you first get your basic light sensor circuit set up, using a breadboard and an Arduino, so that you understand how the basic light sensing works. The image for this step is the basic diagram you’ll need. Come back once you can read a photoresistor using your Arduino!
Step 2: Solder your photoresistor circuits
OK, now that you understand the basic idea, we need to solder 1 photoresistor circuit per step of the staircase. I’m assuming 6 steps here. You’ll want 1 sensor per step, with them all connecting at the bottom of the stairs.
Now, for each photoresistor, you’ll want to do the following:
I found it useful to use cardboard backing to keep the photoresistors stable. Stick the legs of the sensor through and tape them in place with electrical tape.
Solder one short ground wire to one leg of the photoresistor.
Solder one “power” wire to the other leg. This wire should be long — based on the height of the stairs, and which stair this sensor is for. It should reach all the way to the bottom of the stairs.
Mark the stair number on the piece of cardboard, and tag the end of the power wire with the stair number as well (using masking tape and a marker). This will help you later.
Step 3: Solder the ground wire, connect everything to the Arduino
Now, take a really long wire, strip it in appropriate places, and solder each short ground wire to the long ground wire. Plug this into your Arduino’s ground pin (labeled GND).
Connect a wire from the power output pin of your Arduino (5V) to a power row of your breadboard.
For each “power” wire from a photoresistor circuit, connect it to some unused rown in the breadboard. Also to row n, connect a wire to analog pin n on the Arduino. Finally, connect a resistor from row n to the power row of your breadboard.
This should be practically identical to the basic photoresistor circuit you built earlier! It’s just 6 of them on one breadboard.
Make sure to connect the wires in a logical order. E.g., stair 1 should go to Pin 1, stair 2 to pin 2, etc. Otherwise your notes will be out of order.
Step 4: Setup the staircase
Masking tap, twist ties, flashlights; this is when you can actually set stuff up. Tape each piece of cardboard to one stair. Across from it, position a flashlight so that the light beam falls directly on the photoresistor.
For more detail: Piano Stairs with Arduino and Raspberry Pi
We recommend EasyEDA for electronic circuit design.
From Schematic Drawing to PCB Production, Just Need One Tool
Cheap PCB Prototype: 10 pcs 2 layers only $10, quick delivery, 100% E-test