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
Panic!?!
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.
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.
I recently received my components on the 3rd of November. I immediately wanted to begin the project. However to be honest it is a daunting task as I have not been doing practical work on audio electronics in a whole year! So to ease this pressure I think a test run of some sort is was due. On November 5th I went to the electronics lab at DMU on campus to inspect and understand all my components.
Electrical components
Component list
My electronics kit I ordered
Arduino Board
Piezo speaker
2N222 Transistor
1K Resistor
100uF Capacitor
9v battery
Male to male jumper wires
3 pin female header
There were a couple components that I was already familiar with before getting my hands on. This is because they were reviewed previously on another blog post. This included the:
1k resistor
100uF Capacitor
2N222 Transistor
I began with the most vital component of any circuit, the circuit board itself. This one in particular is an Arduino board. Arduino (as discussed in a previous blogpost) is an open source platform used for building electronic projects. It consists of a physical programmable circuit board, which I have in my hand in the picture below, and a piece of software or IDE that runs on a computer. This piece of software can be used to upload and write computer code to perform functions such as play sound or light an LED. One particular aspect that makes Arduino very accessible to beginners is the use of USB. Furthermore it uses C++ program which is very popular and easier to learn.
Arduino Uno REV3 board
The piezo speaker is the component of the project that will produce the sound. It is a loudspeaker that used the piezoelectric effect for generating sound. In laymen terms the piezoelectric effect is when a material has the ability to generate an electric charge in response to applied mechanical stress.
Piezo speaker
The jumper wires that are going to be used are electric wires that connects remote electric circuits used for printed circuit boards such as Arduino. A jumper wire can short circuit a circuit and short cut to the electric circuit.
Male to Male jumper wires
The battery is 9v. It will act as a source of power for the circuit. It will enable the piezo speaker to function.
9v Battery
What we have here for me is a 3 pin female header. A pin header is a type of electrical connecter. It is used to take current or signal transmissions.
Female pin header
Simple practice
Once I got to understand each and every part through getting hands on experience I wanted to test myself with building a very basic circuit that implements simple code. I found a similar circuit on Arduino’s website that uses a simpler version of the code that I will run. Here is the link to the website. https://www.arduino.cc/en/Tutorial/BuiltInExamples/toneMelody Tinkercad was used before physically starting it, to ensure that the code would run properly. This circuit plays a melody using code through a piezo speaker connected to the arduino uno board.
TinkerCAD
The setup was followed on the website through TinkerCAD and I typed all the code into the script. I then setup the schematic (as seen above). I ran the code and it played a very scuffed melody through the piezo speaker. After the test was a success, with the code being runnable, I began with following the schematics and building this simple circuit.
Schematic to simple circuit
Once the jumper wires were connected from the arduino board to the breadboard it was time to ensure that the circuit was working. I opened up Arduino in my laptop so I could input the code. It was very easy as I just; copied the code into the Arduino and let it run. Once the code ran, I uploaded it into the board and it played a melody through the piezo speaker.
Arduino board connected to a piezo speaker using a breadboard
An Overall Success
The test run was a success as I got to understand all the components of my project. Furthermore I built a very basic circuit which has a similar function to mine in order to get some hands on practice before I begin the project. I am more prepared and excited to begin!
Arduino is the centre of my project and without it, my project would not be able complete its function (play musical notes). Arduino is a software, IDE specifically, and it allows for computer programmers or coders to write program/code in order to perform functions with a breadboard. Arduino can be downloaded so that it may be used offline or the use of a web editor is also available if you do not want to download it. Arduino code is written in C++.
My Experience
Never used Arduino before however once seeing that it was an IDE similar to Visual Code Studio, my confidence increased as I had experience in coding with Python before. Although my project and python practice may be different in terms of how everything is coded, the fundamentals of the IDE is the same. So far Arduino for me has been quite smooth yet the potential of Arduino is near limitless as I can see how far advanced users may use Arduino. An Arduino board is connected to a laptop/desktop and the code that is written in the IDE, has its functions carried out on the board. Overall it was fun and exciting prospect to getting hands on with Arduino. However safety and care is important. Make sure to avoid eating and drinking around the Arduino board as liquid and crumbs do not go well with the board!!! I had to write this here to remind myself :D.
When writing code for Arduino, Arduino uses a “if-then” structure. All this means in laymen terms is, if a certain condition is met then the board will perform a task such as turning on a sensor. It can be divided into 4 different parts. The setup involves writing code that performs things that only need to be done once. The inputs are then written. The inputs will be used as conditions. The data is then manipulated to perform a function/calculations. The output is the “then” part of “if-then”. If everything is coded correctly then the board should perform said task.
Overall Arduino’s ability to be versatile is very impressive. Initially I underestimated the power of the board and I am left pleasantly surprised with my findings after hours of research. One of my concerns had been if it was too basic however it was simple yet advanced enough for users to build something complex. I was left in awe with how many options people can have with a board.
Before I even got the idea for the project, I was quite lost with what to do as a project. I began with a brainstorm to generate ideas. To assist with my brainstorm, I know that I wanted to create something that would produce sound which means it would have a speaker. With my love of producing music, the idea to create melodies was applied to the device and thus the project would become some sort of “instrument”. Research came right after and with the help of Anna, my tutor, I found a melody maker that could be created with an Arduino board.
On 14/2 I decided that the Arduino Melody Shaper was what I wanted to do for the project. To be honest I do struggle with electronics however the prospect of playing melodies through something I created will be exciting. Approval came from my tutor after I had sent an email asking if the project was viable.
Plan of action
My knowledge of Arduino is quite lacking so my plan is after submitting the form I will begin doing 1 hour of work based on learning how to use Arduino. The task will be a challenging yet exciting endeavor as I’ve always wanted to do this kind of thing however I never put the time in to learn. Anna, the internet, my peers and the university, it should be an easier task to complete if any help is required.
I am looking forward to recreating famous melodies such as ABC by Jackson 5 on the instrument. Recordings of famous melodies will be uploaded to this blog once the project has been crafted.