--> Project V - 15. Piano Sound using Arduino Uno | basic arduino tutorial

Thursday, August 10, 2017

Project V - 15. Piano Sound using Arduino Uno

| Thursday, August 10, 2017
Piano Sound using Arduino Uno




Push-on buttons that apply to the piano keyboard (but not as sophisticated as the real piano). When button 1 is pressed it will produce a low Do sound. While the button 2 tones Re, and setersunya. Sound is generated by connecting arduino output pin with speaker or buzzer.


Hardware Requirement
  • 8 Push Button
  • A Buzzer
  • Power supply +5 Volt
  • Jumper



                                Push Button (Source)                              Buzzer (Source)
Block Diagram


Schematic

Source Code/Sketch


void setup(){
for(char i=2; i<10; i++){
pinMode(i,INPUT);
digitalWrite(i,HIGH);
}
}
void loop(){
if(digitalRead(2)==LOW) tone(10,264); //Do
else if(digitalRead(3)==LOW) tone(10,297); //Re
else if(digitalRead(4)==LOW) tone(10,330); //Mi
else if(digitalRead(5)==LOW) tone(10,352); //Fa
else if(digitalRead(6)==LOW) tone(10,396); //Sol
else if(digitalRead(7)==LOW) tone(10,440); //La
else if(digitalRead(8)==LOW) tone(10,495); //Si
else if(digitalRead(9)==LOW) tone(10,528); //Do
else noTone(10);
}



How it Works

1. Connect the Arduino with Peripherals needed
2. Plug in the Power Source on the device
3. Compile and upload the script program above to your arduino

4. When button 1 is pressed it will produce the sound of the tone Do, while when the 2 button is 
    pressed it produces the sound of the tone Re, and so the tone will be sequential in accordance with 
    the scales.

Video for Project V - 15. Piano Sound using Arduino Uno






Required File


Related Posts

No comments:

Post a Comment