This document summarizes the components and working of a music player device controlled by user input. The device uses an Arduino, musical instrument shield, piezodiscs, and a resistor ladder circuit with switches to detect button presses and play corresponding notes. When buttons are pressed, different voltages are sent to an analog input to trigger the associated note. The device allows playing single notes or combinations by pressing multiple buttons.
3. INTRODUCTION
The objective of this report was to create a user-friendly device capable of
playing music based off of an operator’s commands.
From the beginning, we knew that we wanted a project that relied heavily
on user interaction.
We decided to venture down the path of music, based on
our mutual interest of learning and playing musical instruments.
The Arduino in combination with the
Musical Instrument Shield and piezodiscs are the three main components in this project.
When the piezodiscs are distorted in tension or compression,
a note is played through a speaker
4. Arduino is an open-source electronics
platform based
on easy-to-use hardware and
software.
Arduino boards are able to read
inputs –
light on a sensor, a finger on a button,
or a Twitter message - and turn it into
an output
- activating a motor, turning on an
LED,
publishing something online.
What is an aurdino..?
5. COMPONENTS REQUIRED
1. Breadboard
2. x Piezo buzzer
3. 4 x Switches
4. 1 x 220-ohms resistor
5. 2 x 10-kilohm resistors
6. 1 x 1-megohm resistor
7. 9 x Jumper wires
6. PRINCIPLE OF METHODLOGY
While it’s possible to simply hook up a number of momentary switches
to digital inputs to key of different tones, in this project, you’ll be constructing
something called a resistor ladder.
This is a way to read a number of switches using the analog input.
It’s a helpful technique if you find yourself short on digital inputs.
You’ll hook up a number of switches that are connected in parallel to
analog in 0. Most of these will connect to power through a resistor.
When you press each button, a different voltage level will pass to the input pin.
If you press two buttons at the same time, you’ll get a unique input based on the
relationship between the two resistors in parallel
9. BODY OF THE PROJECT
Wire up your breadboard with power and ground as in the previous projects.
Connect one end of the piezo to ground. Connect the other end to pin 8 on your Arduino.
Place your switches on the breadboard as shown in the circuit.
The arrangement of resistors and switches feeding into an analog input is
called a resistor ladder. Connect the first one directly to power. Connect the second,
third and fourth switches to power through a 220-ohm, 10-kilohm and
1-megohm resistor, respectively. Connect all the switches’ outputs
together in one junction.
Connect this junction to ground with a 10-kilohm resistor, and also connect it to Analog In 0.
Each of these acts as a voltage divider.
10. If you press the first button, notes[0] will play. If you press the second,
notes[1] will play,
and if you press the third, notes[2] will play. This is when arrays become really
handy.
Only one frequency can play on a pin at any given time, so if you’re pressing
multiple
keys, you’ll only hear one sound.
To stop playing notes when there is no button being pressed, call the noTone()
function,
providing the pin number to stop playing sound on.
RESULTS
11. If your resistors are close in value to the values in the example program,
you should hear some sounds from the piezo when you press the buttons.
If not, check the serial monitor to make sure each of the buttons is
a range that corresponds to the notes in the if()...else statement.
If you’re hearing a sound that seems to stutter, try increasing the range a
little bit.
Press multiple buttons at the same time, and we get different sort of
values in the serial monitor.
We can Use these new values to trigger even more sounds.
Experiment with different frequencies to expand your musical output.
We can find frequencies of musical notes on this page:
12. Over the years Arduino has been used as the “brain” in thousands of projects,
one morecreative than the last. A worldwide community of makers has
gathered around this open-source platform, moving from personal
computing to personal fabrication,
and contributing to a new world of participation, cooperation and sharing.
Think about an enclosure for the keyboard. While old analog synthesizers had
wires poking out all over the place, your keyboard is sleek and digital. Prepare a
small piece of cardboard that can be cut out to accommodate your buttons.
Label the keys, so we know what notes are triggered by each key.
CONCLUSION