Arduino Piano With Corresponding LED

by 770338 in Circuits > Arduino

23 Views, 0 Favorites, 0 Comments

Arduino Piano With Corresponding LED

Capture.PNG
aaa.png

Hello! This is a tutorial on how to make a simple Arduino Piano!!

I was inspired to make this project because of another project in which we controlled a RGB LED with a potentiometer (Project is the second picture).

In this tutorial you will be learning on how to wire a the breadboard and what components should be used.

Good luck on your Arduino journey!

Supplies

The supplies needed for making this arduino piano are:


  1. Breadboard
  2. Arduinon Uno
  3. (7) Pushbuttons
  4. Wiring
  5. Piezo Buzzer
  6. Yellow Led
  7. (1) 330 Ohm resistor

Adding Pushbuttons and Basic Wiring

Yooo.PNG

The first step would be to add the pushbuttons on to the breadboard, So we can use these buttons as input devices for the piezo buzzer. After adding the buttons connect the left side of the button to ground and the right side of the button should be connected to the Arduino digital pins.

Adding the Piezo Buzzer

laq.PNG

To add the Piezo Buzzer you need to connect the negative pin of the buzzer to ground. After connecting that pin to ground you need to connect the positive pin to the Arduino digital pins. For these pins you can choose whatever pin you want just make sure to edit the code. What the buzzer does is it creates the sound for the arduino piano.

Adding the Led

kk.PNG

In this step you have to add the LED. As soon as you add the LED you should add a 330 Ohm Resistor to the Cathode of the LED. After adding the resistor you should add a wire connecting the LED's anode to the digital pins of the Arduino. Make sure to connect positive and negative wires to each power and ground in the arduino.

Adding the Code

code.PNG

Congratulations! you have made your Arduino Piano!! There is one last step the and it might be regarded as the most important. This is the code.

#define T_C 262

#define T_D 294

#define T_E 330

#define T_F 349

#define T_G 392

#define T_A 440

#define T_B 493



const int C = 7;

const int D = 6;

const int E = 5;

const int F = 4;

const int G = 3;

const int A = 2;

const int B = 9;



const int Buzz = 11;

const int LED = 8;



void setup()

{

 pinMode(LED, OUTPUT);

 pinMode(C, INPUT_PULLUP);

 pinMode(D, INPUT_PULLUP);

 pinMode(E, INPUT_PULLUP);

 pinMode(F, INPUT_PULLUP);

 pinMode(G, INPUT_PULLUP);

 pinMode(A, INPUT_PULLUP);

 pinMode(B, INPUT_PULLUP);



 digitalWrite(LED, LOW);

}

This is basic void set up code so the rest your going go have to find out on your own!

Just upload this onto your arduino and you should be fine!!

Make sure to change the pins in the variable if your circuit is wired differently.

A Demonstration

Arduino Project