You are on page 1of 10

MECHATRONICS ME156P SECTION E03 EXPERIMENT NO.

5
Experiment TITLE: KEYBOARD INSTRUMENT

Salvado, John Henry M. Date Performed: Nov. 27, 2019


2013102950 Date Submitted: Dec. 18, 2019
Professor: Engr. Edward Ang Course and Year: MFGE/3
Group # 4

Discussion:
This experiment titled Keyboard Instrument has us emulating a small musical
Keyboard. What makes this experiment unique is that instead of use using up all the
digital input on the Arduino Uno to assign different power outputs to the Piezo element
to produce specific programmed sounds, We used a resistor ladder to vary the inputs
we make into a single analog input. This method allows us to save on the inputs we use
on the board, so they may be used for other purposes in larger scale projects.
The resistor ladder is a parallel circuit of resistors, where in each button farther
into the circuit must pass through more resistor to complete the circuit. The more
resistors the current must pass through the lower the voltage input. This is how we vary
the inputs we make into just 1 analog input on the Arduino uno allowing us to produce
different frequencies on the Piezo element ultimately making different sounds.
Learning Objectives:
This experiment’s objectives are;
 To teach students how to minimize the usage of Inputs on the Arduino
 To learn how to utilize the resistor ladder
 to know how to utilize a piezo element
 learn how to measure frequencies
Course Objectives and Anticipated Student Outcomes:
“a” to “k ” and “ L ”outcomes. The ABET outcomes taught and assessed in this course
are:

“A” Ability to apply knowledge of mathematics, science, and engineering


- The ability to apply knowledge of science and engineering was practiced in
this experiment as we could tinker with the Arduino and its code.
“B” Ability to design and conduct experiments as well as analyze and interpret data
- We were able to analyze the data that we received from the app we used to
measure frequencies and decibel range.
“C” Ability to design a system to meet desired needs.
- We were able to design a system that would allow us to minimize the usage
of inputs on the Arduino uno.
“D” Ability to function on multidisciplinary teams
- We were able to spread out the workload among the group members evenly
so that each member has a role in the experiment.
“E” Ability to identify, formulate, and solve engineering problems.
- We were able to identify certain errors in our code and our set up. We were
able to confirm that some of our wiring wasn’t connected properly and we
were able to fix the issues in both the hardware and software side of the
experiment.
“F” Understanding of professional and ethical responsibility
- We were able to work independently as a group and finished the experiment
responsibly
“G” Ability to communicate effectively
- We were able to communicate together as a group and finished the work
efficiently.
“H” Broad education necessary to understand the impact of engineering solutions in a
global/societal context
- The scope of this experiment was very limited and didn’t tackle any global
issues.
“I” Recognition of the needs for and ability to engage in lifelong learning
- Aside from working as a group this piqued my interest in the programming
side of the Arduino experiments.
“J” Knowledge of contemporary issues.
- In the current Philippine situation, we lack innovators on that could compete
on a global scale, this experiment could be an eye opener for many students
“K” Ability to use the techniques, skills, and modern engineering tools for engineering
practice
- We exercised our skills in working with the modern engineering tool the
Arduino.
“L” Knowledge and understanding of engineering and management principles as a
member and leader in a team, to manage projects and in multidisciplinary environments
- As a member of the group we were able to acknowledge the different roles
we had to play in the experiment.
Group Assignments/Task done by EACH member:
GROUP NUMBER 4
EXPERIMENT #5
Experiment Title: Keyboard Instrument Due Date: 12/4/2019
Group Member
Name: Brief % Completed
No. Group Member Description of by Members Your Score
Signature: the Work
assigned to
Members

Salvado, John Assembled the


1 Henry setup 100% 100

Roca , Reimbert
Randalla Programmed
2 100% 100
the arduino

Mendoza , Carlo E. Programmed


3 and 100% 100
troubleshooted

Fernando , Bon Brought the


4 Keno R. laptop and 100% 100
gathered data

San Juan , Marco P. Troubleshoot


the experiment
5 100% 100
and gathered
data
*100% means the member completed his/her assigned work.
By signing this assignment cover sheet, I agree that the percentages stated in the %
completed column reflect the contribution made by me and the other members of the group.
List of materials Needed for the Experiment:

1. USB Data Cable (Yellow)


2. Arduino Uno
3. Bread Board
4. 4 pieces Push Button Switch
5. Piezo Element
6. 3 Small Green Connecting Wire
7. 1 Small Brown Connecting Wire
8. 1 Small Blue Connecting Wire
9. 1 Yellow , 1 orange , 1 green , 1 white Medium connecting Wire.
10. 1 220 Ohm resistor
11. 2 10k Ohm Resistor
12. 1 1m Ohm Resistor
Schematic Diagram:

