Professional Documents
Culture Documents
5
Experiment TITLE: KEYBOARD INSTRUMENT
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:
Roca , Reimbert
Randalla Programmed
2 100% 100
the arduino
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.
void setup() {
Serial.begin(9600);}
void loop() {
if(keyVal == 1023){
tone(8, notes[1]);} // sets the tone value if keyval is between or equal to 990 and 1010
tone(8, notes[2]);} // sets the tone value if keyval is between or equal to 505 and 515
tone(8, notes[3]);} // sets the tone value if keyval is between or equal to 5 and 10
else{
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