DIY Keyless Piano
Hello friends I am Dushyanta and today I am here to tell you how to make a Keyless piano. So as from the name you can get a fair idea about it. It is like a simple piano which does not have any key. In a normal piano or musical keyboard, you have to press the key but in this you only have to wave your hand above it and it will play the seven musical notes. It is for both, electronic lovers and piano lovers. If you are new to Arduino and looking for a interesting Arduino project, then it is surely for you. This piano is unique and I am sure that you will enjoy when you will play with it.
A lot of parts are not required for this keyless piano. You only need proximity sensors, Arduino and a speaker. The circuit diagram and Arduino sketch is also very easy. You also don't require high level electronic knowledge for it just basics. Follow the steps carefully and you will easily make this piano.
Gather Parts
Parts required to make this instructable are very cheap and are easily available on all electronics store. You also dont require a lot of parts like others. You can get them in your local electronic stores. You can also get them on radioshack and ebay. Here are the part list:
- Arduino board( I used Arduino UNO)
- 8 X Proximity sensor
- LM386
- 5K potensio
- 1K potensio
- 100uf electrolytic capacitor
- 2 X 0.01uf ceramic disc capacitor
- 220uf electrolytic capacitor
- 10ohms resistance
- 8ohms speaker
- PCB
- Jump cables
- Female header
- Cardboard or hardboard
- 12V battery
- Adapter jack(to power your arduino board)
- Slide switch
- Wire
TOOLS:
- Soldering iron
- a cutting tool(to cut hardboard)
- Hot glue gun or double sided tape(for attaching things to the base)
- Wire cutter
- Plier
Making the Board
For attaching the Arduino and proximity sensor you will need a base. Base can be of any material instead of metal. I used a hardboard for making the base. Cut the hardboard or cardboard of appropriate size in which all your proximity sensors, your Arduino board and your amplifier can easily be placed. Before cutting the hard board make dimensions on it because it will make your work easier. For look, you can paint your board as I have done. I painted it black but painting it with different colors will definitely increase its beauty. Apply some tape on the edges and sides of the hardboard so that they don't get rough.
Attaching the Arduino Board
After coloring the board, we will attach our Arduino to the base and for that I am using double sided tape. You can also use hot glue gun but I don't like to use hot glue gun a lot especially in case of Arduino. You can also attach a breadboard if you want but I am not doing so.
The Proximity Sensor
The sensors used in this piano are the infrared proximity sensor. They are used in many gadgets almost every. They are used in your smartphones, laptop etc. The sensor used in washroom for automatic flush is also infrared proximity sensors. Working of infrared proximity sensors is very easy. When the sensor is powered, IR emitter led starts emitting IR rays. When any obstacle comes in front of these IR rays, they bend back and are received by the photodiode present in the circuit. If any signal is received by photodiode, output of proximity sensor goes high(5V) but if it does not receive any signals, output of proximity sensor goes low(0V). Their is an OP-amp IC present in the circuit. It converts the signals coming from the photodiode to HIGH or LOW.
Now we have to attach the sensors on the hardboard in such a way that when we place our hand above the sensor, it should detect our hand and for that you have to follow the given steps:
Step 1: With the help of a Plier, bend the pins of photodiode and IR emitter at a angle of 90 degree upward.
Step 2: Stick double sided tape on the backward side of the proximity sensors.
Step 3: Attach the proximity sensor to hardboard.
After you have completed the above steps, the photodiode and IR emitter will form a angle of 90 degree with your hardboard. Keep enough distance between each proximity sensor so that when you place your hand above the sensor, it should not be detected by the side sensors.
The Proximity Sensor (Part 2)
After attaching the proximity sensors to the board, we will connect all the sensor together and to do so you have to follow these steps:
Step 1: Cut the female header in eight pairs such that in each pair, three male headers can be fitted.
Step 2: Place all the headers in the proximity sensors.
Step 3: With the help of a soldering iron and rainbow cable, connect vcc pin of all the proximity sensors together. Solder a jump cable on the vcc pin of the first sensor.
Step 4: Also connect gnd pin of all the sensors together. Solder a jump cable on the gnd pin of the first sensor.
Step 5: Solder one wire on vout pin of all the sensors that will be the output of every sensor.
Checking the Proximity Sensor
Before moving to the next step, it is good to check that all your proximity sensors are working perfectly. Checking the sensor is not a very tough process. To check your sensor what you have to do is to connect vout pin of the sensors one by one to the analog pin A0 of the Arduino board. Connect vcc pin of the sensor to 5V on Arduino and gnd pin to gnd . Upload the code given below and open the serial monitor on your PC. Move your hand towards the sensor and if led starts glowing on the proximity sensor and you see any value above 0 on the screen, then your proximity sensor is working perfectly.Here is the code
*********
//code to check the proximity sensor
//made by Dushyanta
int recv=A0;
int value=0;
void setup(){
Serial.begin(9600);
}
void loop(){
value=analogRead(recv); //converting the voltage into value coming from the proximity sensors Serial.println(value);
delay(1000);
}
**********
Making the Amplifier
While playing the piano, you will notice that the sound produced by the speakers is bit low. That is why I prefer you using the speaker with a amplifier. You can also use a piezo buzzer but according to me, piezo buzzer does not make sound but only noise. I have given a circuit diagram in the photos above. You can use the amplifier of your own. You can also use your desktop speakers. If you don't want to make amplifier, you can simply use a 8ohms speaker but its sound is bit low. Make the amplifier in a PCB or breadboard whichever you prefer and use a 8 pin IC holder for LM386 because when your IC will get damaged, you can easily replace it. When you have done, check all the connections and proceed to next step.
Upload the CODE
Here is the code for the keyless piano. The code is very simple and you can easily understand it. If you can make modification in this code, please do so and tell me also about it. Feel free ask to anything about the code. Here is the code:
***************
//code for keyless piano
//made by Dushyanta
int c=3; // initializing the pins
int d=4;
int e=5;
int f=6;
int g=7;
int a=8;
int b=9;
int cup=10;
int c_state=0;
int d_state=0;
int e_state=0;
int f_state=0;
int g_state=0;
int a_state=0;
int b_state=0;
int cup_state=0;
int speaker=12;
void setup() {
pinMode(speaker,OUTPUT); // telling the board that which pin is used as output and which is used as input
pinMode(c,INPUT);
pinMode(d,INPUT);
pinMode(e,INPUT);
pinMode(f,INPUT);
pinMode(g,INPUT);
pinMode(a,INPUT);
pinMode(b,INPUT);
pinMode(cup,INPUT);
digitalWrite(speaker,LOW); //telling the state of pins
digitalWrite(a,LOW);
digitalWrite(b,LOW);
digitalWrite(c,LOW);
digitalWrite(d,LOW);
digitalWrite(e,LOW);
digitalWrite(f,LOW);
digitalWrite(g,LOW);
digitalWrite(cup,LOW);
Serial.begin(9600); //the sketch begins
}
void loop() {
digitalWrite(a,LOW);
digitalWrite(b,LOW);
digitalWrite(c,LOW);
digitalWrite(d,LOW);
digitalWrite(e,LOW);
digitalWrite(f,LOW);
digitalWrite(g,LOW);
digitalWrite(cup,LOW);
c_state = digitalRead(c); //converting the signals coming from sensor to HIGH or LOW
d_state = digitalRead(d);
e_state = digitalRead(e);
f_state = digitalRead(f);
g_state = digitalRead(g);
a_state = digitalRead(a);
b_state = digitalRead(b);
cup_state = digitalRead(cup);
{
if (c_state==HIGH) // checking in front of which sensor hand is there
{ tone(speaker,988); }
else
if (d_state==HIGH)
{ tone(speaker,880); }
else
if(e_state==HIGH)
{ tone(speaker,784); }
else if (f_state==HIGH)
{ tone(speaker,698); }
else if (g_state==HIGH)
{ tone(speaker,659); }
else
if (a_state==HIGH)
{ tone(speaker,587); }
else
if (b_state==HIGH)
{ tone(speaker,523); }
else
if (cup_state==HIGH)
{ tone(speaker,490); }
else
{ noTone(speaker); } //telling the arduino board that if their is not obstacle, their should be no sound delay(0);
}
}
********************
Downloads
Connecting All the Things Together
In the previous steps, we made connections in proximity sensors, checked them etc but now it time to finally connect everything together after which our piano will be ready. Circuit diagram is given the pictures but if you cant understand by it follow the steps given. Here are the steps:
Step 1: Connect Audio input+ of amplifier to pin 12 of Arduino. Connect Audio input- of the amplifier to gnd of Arduino.
Step 2: The jump cable soldered at vcc pin of first proximity sensor will go to 5V on Arduino board and the jump cable soldered at gnd pin of first proximity sensor will go to gnd on the board.
Step 3: Connect positive of amplifier to vin pin on Arduino board and negative of amplifier to gnd on the arduino board.
Step 4: Connect vout pin pin of first sensor to pin 3 on the board and vout pin of second sensor to pin 4 on the board and so on.
After connecting everything, stick the amplifier on the hardboard.
Battery
To power this piano you will need a 12V power supply or 9V battery. If you are using my amplifier then you have to power the Arduino board with 12V or 9V. Battery used by me is a 12V/1.3AH battery. Choose the battery according to your needs and connect the battery to Arduino board using adapter jack. It is good to connect a switch between the Arduino board and battery so you can easily switch on/off the Arduino. Using a lead acid battery is good because they are very very cheap. I bought this battery for about $6. Stick the battery on the hardboard if you want.
Checking
After completing all the previous step, here comes the most important step. This step will give you the result of all the hard work done by you. So for checking your keyless piano, connect the adapter jack to your Arduino and turn on the slide switch. Your Arduino will take some time to start up( about 5 to 10 sec) and after that your piano will be ready to use. One by one place your hand in front of each proximity sensor and check weather your Arduino is making correct notes. notes will be in increasing order (c,d,e,f,g,a,b,C). If everything works perfectly then your
Downloads
Done!!
Your keyless piano is now ready for use. Go play with it. Make songs with it and make nursery rhymes with it with a little practice. Have fun with it. Here are some little upgrades for this keyless piano:
- You can stick RGB led strip on the border of the hard board.
- With little more proximity sensors, you can make a big piano.
- You can add a sound recorder to it.
This is the END of this instructable and if you have any questions related to this keyless piano, feel free to ask. GOOD BYE.