Legend:
1. USB Data Cable (Yellow)
2. Arduino Uno
3. Bread Board
4. 4 pieces Push Button Switch
5. Piezo Element
6. 3 Small Green Connecting Wire
7. 1 Small Brown Connecting Wire
8. 1 Small Blue Connecting Wire
9. 1 Yellow , 1 orange , 1 green , 1 white Medium connecting Wire.
10. 1 220 Ohm resistor
11. 2 10k Ohm Resistor
12. 1 1m Ohm Resistor
List of ACTUAL SAFETY procedures implemented in this experiment:
Steps:
1. Identify the different parts needed for the set up
2. Assemble the Keyboard Instrument setup, referencing from the manual provided.
3. Assemble all the parts onto the breadboard and connect it to the Arduino Uno.
4. Connect the Arduino Uno to the Laptop using the Provided Data Cable.

5. Open the Arduino Program


6. Referencing from the Manual copy the Code for the keyboard Instrument.
7. Upload the Code onto the Arduino.
8. Make necessary adjustment to the code if errors are found.
9. Test each push button if sounds is different from each other. If sound is off check
connection on the bread board.
10. Measure for the frequency and decibel range of the sound produced by each
push button using a smart phone app.

11. Record the Data.


12. Disassemble the set up
Arduino Code:
int notes[] = {262,294,330,349};

void setup() {

Serial.begin(9600);}

void loop() {

int keyVal = analogRead(A0); // set the key value receive from A0

Serial.println(keyVal); // allows us to see the values being sent to the computer

if(keyVal == 1023){

tone(8, notes[0]);} // sets the tone value if keyval = 1023

else if(keyVal >= 990 && keyVal <= 1010){

tone(8, notes[1]);} // sets the tone value if keyval is between or equal to 990 and 1010

else if(keyVal >= 505 && keyVal <= 515){

tone(8, notes[2]);} // sets the tone value if keyval is between or equal to 505 and 515

else if(keyVal >= 5 && keyVal <= 10){

tone(8, notes[3]);} // sets the tone value if keyval is between or equal to 5 and 10

else{

noTone(8);} // no tone if no else if parameters were met

Data Sheet/ Gathered:

Button Frequency Decibels


1 2367 hz 23 db
2 2297 hz 19 db
3 4406 hz 22 db
4 3844 hz 20 db
ANALYISIS:
The data we gathered in this experiment were received from a smartphone app
that measures frequencies and decibels. Push button one was the one nearest to the
ground, therefore it had to travel through more resistors. Push Button 1’s frequency
starts off as the lowest among the 4 buttons. As we proceed closer to the positive side
of the resistor ladder, we go through less resistors. The trend as we go along is that the
Frequency Goes higher, and there is no visible trend with how loud the sound gets,
where push button 4 produces the highest frequency at 3844 hz.
We were successful with the experiment because we were able to produce 4
different sounds with each push button. We were also able to utilize the resistor ladder
to minimize the number of inputs we used on the Arduino Uno.

Recommendation:
I recommend that students check if the push buttons legs are straight, because if
they aren’t, they have a hard time connecting to the board. Sometimes if the connection
isn’t proper the sound the piezo element makes varies, giving inconsistent data. This
can be remedied by pushing down properly on the push buttons so that they make a
proper connection to the board.

Conclusion:
In conclusion to this experiment we were able to achieve the objectives set for
us. We were able to set up the Keyboard instrument set up. By utilizing the Resistor
ladder we minimized the analog inputs we used on the Arduino Uno. Instead of using 4
different inputs we only used one.
Answer to Questions:
a. How does Serial println (keyVal) function in the program?
- Serial println (keyVal) allows the different voltages produced from the resistor
ladder to be read and sent to the computer. This allows the Arduino program to
decipher what output to send.
b. What are the different frequencies (in Hertz) produced in this experiment? Explain
how are these produced?
- Using the Resistor ladder we change the voltage the analog input receives. The
output then sends a different frequency to the piezo element to produce.
c. SUGGEST the INDUSTRIAL APPLICATION of this kind of experiment.
- This experiment could be used in larger scale Arduino projects, where in there
is a shortage of analog inputs. In this way we may simplify our inputs using the
resistor ladder. Opening the other analog inputs for other sensors or functions in the
project.
d. Individually suggest electrical and mechanical standards or codes and local or
international applicable in this experiment. Cite source/s.
ISO 16:1975
Acoustics — Standard tuning frequency (Standard musical pitch)

Source: https://www.iso.org/standard/3601.html

You might also like