Midterm Build – Instrument Tuner

Concept

My initial idea was to make a violin tuner, but that was too simple, so I decided to use a potentiometer to be able to use the buttons for multiple different notes with the purpose of extending utility beyond a violin tuner. Thus, with the potentiometer and six buttons, I made a tuner with 4 settings: violin, viola, cello, and guitar (where the extra 2 buttons actually do something). I originally wanted to include the notes for a double-bass, too, but they were too low for the piezo buzzer to play accurately (it was a low rumbling; it would be hard to tune an actual instrument with that).

So, in short, my project is a multi-instrument string tuner that should be redemptive for past mistakes with multiple notes on the buzzer.

Schematic

Midterm – Tuner Schematic

Code

You can access my code through GitHub by clicking here.

Behaviour

For the most part, the tuner works just as intended. There are, however, a couple of hiccups whose origin I can’t find. Every button controls a note that the buzzer plays, and changing the potentiometer’s position (indicated by the LEDs) changes the notes the buttons play. Setting the code up was relatively simple, and the breadboard prototype worked perfectly.

Building the cardboard structure took some time, but using hot glue and bending seemed to work fine for a basic structure. Since my project has 6 buttons, 1 potentiometer, 4 LEDs, and a buzzer, cable management and soldering all the pieces proved to be the most time-consuming activity. I gave up on the aesthetics of cables after connecting 2 of the buttons and just tried to keep everything neatly organised and easy to track. 

Though I did try to make the front look aesthetic, it kept falling forward due to the weight of the buttons and the knob on the cardboard, so I had to use cardboard bits to “box” it, in a way, but even then it didn’t hold as well, which is why there is now tape on the sides.

All in all, 3/4 of the instruments I added work as they should, and of the 1/4 that doesn’t work, 4/6 buttons work, but an LED flickers when it shouldn’t.

Problems

The setting for the guitar, as a whole, posed a problem for some reason. The circuitry and the code seem to be just fine, but the last two notes of the guitar setting don’t work as they should. There seems to be some interference with the other notes, or with other parts of the project. In the previous project, the problem seemed to be on the abundance of noTone commands; in this one, however, there is only a single noTone command, so that option is ruled out. The circuitry seems to work just fine, and so does the code. The buzzer plays all other notes correctly, it is just those two notes that don’t work.

Likewise, a red LED flickers when a button is pressed on the guitar setting, but not at any other point. I also haven’t been able to figure out why this is the case. The digitalWrite for the LEDs is entirely dependent on the knobs being in positions 1-4 (the knob was mapped to go from 1 to 4), and there is no reason in the code for why that LED would flicker, though it seems to be related to the specific note of the buzzer. Seems to be, to some degree, that the interference is electric, but why specifically the red LED?

Photographs

View post on imgur.com

View post on imgur.com

View post on imgur.com

View post on imgur.com

Video

Midterm – Instrument Tuner

Lessons Learned

Using noTone only once produces better results when producing multiple notes through a single buzzer, as opposed to using noTone every time I needed to silence the buzzer.

Soldering takes longer than I thought it would and was, easily, the most time-consuming part of the project, but now I can use it, even if it is not at the best level.

Stripped wire is usually bad, covered wire is usually good.

Sometimes connecting too many things to a single function or chain of functions can seem to create some sort of electric interference (as was the case with the LED), and sometimes things just don’t work and refuse to reveal the secret to why they don’t work.

One thought on “Midterm Build – Instrument Tuner

  1. Michael Shiloh

    Interesting project. While technically it’s not terribly complex, as you discovered wiring and fabrication takes a long time. Your physical construction was very nice and clean (except for the emergency tape). You could have added supports inside the box to support the buttons better (more time of course).

    I studied your code and can not understand why the last two buttons behaved differently in guitar mode, or why the red LED flickers. When the red LED flickered, did any of the other LEDs light up? That might have suggested that the result of reading the knob was somehow being interfered with.

    In spite of the massive number of nested if() statements (something we usually try to avoid) your code is clear. You could have added a few more comments (such as when mapping the knob values) and you could have chosen better names for the LED pins e.g.

    const int guitarIndicatorPin = 12;

    Finally, you could have accomplished the same thing with only two levels of nesting. Ask me about this.

    Reply

Leave a Reply

Your email address will not be published. Required fields are marked *