Yumee ChangPenelope Casino
Published © GPL3+

Arduino Piano

An amazing soldered piano made from 3D printing, Arduino Nanos, and piezo buzzers!

IntermediateShowcase (no instructions)10 hours60
Arduino Piano

Things used in this project

Hardware components

Arduino Nano R3
Arduino Nano R3
×2
2-pin Push Button
×16
Buzzer, Piezo
Buzzer, Piezo
×1

Software apps and online services

Arduino IDE
Arduino IDE
Tinkercad
Autodesk Tinkercad
Bambu Studio

Hand tools and fabrication machines

3D Printer (generic)
3D Printer (generic)
Soldering iron (generic)
Soldering iron (generic)
Solder Wire, Lead Free
Solder Wire, Lead Free
Solder Flux, Soldering
Solder Flux, Soldering
Wire Stripper & Cutter, 18-10 AWG / 0.75-4mm² Capacity Wires
Wire Stripper & Cutter, 18-10 AWG / 0.75-4mm² Capacity Wires
+ Electrical wire
Hot glue gun (generic)
Hot glue gun (generic)
Tape, Double Sided
Tape, Double Sided

Story

Read more

Custom parts and enclosures

Piano Case Print

May need to adjust case plate to sit flat

Piano Keys Print

Print keys separately using desired colors

Schematics

first piano outline

Out first outline for what we waned 3D printed

Putting it all together

Happy Birthday!

Playing the piano

3D printed case

3D Printed parts

All the parts put together

Push buttons soldered

Push buttons soldered together to ground and attached to Arduino Nano

Attaching the parts together

Hot gluing them

Code

Code for Piano

C/C++
Includes both codes for the two separate Arduinos--alter code as needed.
#define C 2093
#define CS 2217
#define D 2400
#define DS 2500
#define E 2602
#define F 2745
#define FS 3010
#define G 3135
#define GS 3322
#define A 3520
#define AS 3729
#define B 3951

#define HC 4186.01
#define HCS 4435
#define HD 4750
#define HDS 4900
#define HE 5275

int noteDuration = 20;

int Note_A = A;
int Note_AS = AS;


int Note_B = B;

int Note_C = C;
int Note_CS = CS;

int Note_D = D;
int Note_DS = DS;

int Note_E = E;

int Note_F = F;
int Note_FS = FS;

int Note_G = G;
int Note_GS = GS;


int Note_HC = HC;

int Note_HCS = HCS;

int Note_HD = HD;

int Note_HDS = HDS;

int Note_HE = HE;




void setup() {
  pinMode (2, INPUT_PULLUP);
  pinMode (3, INPUT_PULLUP);
  pinMode (4, INPUT_PULLUP);
  pinMode (5, INPUT_PULLUP);
  pinMode (6, INPUT_PULLUP);
  pinMode (7, INPUT_PULLUP);
  pinMode (8, INPUT_PULLUP);
  pinMode (9, INPUT_PULLUP);

Serial.begin(9600);

}

void loop() {

  if(digitalRead(2) == LOW) {
    Serial.println("HIGH");
    tone (10, Note_C, noteDuration);
  }

  else {
    noTone;
    Serial.println("LOW");
  }


  if(digitalRead(3) == LOW) {
    tone (10, Note_CS, noteDuration);
  }

  else {
    noTone;
  }
  
  
  if(digitalRead(4) == LOW) {
    tone (10, Note_D, noteDuration);
  }

  else {
    noTone;
  }
  

 if(digitalRead(5) == LOW) {
    tone (10, Note_DS, noteDuration);
  }

  else {
    noTone;
  }
  
 
  if(digitalRead(6) == LOW) {
    tone (10, Note_E, noteDuration);
  }

  else {
    noTone;
  }
  
  
   if(digitalRead(7) == LOW) {
    tone (10, Note_F, noteDuration);
  }

  else {
    noTone;
  }
  

 if(digitalRead(8) == LOW) {
    tone (10, Note_FS, noteDuration);
  }

  else {
    noTone;
  }
  
  if(digitalRead(9) == LOW) {
    tone (10, Note_G, noteDuration);
  }

  else {
    noTone;
  }



}







/* Code for second arduino



#define C 2093
#define CS 2217
#define D 2400
#define DS 2500
#define E 2602
#define F 2745
#define FS 3010
#define G 3135
#define GS 3322
#define A 3520
#define AS 3729
#define B 3951

#define HC 4186.01
#define HCS 4435
#define HD 4750
#define HDS 4900
#define HE 5275

int noteDuration = 20;

int Note_A = A;
int Note_AS = AS;

int Note_B = B;

int Note_C = C;
int Note_CS = CS;

int Note_D = D;
int Note_DS = DS;

int Note_E = E;

int Note_F = F;
int Note_FS = FS;

int Note_G = G;
int Note_GS = GS;


int Note_HC = HC;
int Note_HCS = HCS;

int Note_HD = HD;
int Note_HDS = HDS;




void setup() {
  pinMode (2, INPUT_PULLUP);
  pinMode (3, INPUT_PULLUP);
  pinMode (4, INPUT_PULLUP);
  pinMode (5, INPUT_PULLUP);
  pinMode (6, INPUT_PULLUP);
  pinMode (7, INPUT_PULLUP);
  pinMode (8, INPUT_PULLUP);
  pinMode (9, INPUT_PULLUP);

Serial.begin(9600);

}

void loop() {

  if(digitalRead(2) == LOW) {
    Serial.println("HIGH");
    tone (12, Note_GS, noteDuration);
  }

  else {
    noTone;
    Serial.println("LOW");
  }


  if(digitalRead(3) == LOW) {
    tone (12, Note_A, noteDuration);
  }

  else {
    noTone;
  }
  
  
  if(digitalRead(4) == LOW) {
    tone (12, Note_AS, noteDuration);
  }

  else {
    noTone;
  }
  

 if(digitalRead(5) == LOW) {
    tone (12, Note_B, noteDuration);
  }

  else {
    noTone;
  }
  
 
  if(digitalRead(6) == LOW) {
    tone (12, Note_BS, noteDuration);
  }

  else {
    noTone;
  }
  
  
   if(digitalRead(7) == LOW) {
    tone (12, Note_HC, noteDuration);
  }

  else {
    noTone;
  }
  

 if(digitalRead(8) == LOW) {
    tone (12, Note_HD, noteDuration);
  }

  else {
    noTone;
  }
  
  if(digitalRead(9) == LOW) {
    tone (12, Note_HDS, noteDuration);
  }

  else {
    noTone;
  }



}

*/

Credits

Yumee Chang
3 projects • 0 followers
Penelope Casino
1 project • 0 followers

Comments