High Level Design

 

High Level Design

 

We got the idea for this project by browsing through previous years’ project websites. Both of us play guitar and we both have a hard time keeping our instruments in tune. (partly because we can’t tune by ear and partly because of Ithaca’s weather). We knew that making a guitar tuner was feasible because there are portable guitar tuners. We figured that if we amplified the signal enough, did some hardware and software filtering, and displayed how far off the frequency was to the user, we’d be able to produce a tuner that could tune all six strings to within acceptable bounds.

 

To accomplish the hardware amplification, we used a DC biasing element as well as a non-inverting amplifier. Below is a general circuit for such a task. Note: this is only part of the circuit we ended up using; please see Program/Hardware Design for the complete circuit.

 

Component

 

C1

 

 

R1s

 

 

R2, R3

 

 

C2

 

 

Op-amp

          Purpose

Blocks low frequency noise and DC from the guitar.

 

Provide a DC offset (2.5V when Vcc = 5).

 

Set the gain of the op-amp. Av = 1 + R2/R3.

 

Blocks DC amplification.

 

Amplifies

 

 

Fig. 1: A general circuit that amplifies AC and introduces a DC bias with a table describing the role of each component.

 

 

A note about guitar strings (ha): Though strings are tuned to a fundamental frequency they simultaneously vibrate at other frequencies. The fundamental frequency is known as the first harmonic because it is most prominent and defines the tone of the string. The other harmonics (2nd, 3rd, etc interfere with the 1st). See the graph below

 

Fig. 2: This is the DFT of a 16 ms sample of the input from the B-string. Notice that all the harmonics occur at multiples of the fundamental frequency and the second harmonic is very large.

 

There are also some basics about sampling, period and frequency the reader must understand before continuing. Frequency (f) is the inverse of period (T). The ADC can only effectively measure inputs in terms of period using time between samples (we would need a Fourier transform to measure frequency) thus we had to take our target frequencies and convert them to periods by taking their inverse. Also, the ADC samples at a finite intervals. According to the Nyquist sampling criterion, we must sample at least at twice the highest frequency to assure complete frequency data acquisition. Though the highest frequency we were trying to tune to was 329Hz, the string had higher harmonics (i.e. 2 and 3 times the fundamental frequency), necessitating a sampling frequency of something like 5000Hz or a sampling period of 0.2ms. The amount of samples can be used as a measure of the period as shown in the table below:

 


Table 1: “Standard E” Tuning
 
String   Frequency(Hz)    Period(s)   Samples at 5kHz (0.2ms)
 
1         E = 82.4069      0.0121     60.675
2         A = 110.0000     0.0091     45.45
3         D = 146.8324     0.0068     34.05
4         G = 195.9978     0.0051     25.5
5         B = 246.9417     0.0040     20.248
6         e = 329.6277     0.0030     15.169
 

Since the distances between certain sampling values were small (for instance between string 6 and string 5) we had to measure multiple periods to get higher accuracy. This is discussed in the Program/Hardware Design section of the report.

 

The logical structure of the program was the following: Every 0.2 ms the device reads the input from ADC and creates a sampled signal. The sampled signal is then filtered with a low-pass filter specific to the frequency of the string being tuned. Next, the program measures the period of the filtered signal by counting ten positive-edge zero-crossings. The sum of ten periods is compared with a target value and appropriate LEDs are lit to indicate the string is either too high, too low, or in tune. There are five LEDs with the central LED indicating that the guitar is in tune. If the guitar is near the correct frequency the LEDs above and below the central LED indicate that the string is high or low respectively. If the guitar string is not close to the correct tone then highest and lowest LEDs are used instead.

 

We didn’t use any IEEE, ISO, or ANSI standards. Nor did we make use of copyrighted code, patents, and trademarks.