The Magical Mystery Piano

by YTheBuilder in Circuits > Arduino

57 Views, 1 Favorites, 0 Comments

The Magical Mystery Piano

Screenshot 2025-06-14 3.02.07 PM.png
Screenshot 2025-06-14 3.07.44 PM.png
....PNG
.....PNG

Hello everyone! My name is Yash and in this instructable, I will be showing you step by step, how to make a piano yourself and also presenting my final project. For this project, I have created a Piano. This idea came to my mind because I am really into music and love to play musical instruments. So I figured, why not make it with some hardware components and an Arduino. This is going to be a piano where when one of the buttons is pressed, a sound is played through the buzzer - the sound/musical note will vary based on the button pressed. Additionally, there will also be a slide switch that will allow the user to turn on/off the piano/system. The user will be notified if the system is on by the line of led's that will light up. In this piano system, there is also a touch sensor, where when the sensor is touched, it will allow the user to take a break - displaying “Taking a break? Cya later” on the OLED. Now that you have some information on what this project is all about, let's get into what materials are needed.

Supplies

download.png

For this Project you will need the following materials:


1.Arduino uno x 1


2.Breadboard x 1


3.Buzzer x 1


4.Push buttons x 8


5.10k Resistors x 8


6.330 k Resistors x 8


7.Wires - as needed


8.Touch sensor x 1


9.OLED display x 1


10.Slide switch


11.LED’s x 8-9 (depends on how many you want to add)

Adding Components to the Breadboard & Wiring

Screenshot 2025-06-14 3.05.16 PM.png
Screenshot 2025-06-14 3.05.33 PM.png
IMG_7455.jpeg

Above is an image of how the breadboard should look


1.Like the image above, you want to start off by adding all the components that are needed onto the breadboard and spacing them accordingly (follow the image above)

  1. Make sure the Anode side of the LED is in the same line as the power going into the push button - this will allow the LED to get the power from the push button
  2. Also make sure that the Cathode side of the LED is NOT connected to the negative side of the push button
  3. Follow these steps carefully so that there is conflicting current! (which could cause a short circuit)


2.Add the power wires (positive) to one side of each push button going into the positive rail on the breadboard. Likewise, add 10k Ω resistors to the negative side of each push button going into the negative rail on the breadboard (like the one in the image).


3. Add a 330k Ω resistor to each of the negative sides of the LED's which has the other side of the resistor going into the negative rail on the other side of the board.


4.Connect the ground wire to one of the pins on the slide switch and have another black wire which goes from the middle pin of the switch to the negative rail on the board - this creates the on/off system for the piano.


5.Connect the wires for the touch sensor:

Vvc --> positive rail

Gnd --> negative rail

Sig--> connecting to pin 2 on Arduino


6.Connect wires for OLED display:

Vdd --> positive rail

Gnd --> negative rail

Sck --> connecting to pin A5 on Arduino

Sda --> connecting to pin A4 on Arduino


7.Connect wires for buzzer:

Gnd --> Negative rail

Positve --> Connecting to pin 3 on Arduino


8.Lastly, connect a power wire from the Arduino (5.5V) to the positive rail on the board so that the circuit can get power to run.

  1. Don't forget to add a positive and negative wire on the last lane on the breadboard so that power can be running throughout the circuit/board.

Wiring the Push Buttons to the Arduino

Screenshot 2025-06-14 3.04.01 PM.png
Screenshot 2025-06-14 3.04.34 PM.png
Screenshot 2025-06-17 4.50.51 PM.png

Now that you have all the components on the breadboard and the wires for the other components are connected to the Arduino pins, the last part of the wiring is to connect the push buttons to the Arduino Pins. Make sure the wires are connected between the LED and the push button; with the wire connecting to the output side of the push button and not the negative side of the LED to ensure there is no conflicting current.


Listed below are all the Arduino Connections for the push buttons.


Button 1 = 12


Button 2 = 13


Button 3 = 11


Button 4 = 10


Button 5 = 9


Button 6 = 8


Button 7 = 7


Button 8 = 6

The Code

gfx.PNG
ssd.PNG

Now that we have all the components and wiring done, we can now start the coding process for the Piano to work the way we want.


Before you input the code, you will have to install two major libraries for this project to work.

These libraries include: Adafruit GFX and Adafruit SSD1306


Below is the code that I have written that you can upload to your own Arduino to make the Piano work.