Piano Staircase




About: I love to learn,build and design.....

As you guys know April 1st was celebrated as " ARDUINO DAY" and it was a celebrated in our college by conducting various events and workshops.It was a very special day for me....

Since i was very interested in Arduino,I was given an opportunity so that students should be attracted,involve and have fun......I really thank all the people who supported and believed in me....

Here i will be explaining about methods i have applied in making this fun filled project....

what will be discussed here...

1) Research on components (Here there will be alternatives for the components)

2) Electronics...connections...

3) Arduino code

4) Processing code

Teacher Notes

Teachers! Did you use this instructable in your classroom?
Add a Teacher Note to share how you incorporated it into your lesson.

Step 1: Things Used for This Fun Project

• Arduino UNO
• Processing 3 software
• 6 X Ultrasonic sensors-----(6)
• External speakers------(desktop speakers optional)
• Jumper wires
• Breadboard------(initial testing)

Let's get started.....

Extra parts which will be using for final prototype...

• Screw terminals
• Wires really long it depends on length of the stairs

Step 2: What Is Piano Stairs?

Piano staircase is basically and interactive interface which sounds with different tones when you step on stairs one by one...

Piano staircase is basically an application that plays specific audio files when sensor is triggered.

According to my analysis, the act of stepping on steps can be transferred to micro-controller using sensors...

1) Using LDR for each staircase but the disadvantage is there will be huge amount of work to calibrate and not preferred stairs exposed to sunlight.

If you guys are interested in doing this project using LDR here is the link of Instructable

2) Using contact type on each stair like switch with completes the circuit and gives a signal to micro-controller

3) Using IR sensors(low cost) it has very short range and cannot be calibrated according to distance and it interacts differently with different colors.

So this made me ended up using 'ULTRASONIC SENSOR' which simply detects any obstacle in front of it using time required to receive the sent ultrasonic pulses...

Step 3: Implementation and Working (Using One Ultrasonic Sensor)

These piano stairs use a Ultrasonic sensor for each stair. There should be flat surface on one side of the stair, the ultrasonic sensor on the other. In this setup, the Arduino reads from the sensors and passes the values to the processing software serially which plays the sounds from the audio files attached to the processing code.

  1. Connect the sensors to Arduino as shown in above image.
  2. Make sure that if you are using digital pins ultrasonic uses trigger pin for transmitting ultrasonic waves and echo pin to receive (PWM pin of Arduino)
  3. Data received is passed through usb cable connected to Arduino uno and computer

***Since I am contesting on INVENTION please show your support by Voting***

Step 4: Arduino Code and Processing Code for One Sensor

If you are new to Arduino download the Arduino compiler i.e ide from the link here---Arduino IDE

And processing ide can be downloaded from here---Processing IDE

Here is the arduino code for one sensor only for initial understanding of program


(Make sure that header file is in same folder)


(Make sure that all the files provided here should be in one folder)

Once we have uploaded the code to Arduino UNO, we will be able to see a data in the serial monitor.(Exit from the serial monitor while using processing)

First, download Processing IDE from Processing official website.as i have given the link above and then install the contributed library “Minim” in Processing IDE.

After that, reboot your computer just to make sure the library is detected by Processing....

I have provided some of the piano notes you can change them as you like...

That's it turn up the volume.....

I choose processing because, since output of microcontroller is in digital it should be converted to analog to sound like(to power speaker) piano and we will be needing musical shield and this costs more instead we can use soundcard of computer and make it hear more natural...

***Since I am contesting on INVENTION CONTEST please show your support by Voting***

Step 5: Now Its Time for 6-sensors

  • If you are planning to add more sensors use analog pins for echo pins input to arduino


(Make sure that header file is in same folder)


(Make sure that all the files provided here should be in one folder)

Once we have uploaded the code to Arduino UNO, we will be able to see a data in the serial monitor.

it should look something like this 223,234,245,233,220,277

You can see there is lots of lag this can be reduced as i kept boxes is to reduce the range this is because it reduces the time required for reception of ultrasonic waves....

And this may look 93,97,95,94,99,93,98

