harsha123456
Published

🎼🎹Mini Piano🎹🎼

Building a miniature piano using Arduino UNO. The 8 customizable buttons allow you to play any frequency and tone u want.

IntermediateFull instructions provided2,009
🎼🎹Mini Piano🎹🎼

Things used in this project

Hardware components

Arduino UNO
Arduino UNO
×1
Solderless Breadboard Full Size
Solderless Breadboard Full Size
×1
Tactile Switch, Top Actuated
Tactile Switch, Top Actuated
×8
Buzzer, Piezo
Buzzer, Piezo
×1
Resistor 10k ohm
Resistor 10k ohm
×8
Jumper wires (generic)
Jumper wires (generic)
×11
9V battery (generic)
9V battery (generic)
×1

Software apps and online services

Arduino Web Editor
Arduino Web Editor

Story

Read more

Schematics

Circuit Diagram

Mini Piano Schematics

Code

Code

C/C++
Refer to this for the CODE of MINI PIANO
int pb1 = 2;
int pb2 = 3;
int pb3 = 4;
int pb4 = 5;
int pb5 = 6;
int pb6 = 7;
int pb7 = 8;
int pb8 = 9;

int buzz = 13;

void setup()
{
  //declare the pushbutton pins as input
  pinMode(pb1,INPUT);
  pinMode(pb2,INPUT);
  pinMode(pb3,INPUT);
  pinMode(pb4,INPUT);
  pinMode(pb5,INPUT);
  pinMode(pb6,INPUT);
  pinMode(pb7,INPUT);
  pinMode(pb8,INPUT);
  //declare buzzer pin as output
  pinMode(buzz,OUTPUT);
  
}

void loop()
{
  // read the value from pushbuttons
  int C = digitalRead(pb1);
  int D = digitalRead(pb2);
  int E = digitalRead(pb3);
  int F = digitalRead(pb4);
  int G = digitalRead(pb5);
  int A = digitalRead(pb6);
  int B = digitalRead(pb7);
  int C2 = digitalRead(pb8);
  
  if( C == 1 ){
     tone(buzz,262,100);//C,Do,sa
  }
    if( D == 1 ){
     tone(buzz,294,100);//D,Re,re
  }
    if( E == 1 ){
     tone(buzz,330,100);//E,Me,ga
  }
    if( F == 1 ){
     tone(buzz,349,100);//F,Fa,ma
  }
    if( G == 1 ){
     tone(buzz,392,100);//G,So,pa
  }
    if( A == 1 ){
     tone(buzz,440,100);//A,La,da
  }
    if( B == 1 ){
     tone(buzz,494,100);//B,Te,ni
  }
    if( C2 == 1 ){
     tone(buzz,523,100);//C,Do,sa
  }

  delay(10);
  
  
}

Credits

harsha123456
1 project • 1 follower
Contact

Comments

Please log in or sign up to comment.