Introduction: 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

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