Anthony Bonacci's profile

Metronome Prototype

Metronome Prototype
Project Synopsis
This project was created for the midterm assignment of my Interact & Interface: Physical Computing class at Bloomfield College.  The assignment was simply to use the knowledge that we gained during class–as well as any helpful information that we could learn on our own–to create something with an Adafruit METRO board, a breadboard, and the Arduino IDE, at the bare minimum.

Metronome Prototype
Because of my passion for music, I had decided that I wanted to build a metronome.  My idea was to use potentiometers to change the tempo in BPM and the time signature, and to use LEDs to display these settings. 

Planning Stage
The two images below are notes that I wrote before diving into construction.  The left page has a sketch of the prototype as well as steps for how I wanted to go about constructing it.

The right page is the pseudocode that I wrote for the metronome's script.  I thought about all of the variables that would have been useful to instantiate and the order in which each action should take place.  I also wrote an algorithm to figure out the delay in milliseconds in between each beat depending on the current tempo.  What I hypothesized for the delay ended up being wrong.
First Build
The images below display the first physical build of the metronome.  Because I was working with a small breadboard, all of the components were attached compactly.  The push button next to the potentiometers, for example, rested under a resistor.  To get to the button, one would have to stick one's finger under the four resistors for the red LEDs.
Second Build
The image below displays the second physical build of the metronome.  I now had a larger breadboard to work with, so I spaced out the components more comfortably.  The potentiometer that was going to handle the time signature was replaced by a switch containing two on states and one off state.  It was connected to the METRO board and breadboard with jumper cables.  The small LEDs were moved closer to the red LEDs, the red LEDs were spaced out more, and the push button became easily accessible.

I removed one of the potentiometers for two reasons: it had more friction than the other one, and I only needed three states (time signature: 2/4, 3/4, 4/4), so it made more sense to use this switch.
The tempo and time signature are printed to Arduino IDE's Serial Monitor at the start of every measure.
Final Build
For the final build of the prototype, I removed the switch & jumper cables with a larger potentiometer.  I couldn't figure out how to read the input from the switch and by this point, I had already figured out how to limit analog input range.  Another decision I made was to remove the push button; they can be loose and sometimes come out of the breadboard.  My professor also lent to me a bigger speaker because the small one was very quiet.
Script
I have provided a link to the code for my project.  After I presented my metronome to my class, I went back into the script and refactored it.  There are also comments that explain the purpose of the variables and methods/functions that I created.  I hope that this could be useful for anyone who wishes to learn about basic scripting with the Arduino IDE.
Metronome Demonstration
Problems That I Faced
One major problem that I faced was being able to test my script out as I was creating the metronome.  In the sketch part of my notes, I created a list of tasks for the prototype to make sure that every component worked on its own.  I was faced with port errors on the Arduino IDE.  I couldn't figure out how to get it to work on my personal laptop, and for a while, a port error existed on the computers in the computer lab at school.

After I had a computer that I was able to work with, my scripts still wouldn't upload.  I didn't realize that digital pins 0 & 1 on the METRO board were used for serial connections and not for input.  At this point, the time that I had left to work on the project was slim.

What I Learned
Through creating this metronome prototype, I learned how to use Arduino's map() and tone() functions.  For future reference on creating prototypes with these materials, I know which pins should be used for which components. That all being said, I ultimately gained experience in using analog inputs to control digital outputs.
Metronome Prototype
Published:

Metronome Prototype

The midterm assignment for my Physical Computing class was to use what we had learned to create a piece using Adafruit METRO boards and the Ardui Read More

Published: