Detachable Guitar Auto Tuner
I consider that restringing a guitar is a tedious and annoying process so as I pondered how I could make an automatic gadget to speed up the process, I, also, said to myself “Why not add another function to it so it does not end up being just a fancy electronic string winder?” “How about I make it, also, capable of tuning a guitar?” Having considered that, I decided to design a device that rewinds and tunes a guitar on the go with some elements of easy procurement.
Now, I have previously seen automatic tuners but these were embedded in the guitar already. I felt that having a detachable option would be better because the guitar would not be, in any way, affected (drilling of holes into the headstock, change of tuning pegs in case they malfunction).
In addition, multiple guitars could share this detachable device without any constraints.
The current version of the project is only capable of tuning the high E string but stay tuned as future updates will allow the device to tune the remaining strings to alternative tunings too.
Supplies
- MAX 4466
- Battery holder (4 x AA batteries)
- 4 x AA batteries
- L298 driver
- DC gearbox motor TT (180:1)
- Tiva C launch pad
- 3 x push button
Frequency Detection
The sampling method is quite similar to the clip-on tuners. The tune of the string is identified by sampling the vibration produced by the strings and carried through the guitar’s neck to the guitar headstock. A MAX4466 with the mic placed against the headstock is the device in charge of the signal sampling and data transfer to the Microcontroller.
In order to explain how the pitch of the string is detected, I will give a brief and simple explanation about what cross-correlation and autocorrelation are: First, the cross-correlation function is the process of measuring the intersecting area from the superposition of two signals that have a certain shift between them, for multiple shift values, and obtaining from this process a graph that shows at what delays values both signals have the most similarity.
Autocorrelation uses the same concept from the correlation function but in this case, the same signal is correlated against itself. If it is hard to grasp this concept, the first image may help you understand it better.
The purpose of this function is to find what frequencies are the most prevalent in a certain signal. For example, the second image is the graph of an in-tune high E string vibration sampled at 10kHz by the MAX 4466. In addition, the third image is the result of applying autocorrelation to the previous signal. The third image shows positive peaks at lag = 39,121,161,200,241. We can infer that at a certain delay shift (signal shift in seconds=sampling frequency * lag) the signal is more similar to itself. Going a bit deeper, it means that at those points, the most important frequency components of the signal are located.
In this case, when lag= 121(which is the highest magnitude peak), the signal shift (period) =10 kHz * 121 = 0.0121 seconds= 82.64Hz. This frequency is one of the most prevalent components found in the signal. According to this article, the high E-string vibration in tune is supposed to be equal to 82.4 Hz. This value is pretty close to the one that we found by autocorrelation.
In conclusion, by using autocorrelation, we can determine if a string is in tune or not by checking the lag position of the highest peak from the autocorrelation graph.
Tuner Device
The whole device is made up of the following components:
- The tuner structure, designed to fit a Squier Stratocaster headstock.
- A DC gearbox motor TT with a 180:1 gear ratio provides the driving force to the pegs and a small plastic piece is attached to the motor`s axis to allow the transmission of movement between motor and tuning peg
- .A battery holder (4 x AA batteries) powers the motors.
- A driver L298 is responsible for controlling the spin time and orientation of the motor.
- Three push buttons to control CW, CCW spin, and auto-tuning start.
- A Tiva-C launchpad evaluation board that manages all the functions of the system (Sample receiving and storage, signal processing, decision making, and motor control).
- A MAX4466 mic module to sample the vibration from the strings and forward those values to the Tiva-C launch pad.
The connection diagram is shown in the last image.
Building the Tuner Structure
As stated before, the tuner is designed to fit a Squier Stratocaster headstock but with a bit of modification to the files attached, it will be possible to make it fit into other headstocks.
To craft the structure, you can either 3-D print it with the .stl files attached or, like me, you can laser cut it in 3 mm thick acrylic and glue the pieces together using the pdf templates.
Programming the Tiva C
To use the attached code, I used the IDE Code Composer Studio 9.3.0 using the Tivaware SDK which you can find here.
Also, additional documentation and examples can be found here.
The code has many comments to explain what each part of it does, but you can see the flowchart to get a grasp of the general flow of the program.
Downloads
The Device in Action
In the video, I show the device tuning multiple times the high E string. At this stage of the project, its accuracy is close to perfect.
The test guitar has 10 gauge set strings.
To Do List
The current state of the device is not, by any chance, close to the completed final product I have envisioned but I believe that this current version of the project (Device capable of identifying the pitch of a string and auto-tuning the high E string) is going through the right path and has great potential to evolve even more like adapting it to different headstock types.
That being said, the "to do" list includes the following items:
- Add the remaining DC motors to the remaining strings.
- Swap the DC driver for a smaller one.Change the current MCU board for a smaller one so it can fit inside the tuner structure.
- Interchange the current power source (4 x AA) for a LiPo battery + boost converter.
- Improve the DC motor control.
You can expect the pending tasks to be addressed so stay tuned for the next version!!!!