Practical Project

The adventure!

Untitled sketch bb xtzeuuzjoe
Circuit diagram to follow

Step 1. Attaching the pushbuttons the breadboard.

I attached it first as it was a good starting point. Evenly spacing them out is helpful to keeping everything organised.

Here’s what it looks like once all 7 pushbuttons are attached. I adjusted the buttons as I realized there was not enough space to put the wires above the push buttons. I could have put it below however to make things easier, I just followed the diagram.

Step 2. Attach Jumper wires.

I began with just grounding each of the push buttons. All of the white wires have the same function.

After grounding all the pushbuttons I started with connecting the jumper wires from the breadboard to the arduino uno.

These are how the connections went:

Pushbutton C – D10, D – D9, E – D8, F – D7, G – D6, A – D5, B -D4

Step 3. Attach the piezo buzzer to the breadboard and arduino.

For the connection from the piezo speaker to the breadboard attach the piezo speaker ground to the breadboard ground and the positive terminal to the Arduino. Once this is done ensure all the connections are set properly.

Implement the code

Once the circuit as been doublechecked, it is time to run the code through the Arduino and begin testing. I did not have to modify it as my configuration was the same.

This is the code that needs to be uploaded before the “piano” is working.

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 = 10;
const int D = 9;
const int E = 8;
const int F = 7;
const int G = 6;
const int A = 5;
const int B = 4;

const int Buzz = 11;
const int LED = 13;

void setup()
pinMode(LED, OUTPUT);
pinMode(C, INPUT);

pinMode(D, INPUT);

pinMode(E, INPUT);

pinMode(F, INPUT);

pinMode(G, INPUT);

pinMode(A, INPUT);

pinMode(B, INPUT);


void loop()
while(digitalRead(C) == LOW)

while(digitalRead(D) == LOW)

while(digitalRead(E) == LOW)

while(digitalRead(F) == LOW)

while(digitalRead(G) == LOW)

while(digitalRead(A) == LOW)

while(digitalRead(B) == LOW)



Now it is time to test the piano by playing some melodies.


List of melodies to replicate: Still Dre by Dr Dre, ABC by Jackson 5, What a wonderful world by Louis Armstrong

Dr Dre Next episode
ABC by Jackson 5
Spider man theme
Project Research

Music Theory

Since I have to find the music sheet for the melodies I have chosen, it is a wise choice to make the time to do some research on music theory. My music theory is adequate enough for the task at hand however it could use some basic revision to help make the research easier. I did some research on the 20th of November after going into town for some component shopping. Here is what I found.


Scales are a group of notes arranged by ascending or descending order of pitch. The two most common types of scales used in western music are usually major and minor. The key or pitch the scale is played in determines which notes can be played. For example Imagine by John Lennon is played in the key of C major. These notes include all the white keys on a piano. C, D, E, F, G, A, B.

Major scale

Major scales are defined by there combinations of whole steps and half steps. It goes like this. They have 7 notes Whole – Whole – Half – Whole – Whole – Whole – Half. You may use this with any note on the keyboard. If you start with G it would be a G Major scale and it’s note are G, A, B, C, D, E, F#. Major scales are mostly associated with happy or joyous feeling music.

Minor scale Minor scale formula

Minor scales are similar to major scales. The difference is the order of the combination of whole and half steps. Minor scales are defined by having a flattened third. A flattened third means the third note of the scale is three semitones above the first note and not 4 unlike the major scale. The formula for the minor scale is Whole – Half – Whole – Whole – half – Whole – Whole. Music in minor scale tends to be sad and melancholy.

Melody sheet ABC by Jackson 5

Now that the basics have been reviewed. Let’s compile a list of the melodies I want to play on my project and their melodie notation.

ABC by Jackson 5:

D  E G
“A B C”

B    B-A  G   D E G
It’s easy as 1 2 3

B     B-A    G    D   E   G
As simple as do re mi

A B G   B A G
A B C,  1 2 3

G-G     A      B     B     G
Baby, you and me girl

Still Dre by Dr. dre

Still Dre by Dr Dre: Right hand A E C x8, A E B, G E B x5. Left hand: A A (First AEC) B B (Seventh A E C) E E (First A E B), E E (Fourth G E B) What a wonderful world by Louis Armstrong

What a wonderful world by Louis Armstrong:

C   E      F      A    ^C
I see trees of green,

^D  ^D-^D  ^C
Red roses too

Bb Bb   Bb       A
I see them bloom,

G      G     G     F
For me and you

F       F    F      F      F – F
And I think to myself,

F         F      E – F – G       A
What a wonderful world.

Minor issue

I realised after looking at all the notation that my ability to play a piano is not really up to par. Alongside building the circuit, minor (see what I did there) practice may be required or just playing the melodies constantly until it sounds coherent enough to enjoy.

Planning Project Research

A run into error

Hi so you may have noticed on my previous blogs that my project suddenly made a component change and had a new component review blog. This is because during this project I was behind due to personal reasons. Due to that I was left during Christmas behind on schedule and when it came to building the circuit there were no tutorials or help I could go to during this time.

Below are the pictures of the schematic and what my circuit looked like when I couldn’t get it to work.

My circuit.
Schematic for melody shaper

I ensured that all the values of the components were correct such as the capacitor being at 100uF. Possible errors may be from how the jumper wires are connected. However my main speculation is that the battery is suppose to be the external power source plugged into the Arduino separately


I continued to rearrange the circuit in order to get it working however it was to no avail. It felt as if I was continuously going the wrong direction when looking for my destination. At times I nearly felt like giving up however I remember one thing, the power of the internet! Just one problem there were no tutorials at all on this. So instead I jumped to another project. This one.

This was called the Arduino mini piano. One key difference I noticed was the code programmed the push buttons to play individual notes rather than coded melodies that would play after being uploaded to the circuit. This was interesting as it made me notice that I could compile a pros and cons list for the two and compare them.

Project time!

I jumped straight into it, as you can see on the previous blog with the component review. Now it is time to build this new mini Arduino project and play the melodies intended.

Practical Project

Components for Prototype 1

Untitled sketch bb xtzeuuzjoe
Circuit diagram for my project

For my components I did not need to use a multimeter to see the value of any of the components as they do not possess any. Here are all of my components.

Component list

Jumper wires. M to M and M to F

Used to connect the Arduino to the breadboard.


Allows for connects to be made on the breadboard in order to complete the circuit. A bigger breadboard allows for more electrical components. For mine specifically it requires space for 11 6mm pushbuttons.

Push buttons – 11 required for differet keys.

Push button 1 – C, Push button 2 – CD, Push button 3 – D etc.

Each key when pressed will correspond to a different note such as in a piano or keyboard.

Arduino Uno

Allows code to run through making it a programmable circuit board. When connected to a laptop, code may be uploaded via arduino.exe. When running the code, it will debug before allowing to upload into the Arduino. This ensures that you put down the correct code and desk check for any errors.

All the ports on the Arduino uno allow for connects to be made with the jumper wires.

Piezo speaker/buzzer.

Used for the audio output of the keyboard. When any pushbutton is pressed, a tone will play through the piezo speaker.

I however may change this component to a small 1w speaker in order to have a higher quality sound although it wont make much of a difference as each button will only play one tone or a dual tone at most.

Lets get started!

Now that all the components have been reviewed, It is time to begin assembling the circuit! Join me in my next blog for that.