I decided pretty much all bought guitar tuners are crap. They’re never accurate and they’re useless if there’s any other noise going on. I set out to make something better, and here it is.
Someone did make something like this commercially, but it’s not as cool as mine. I forget what it was.
Edit: Planet Waves CT06
I figured the easiest and best way to accomplish the task of tuning a string is with a strobe light flashing at the right frequency. What we set out to achieve is some arrangement of flashing LEDs that throws bands of light onto guitar strings. When the string oscillates at the same frequency as the flashing of the light we won’t see any movement because the string is in the same place each time the light flashes. If the string is out of tune the bands of light will appear to wobble. Read about strobe tuners if you’re not keeping up so far.
The easiest way to make lights flash at an accurate but switchable frequency has to be the venerable PIC running off a crystal oscillator. So let’s start there.
I had a PIC 16f819 sitting in my parts bin, and it’s perfect for the job for many reasons. The best part is one of its 3 timers is 16-bit, so we should be able to get super accurate timings with it. It seems a shame to waste the other 2 so I figured why not use 3 LEDs that can be for tuning half-step down or whatever.
A 4 MHz crystal makes the PIC run at an incredibly convenient 1 microsecond instruction cycle, so if we know the frequencies of all our notes it’s trivial to work out how to set the timers. Similarly wiring 3 LEDs to pins on a PIC is about as easy as it gets, so the only hard part is the code…
I won’t go too much into the details, but I can tell you it was a faff getting the 3 timers to interrupt (many “enable” bits need to be set and they’re scattered all through the datasheet). Once they do we just need code to figure out which timer tripped, code to switch strings on a button push, and a bit of magic to compensate for the time spent turning lights on and off.
Our magic numbers are 82.4, 110, 146.8, 196, 246.9 and 329.6 Hz for a guitar. I wasn’t sure at first how I was going to keep track of which note the strobes were flashing at as we cycle through the strings, but then I reasoned that with 3 LEDs we can count to 6 in binary, so when the button is pushed to change we go to a delay loop (that also serves to debounce the button) that lights up LEDs showing the number of the string, from 1-6, that we’re moving to.
I set up the 3 LEDs so that the green runs off the 16-bit timer and always strobes at standard tuning, i.e. EADGBE. The red is always 1/2 step down in case I ever lend this thing to some scruffy guy with long hair from the 1990s, and blue is a little different.
The disadvantage of this strobe setup is it’s impossible to tell if you’re too high or too low without adjusting, so I set the blue LED to flash a little fast, meaning that if blue is the most stationary band don’t go any higher. This should prevent string snappage. The exception is on the E string (string 1), where blue is set a full step down to make drop D quick and easy.
The rest is simple maths, not so simple code and masses and masses of debugging [Thanks Adam!!]. Once it was working I measured the frequencies accurately and tweaked the timer loadings a little. Now it’s probably the most accurate tuner I’ll ever see.
3 super-mega-uberbright LEDs + resistors of your choice
1 4 MHz crystal (+small caps per PIC datasheet)
1 offcut of stripboard
1 power switch
1 push button