Guitar Tuner with DC Motors

Sina Atalay,

This post provides a brief overview of the construction of a microcontroller-based device that tunes a guitar using DC motors.

The project was developed as part of the Mechatronics course at Boğaziçi University during the fall of 2020 by a team of six mechanical engineering students: Sina Atalay, Abdullah Gedük, Ediz Ferit Kula, Alp Uysal, Elif Hacıhasanoğlu, and Kevser Didar İskender.

Overview

The goal was to build a microcontroller-based device that tunes a guitar by “listening” to it and adjusting the strings automatically using DC motors. We began by outlining the device’s basic operation:

  1. The user connects the device to their guitar.
  2. They select the desired tuning (e.g., E standard).
  3. They play a string for the device to detect the current pitch.
  4. The device adjusts the string until the target pitch is reached.

We then researched the available technologies needed to implement each of these steps.

The tuning selection system was relatively straightforward. Using buttons and a microcontroller, we built a circuit to receive user input. An LCD screen provided a simple visual interface. Once a tuning was selected, the system assigned a target frequency to each string (e.g., 82.4 Hz for the sixth string in E standard tuning).

The next step was figuring out “listening” the guitar. We decided to use an electric guitar to send the audio signal directly to the microcontroller. However, the microcontroller could not read the guitar’s signal directly, as it was too weak. To solve this, we built an amplifier circuit to boost the signal to a readable level.

The next challenge was pitch detection. While we could now read the sound input, determining the frequency required mathematical processing. Ultimately, we applied a discrete Fourier transform (DFT) to the amplified signal to compute each string’s fundamental frequency.

We designed and 3D-printed mechanical parts to connect the DC motors to the guitar’s tuning pegs. We also built a rollable structure to easily attach and detach the device from the guitar.

The final stage was integrating the electronics and programming the microcontroller. The logic was as follows:

  1. Read the amplified sound signal from the guitar.
  2. Compute the fundamental frequency of the string.
  3. Compare the measured frequency to the target frequency.
  4. If the frequency is too low, rotate the DC motor clockwise to tighten the string.
  5. If the frequency is too high, rotate the DC motor counterclockwise to loosen the string.

Controlling the DC motors accurately was the final hurdle. We wanted to avoid overshooting the target frequency or tuning too slowly. We observed a linear relationship between the motor’s turning time and the difference between the current and desired frequencies. Using linear regression, we estimated the required motor run time for precise tuning.

Our original goal was to build a device capable of tuning all six strings simultaneously. However, this required more advanced algorithms and circuitry than we had anticipated. Nonetheless, we successfully built a device that can tune each string individually.

The Final Product

The schematic of the automatic guitar tuner is shown below. A video demonstration of the tuner in action is also provided below (the video is in Turkish, but English subtitles are available).

Schematic of the guitar tuner.
Schematic of the guitar tuner.
Demonstration of the guitar tuner.