The threshold for detection of obstacle or till where the sensor should detect can be changed using the line which i highlightined in processing image.

In case peeps you find an error in any sort of time just leave a comment i will definetly go through it...

Step 6: Wire Up Everything

Firstly take the measurements of the steps.This is really important since we should not be wasting wires or run short

As shown in above image distance between the steps was 45cm and since we are placing sensors in between the stairs the length between each sensors will be 45cm(approx)

Calculations for wires:(according to image)(from the arduino uno)

45cm =1.5feet

(For 6th sensor)6 stairs X1.5 feet=9feet wires required

(5th sensor) 5th stairX 1.5feet=7.5feet

(4th sensor)4 stairX1.5 feet=6feet

(3rd sensor)3 stairX1.5 feet=4.5 feet

(2nd sensor)2 stairX1.5 feet=3 feet

(1st sensor)1 sensorX1.5 feet=1.5feet

Each sensor has trig pin and echo pin which should connected to arduino uno so all the calculation above should be multiplied by X2.

And VCC and ground is connected in parallel.

I soldered all the wires to the sensor and connected to screw terminals other side of terminal was jumpers which will be easy to connect to arduino uno.(Image is provided)

Setup sensors on the one side of wall (i used double sided tape) and tape up the running wires,and like i have said to prevent lagging i used boxes.

Make your own piano stairs for college fests, or as fun project at your home...


***Since I am contesting on INVENTION CONTEST please show your support by Voting***

***Also share it with your friends***

See you at my next instructable !
Thank you

Adithya Pai P

Microcontroller Contest 2017

Participated in the
Microcontroller Contest 2017

Be the First to Share


    • Made with Math Contest

      Made with Math Contest
    • Multi-Discipline Contest

      Multi-Discipline Contest
    • Robotics Contest

      Robotics Contest

    49 Discussions


    1 year ago

    great job
    i have problem .. i upload "1-sensor\arduino code\Sensor\Sensor.ino" to arduino mega , upload success but file dosnot work

    but when i RUN the code "1-sensor\piano_sound\aaa\Play_sound_h\Play_sound.pde"
    it is play very well on my computer but i can not upload it to arduino

    i dont have any expernce with arduino ..
    what can i do ??

    2 replies

    Reply 6 months ago

    .pde is just for arduino processing it cannot be uploaded


    Question 7 months ago

    how to connect the music shield with arduino


    1 year ago

    Thanks very much, how can we add more sensors. for example 20 or 30 sensors, is it possible?

    3 replies

    Reply 1 year ago

    You can use analog pins also which are remaining but if you need to connect more I suggest arduino MEGA which has more pins...


    Reply 1 year ago

    Hi, I tried to use MEGA 2560, AS I am using Music Shield I can just use pins number 14 to 53 I changed the values in sensor class to pin number but it always returns 0, is there anything which I am doing wrong?when I connect sensor to pin 9 and 10 it works fine


    Question 1 year ago on Step 4

    Hello. My school is trying to make these for a set of stairs. We are having issues with the coding. Could you possibly provide a more in-depth tutorial on the coding portion? Thanks!

    9 answers

    Reply 1 year ago

    I am little bit busy to make a different tutorial on it.....If you have any doubt in specific line in code let me know here......


    Reply 1 year ago

    thanks, in fact I have another problem, in this tutorial you have used your pc to play sounds. what if we want to play it directly using Ardinu and use an external amplifier? is it possible?


    Reply 1 year ago

    I think its cost effective and it should work....


    Reply 1 year ago

    Thanks very much, the problem will appear when I want to add more stairs and also this shield, it seems I must switch to Mega, also I noticed about this hint:Note : Limited by the transmission speed and memory shortage, Arduino boards like UNO and Leonardo can neither play WAV files, nor use the recording function. NUCLEO or Due are recommended. does it make any problems while playing?


    Answer 1 year ago

    Im not exactly sure what it is. We've followed the tutorial but we are having issues getting the Arduino IDE and the Processing IDE to "talk" to each other. Any tips?


    Answer 1 year ago

    I am little bit busy to make a different tutorial on it.....If you have any doubt in specific line in code let me know here....