Accurately measuring the frequency of a low-frequency signal takes many cycles, and is difficult on signals of relatively short duration. Measuring the period of such signals can be done rapidly and with great accuracy with the circuit presented here. It measures the period of a vibrating guitar string, checks it against the desired period, and displays the result on an LED display. All that’s required is to input the frequency from the guitar. The display will indicate which note is being played, and whether it’s Sharp, OK, or Flat.
U1 is used for input conditioning of the signal from the guitar, which is far from sinusoidal. U2 displays the note and the condition of the note. U1 can be any rail-to-rail low-power op amp, such as the LM6484. U1A provides frontend gain. Most guitars have a relatively low output (−20 to −30 dB). U1B is a low-pass filter that attenuates the higher order harmonics, and U1C is a peak detector. U1D takes 90% of the peak and compares it to the low-passed signal, producing a narrow pulse at the top of the signal. This signal drives the IRQ input of the 68HC705 processor.
The cleaned-up and squared-up output of U1 usually has some edge jitter due to the presence of upper harmonics present on the guitar string. Therefore, the processor averages three periods to reduce the effective edge jitter by a factor of 3. The software counts the internal clock pulses for three periods of the waveform. At the beginning of the fourth pulse, it resets the internal counter, calculates the period, and logically decides which note is being played and whether it’s Sharp, OK, or Flat. It then updates the display accordingly. At the next input pulse, the process starts again. If the counter ever overflows (from no input provided), the LEDs are turned off, indicating no valid input.
The basic timing accuracy is determined by the crystal used in the HC705 oscillator circuit. Using the 4.00-MHz crystal shown, the microprocessor can resolve to the nearest 2 µs of period, much more accuracy than required for guitar tuning. The LED display uses very little power. When in use, one of processor outputs A0 through A4 is driven high, and one of A5 through A7 is pulled low. This allows about 3 mA to illuminate both selected LEDs. Highoutput LEDs will give a clear indication at 3 mA. The B0 port of the chip produces the waveform shown in Figure 2, as an aid in making the circuit work with very complex waveforms.
Note: This circuit was developed to tune a five-string bass guitar. The lowest note is a low B with a frequency of 30.8677 Hz and a period of 32.3963 ms. The highest note is a G with a frequency of 97.9989 Hz and a period of 102.0420 ms. The range for OK was set arbitrarily at ±0.5% of exact pitch. Also, the decision threshold for determining whether the note was a G or a D was placed midway between the notes.
This method can be used to determine other low-frequency periods by adapting the number of periods counted and setting the acceptance threshold accordingly. For simple digital signals, the front-end analog processor can be eliminated. More complex front-end signal processing may be needed for instruments other than a bass guitar. This particular software has a maximum period measurement of 130 ms, corresponding to approximately 23 Hz.
(To see the complete software listing for this guitar tuner, go to Electronic Design’s web site at “www.elecdesign.com” and click on “Ideas For Design” icon on the home page.)