A Brief Description
A Brief Description
How it works?
Detailed Pin Diagram
Group Members Information
In this project, we designed and built an automatic guitar tuner. When using the tuner,
the user plucks and tunes the strings one by one. The user tells the tuner which string to
tune using mechanical switches. A green LED will be lit to indicate the selected string is
tuned. The prototype is shown below in Figure 1.
fig.1 Guitar tuner system overview
1 electret microphone
1 voltage-to-frequency converter AD654
1 switched-capacitor low-pass filter LTC1064-2
3 operational amplifiers LTC1056
Multiple resistors (values in subsequent sections)
Multiple capacitors (values in subsequent sections)
1 Arduino Uno
1 DC servo
The complete system can be divided into four sub-systems: microphone input, filter, analog frequency counter,
microcontroller, and DC servo with guitar peg attachment.
We used an electret microphone to transduce guitar audio signals into electrical signals.
The output of the microphone is connected to a 1uF capacitor. The pull-up resistor and
the capacitor filter out frequency components lower than the lowest frequency of the
guitar strings (here we chose 30Hz as the lowest string frequency is about 80Hz). The
signal is then further amplified by an inverting amplification circuit built using an
LTC1056 op-amp. The schematic is shown below in Figure 2.
The signal needs amplification because the signal directly from the microphone is not
large enough for the subsequent signal processing circuits. The values of R1 and R2 are
1k and 4.7M ohm, respectively.
fig.2 Schematic of microphone input circuit
The amplified guitar signal is then filtered with a switched-capacitor (SC) low-pass filter (LPF). We used an 8th-order Butterworth SC LPF IC chip, the LTC1064-2. The cutoff frequency of the switched-capacitor filter depends on which string is being tuned. The filter cutoff frequency is determined by the input frequency to the LTC1064 chip, which is generated by a voltage-to-frequency converter, the AD654. The circuit schematic is shown below in Figure 4. To be able to vary the output frequency of the AD654 (and thus also the LTC1064 cutoff frequency), we did the following:
Fixed input voltage and timing capacitor values: We set the input voltage Vin to be 0.5V, which is obtained through a resistor divider from the 5V power supply. We chose 1nF for the timing capacitor (CT). We chose values that would allow us to use readily-available resistor values, and that would limit the charging current going into the timing capacitor to be within the range specified on the datasheet of the AD654.
Calculated the value of the timing resistor (RT) for each guitar string: The values can be found in the table below. We calculated the resistor values based on fclk:fc = 100:1 for the switched-capacitor chip (set by tying Pin 10 of LTC1064 -5V).
fig.3 Schematic of low pass filter built with LTC1064-2 and AD654
Table 1. Timing resistor values for the six guitar strings
The output from the switched-capacitor filter chip is a sine wave because the second and higher harmonics of the guitar signals are attenuated significantly by the 8th-order Butterworth filter.
The analog frequency counter converts the sine wave output from the filter to a square
wave and shifts the DC offset of the wave into the range readable by the Arduino.
The schematic of the analog frequency counter is shown in Figure 5 below. It consists of a
Schmitt trigger and a DC level shifter. The two triggering voltages are (R1 / R2) * Vz, which
are determined by the Zener diode voltage (Vz) and the resistor values. We want the
triggering voltages to be about +/- 0.5V because the output from the filter is about +/-
0.8V for the lowest-frequency string (and becoming larger when string frequency
increases). We used 3.3V Zener diodes. To get +/- 0.5V triggering voltages, we chose R1 =
1k and R2 = 6.1k.
The level shifter is based on an op-amp. We want the input to the Arduino to be within
the range 0 - 5 V, but the output of the Schmitt trigger is -5V to 5V.
For an inverting op-amp, (Vin - VREF) / R3 = - (Vout - VREF) / R4
And given the conditions that Vin = -5V ? Vout = 5V and Vin = 5V ? Vout = 0V
We can get that VREF = 1.4V and R4 / R3 = 0.75. We chose R3= 3.9k, R4 = 3k.
VREF is obtained by a voltage divider from 5V, the two resistors are 5.1k and 1.5k
fig.4 Schematic of analog frequency counter circuit
We used an Arduino Uno as the microcontroller. The Arduino code is included in the Appendix. There are two main components in the code: 1) count the frequency of the input square wave, and 2) output a PWM signal to the servo based on the difference between the read-in frequency and the desired frequency. The frequency is counted using an analog comparator interrupt. We compare the input square wave with 1.1V (done by setting the 6th bit of the ACSR register for the analog comparator to 1). Every time there is a rising edge, the interrupt request routine is executed and the count is incremented. This continues until 50 cycles are counted, at which point the Arduino calculates the average frequency over these 50 cycles by dividing the total time elapsed by the number of cycles. This average frequency can be affected by startup jitter, noise, etc. So frequencies more than 30Hz away from the target frequency are rejected. The servo is driven by PWM output from the Arduino. The Arduino will only attempt to tune the string when the parsed frequency value is within the 30Hz range of the desired frequency. The Arduino will continue to sample to frequency and turn the servo until it detects a frequency that is +/- 1 Hz away from the desired frequency. Once the Arduino detects that the string is in tune, the Arduino turns a green LED on and stops all movement of the servo. The LED will remain on and the servo will not turn until the Arduino receives a new string input to tune.
The DC servo drives a mechanical device made of plastic, which is attached to one of the guitar pegs. When the servo rotates according to the PWM output from Arduino, it turns the peg and drives it to the desired position. The microphone is listening to the guitar note continuously, and when the system detects that the string has been tuned (i.e., the peg is turned into the correct position), the Arduino will stop the DC servo and light up the green LED.
fig.5 Block Diagram
Taking amplitude as voltage input from microphone by strobing guiter strings.
Fitwering noise and filtering frequency with band pass filter.
Amplifying the input with op-amp.
Level shifting the input to a particular level to avoid the negetive values.
Converting the input (sign wave) to square wave with schematic trigger.
Taking the square wave to arduino uno's ADC pin.
Data sampling and analyzing with arduino code to detect the current frequency.
Calculating motor rotation to reach to the standard frequency from current frequency.
Rotating the motor according to calculated rotation which is connected with a rotating robotic hand and the robotic hand rotates the nob of a certain string acording to the rotation of motor to reach the the string to proper frequency.
fig.6 Pin Diagram(Arduino Uno)
Guiter sound input, taken from microphone was the first difficulty as it outputs too much noise along with inconsistent data too often.
The oscilloscope that was granted for us for this project lagged too much while obseving waves from guiter string and too often it showed unpredictable behviour while showing sound input.
Rotating the nobs of guiter with dc servo was a challange because often it was needed to rotate the motor more than 180 degree so we had to change dc servo and use servo motor with continuous rotation.
Section A1: Group 5
Asif Mahmud (1205015)
Tasiful Islam (1205025)
Tanmoy Basak Anjan (1205033)
Shadman Mahdi Rahman (1205049)
Md. Aashikur Rahman Azim
Md. Iftekharul Islam Sakib
Md. Tarikul Islam Papon
Back to top