Skip to content

Automatic Guitar Tuner

This project details the design and construction of a microcontroller-based automatic guitar tuner using DC motors. Completed as part of the Mechatronics course at Boğaziçi University during Fall 2020, this collaborative effort involved mechanical engineering students Abdullah Gedük, Sina Atalay, Ediz Ferit Kula, Alp Uysal, Elif Hacıhasanoğlu, and Kevser Didar İskender.

Project Overview

The objective was clear yet challenging: design a user-friendly device capable of accurately tuning a guitar automatically. The device needed to:

  • Allow users to select desired tuning configurations (e.g., E standard).
  • Automatically detect the current frequency of each guitar string.
  • Adjust each string precisely using DC motors until achieving the desired tuning.

Hardware Design

The device employs a Teensy 3.2 microcontroller, chosen for its superior RAM (64KB) compared to typical Arduino boards. This allows more accurate frequency detection via Fast Fourier Transform (FFT) due to higher memory capacity.

Key components include:

  • Teensy 3.2 Microcontroller for processing and motor control.
  • DC Motors (JGA25-370) selected for their strong torque (196 N*cm) and affordability.
  • H-Bridge Motor Drivers (L293D) and Hex Inverters to manage motor direction and simplify circuit design.
  • Operational Amplifier (LM386) circuit, custom-built for clear signal amplification without noise.
  • LCD screen and button-based user interface to select tuning and provide feedback.

The electrical board schematic can be found here.

Software & Signal Processing

Software development was divided into three major tasks:

1. Tuning Selection and User Interface

Users interact through buttons and an LCD display to choose tuning configurations. The device clearly indicates the selected configuration and guides users through the tuning process, displaying messages such as "Target tuning selected," "String is tuned," and finally, "Tuning is complete."

2. Frequency Detection

A critical challenge was accurately detecting the fundamental frequency of each guitar string. The initial sound signal, captured directly from an electric guitar's pickups, is amplified and fed into the Teensy microcontroller. To achieve precise frequency detection, the team applied the Fast Fourier Transform (FFT) algorithm:

  • The analog guitar signal is converted into digital samples.
  • FFT analyzes these samples to identify the dominant frequency, representing the string’s fundamental tone.
  • The optimal sampling frequency of 883 Hz was chosen for accurate and efficient computation.

Frequency spectrum of the tuned 6th string (low E, 82.4 Hz)
Figure 1: Frequency spectrum of the tuned 6th string (low E, 82.4 Hz)

3. Motor Control

Motor control logic depends directly on the frequency detected. The system calculates the difference between the measured and desired frequencies, deciding whether each string needs tightening or loosening.

A practical approach was implemented:

  • The rotation duration of the DC motor correlates linearly with the frequency difference.
  • Linear regression predicts precise motor running time, minimizing overshoot and ensuring quick, accurate tuning.
  • This algorithm achieved a critically damped tuning state, effectively eliminating oscillations and shortening the tuning duration.

Mechanical Construction

Mechanical design involved precision 3D-printing and custom-fabricated parts:

  • Nozzles connecting DC motors to guitar tuning pegs were 3D-printed for a precise fit.
  • Side plates and a base plate, cut and drilled in-house, secured the motors and provided stability.
  • The system's flexible mechanical design accommodates various guitar sizes and peg arrangements.

Mechanical assembly connecting DC motors to guitar tuning pegs.
Figure 2: Mechanical assembly connecting DC motors to guitar tuning pegs.

Production and Testing

Extensive testing and iterative refinement ensured robust performance:

  • Initial prototypes identified sizing issues, leading to iterative redesigns of 3D-printed components.
  • Simulation software validated electronic circuit designs, reducing physical trial-and-error.
  • Testing on real guitars ensured that the device reliably achieved the desired tuning configuration efficiently.

Challenges and Lessons Learned

The project team encountered several challenges, notably:

  • Frequency detection precision: Accurately extracting the fundamental frequency from signals rich in harmonics required both tuning the FFT process and managing limited memory.
  • Motor torque and precision: Initial servo motors lacked sufficient torque, necessitating a switch to robust, geared DC motors.
  • Amplifier noise: Early amplifier designs introduced unwanted noise, leading to a carefully designed low-noise operational amplifier circuit.

These challenges highlighted the importance of thorough testing and adaptability throughout the design and implementation process.

Demonstration Video

Watch our guitar tuner in action below (video in Turkish, with English subtitles available):

Conclusion

We designed and built an automatic guitar tuner that detects the pitch of each string and adjusts it using DC motors, based on real-time frequency analysis. The system includes a user interface, sound amplification and processing, and a motor control algorithm that predicts tuning time using linear regression. The final device tunes each string individually with reliable accuracy and mechanical stability.