Eguitar tuner
description
Transcript of Eguitar tuner
![Page 1: Eguitar tuner](https://reader036.fdocuments.net/reader036/viewer/2022062302/5681692e550346895de073ed/html5/thumbnails/1.jpg)
EGUITAR TUNER
Mark StockerEastern Kentucky UniversityDepartment of Technology
![Page 2: Eguitar tuner](https://reader036.fdocuments.net/reader036/viewer/2022062302/5681692e550346895de073ed/html5/thumbnails/2.jpg)
2
OUTLINE Automatic Guitar tuning Amplification of signal Frequency Measurement Harmonic Interference
![Page 3: Eguitar tuner](https://reader036.fdocuments.net/reader036/viewer/2022062302/5681692e550346895de073ed/html5/thumbnails/3.jpg)
3
MOTIVATION Beginners often
have trouble tuning their guitar properly.
Self tuning guitars such as the Gibson Robot are extremely expensive ($4000!)
http://www.youtube.com/watch?v=WetVXbYRfWk
![Page 4: Eguitar tuner](https://reader036.fdocuments.net/reader036/viewer/2022062302/5681692e550346895de073ed/html5/thumbnails/4.jpg)
4
INTRODUCTION Each guitar string vibrates at a
unique fundamental frequency. The fundamental frequency of
the string directly relates to the musical note being played via the formula:
n is the number of steps away from middle A (which is exactly 440Hz)
Hzn 4402 12/
![Page 5: Eguitar tuner](https://reader036.fdocuments.net/reader036/viewer/2022062302/5681692e550346895de073ed/html5/thumbnails/5.jpg)
5
PROBLEM STATEMENT Frequency measurement is
typically done by custom made Digital Signal Processors (DSP’s).
DSP’s take a lot of time and money to develop into a working product.
![Page 6: Eguitar tuner](https://reader036.fdocuments.net/reader036/viewer/2022062302/5681692e550346895de073ed/html5/thumbnails/6.jpg)
6
PROPOSED SOLUTION Analyze and tune the guitar using
general purpose devices that are easily acquired and very inexpensive.
Perform the signal processing and motor control in software instead of a hardware DSP device.
![Page 7: Eguitar tuner](https://reader036.fdocuments.net/reader036/viewer/2022062302/5681692e550346895de073ed/html5/thumbnails/7.jpg)
7
FREQUENCY MEASUREMENT Measure the voltage of the guitar signal
using the Atmel AVR built in Analog-to-Digital convertor (ADC).
Sample the change in voltage at a very high rate (200uS) to detect each time the waveform crosses the zero point or bias.
After a predetermined number of zero crossings have been detected, determine frequency using the formula 1/T where T is the amount of time that passed during the sample.
![Page 8: Eguitar tuner](https://reader036.fdocuments.net/reader036/viewer/2022062302/5681692e550346895de073ed/html5/thumbnails/8.jpg)
8
FREQUENCY MEASUREMENT
![Page 9: Eguitar tuner](https://reader036.fdocuments.net/reader036/viewer/2022062302/5681692e550346895de073ed/html5/thumbnails/9.jpg)
9
FREQUENCY MEASUREMENT Compare the measured readings to those known to be
in the correct range (+/- .05% of intended frequency) and tune string accordingly with a stepper motor.
Standard Guitar Tuning: Frequency (Hz) Period Samples @ 200uS E = 82.4069 0.0121 606.75 A = 110.0000 0.0091 454.5 D = 146.8324 0.0068 340.5 G = 195.9978 0.0051 255 B = 246.9417 0.0040 202.48 e = 329.62775 0.0030 151.69
![Page 10: Eguitar tuner](https://reader036.fdocuments.net/reader036/viewer/2022062302/5681692e550346895de073ed/html5/thumbnails/10.jpg)
10
PROBLEM #1 The output of the guitar is very weak. 3mV
peak-to-peak is typical. The 8-bit ADC of the AVR is setup to use a 5V
reference voltage. We have 255 usable steps over the 5 volt
range which is equal to 19mV per step. This will not allow us enough precision to
detect the zero crossings of the wave form. The bias or baseline of the guitar signal needs
to be at 2.56 volts, so we can detect both the positive and negative part of the waveform.
![Page 11: Eguitar tuner](https://reader036.fdocuments.net/reader036/viewer/2022062302/5681692e550346895de073ed/html5/thumbnails/11.jpg)
11
SOLUTION #1 Amplify and bias the signal using a simple op-amp
circuit.
![Page 12: Eguitar tuner](https://reader036.fdocuments.net/reader036/viewer/2022062302/5681692e550346895de073ed/html5/thumbnails/12.jpg)
12
PROBLEM #2 Due to the varying stiffness of steel guitar strings, along
with the fundamental frequency, harmonic frequencies are also generated, which can be quite powerful as seen below:
![Page 13: Eguitar tuner](https://reader036.fdocuments.net/reader036/viewer/2022062302/5681692e550346895de073ed/html5/thumbnails/13.jpg)
13
PROBLEM #2 The 2nd harmonic is especially powerful. Since we are only measuring zero crossings of the
waveform, the harmonics end up being measured also, producing incorrect results.
![Page 14: Eguitar tuner](https://reader036.fdocuments.net/reader036/viewer/2022062302/5681692e550346895de073ed/html5/thumbnails/14.jpg)
SOLUTION #2 To prevent false readings, we will filter the
harmonics from the signal in software, with the filter customized for each string.
I use a bitshift in this filter (>>) to do the division in order to save CPU cycles.
The value of filter is set according to current string selection. Lower values create a more narrow band-pass.
14
signal = ((filter * last_sample_value + (16 – filter) * sample_value)>>4);
![Page 15: Eguitar tuner](https://reader036.fdocuments.net/reader036/viewer/2022062302/5681692e550346895de073ed/html5/thumbnails/15.jpg)
15
RESULTS The circuit and program are
successful at reading determining the input frequency accurately.
The stepper motor assembly is successful at tuning the strings automatically, although slow.
![Page 16: Eguitar tuner](https://reader036.fdocuments.net/reader036/viewer/2022062302/5681692e550346895de073ed/html5/thumbnails/16.jpg)
16
![Page 17: Eguitar tuner](https://reader036.fdocuments.net/reader036/viewer/2022062302/5681692e550346895de073ed/html5/thumbnails/17.jpg)
17
![Page 18: Eguitar tuner](https://reader036.fdocuments.net/reader036/viewer/2022062302/5681692e550346895de073ed/html5/thumbnails/18.jpg)
18
AVR uCString Selection
BIAS
OP-AMP
Guitar Input
Darlington Array
![Page 19: Eguitar tuner](https://reader036.fdocuments.net/reader036/viewer/2022062302/5681692e550346895de073ed/html5/thumbnails/19.jpg)
Stepper Motor Gear Reduction unit Guitar
Interface
![Page 20: Eguitar tuner](https://reader036.fdocuments.net/reader036/viewer/2022062302/5681692e550346895de073ed/html5/thumbnails/20.jpg)
MEDIA
20
eGuitar tuner in action:http://www.youtube.com/watch?v=5ctUjII-M6Yhttp://www.youtube.com/watch?v=LXHzzM-_Uao
eGuitar put to the test against commercial tuner:http://www.youtube.com/watch?v=rRlvrPupO9o
eGuitar C code:http://www.stockmarker.org/AVR/eguitar/eguitar_code.html
![Page 21: Eguitar tuner](https://reader036.fdocuments.net/reader036/viewer/2022062302/5681692e550346895de073ed/html5/thumbnails/21.jpg)
21
CONCLUSIONS Considering commercial guitar tuning
devices use specialized DSP’s, I was quite surprised at how well the AVR functioned.
I learned many new things during the project, such as filtering signals in software, the use of AVR ADC and Timers, and stepper motor control.
![Page 22: Eguitar tuner](https://reader036.fdocuments.net/reader036/viewer/2022062302/5681692e550346895de073ed/html5/thumbnails/22.jpg)
22
COSTDevice Cost SourceAVR uC $3 MouserLM324 op-amp $0.50 MouserComponents $2 Mouser4x20 LCD Display $10 EBayStepper assembly $0 Junk FB ScannerPower Supply $0 Junk BoxTotal Cost: $15.50Commercial Tuner: $80Savings:$64.50
![Page 23: Eguitar tuner](https://reader036.fdocuments.net/reader036/viewer/2022062302/5681692e550346895de073ed/html5/thumbnails/23.jpg)
23
FUTURE WORK Use a shielded enclosure to prevent
outside interference. Fine tune the OP-AMP circuit and
implement hardware filters for faster and more accurate tuning.
Streamline the program by writing it in pure assembly code.
![Page 24: Eguitar tuner](https://reader036.fdocuments.net/reader036/viewer/2022062302/5681692e550346895de073ed/html5/thumbnails/24.jpg)
SOFTWAREOnly free / open source software was used in the making of this
project, except for Microsoft PowerPoint.
Operating System: Ubuntu Linux running KDEDevelopment Environment: KATECompiler: AVR-GCCAVR Programmer: AVRdudeSignal Generation: Siggen
24
![Page 25: Eguitar tuner](https://reader036.fdocuments.net/reader036/viewer/2022062302/5681692e550346895de073ed/html5/thumbnails/25.jpg)
REFERENCESAtmel Corporation, ATtiny261/461/861 Datasheet, November 7th
2006, Retrieved from: http://www.atmel.com/dyn/resources/prod_documents/doc2588.pdf
Atmel Corporation, Digital Filters with AVR, July 16th 2008, Retrieved from: www.atmel.com/atmel/acrobat/doc2527.pdf
NonGNU.org, AVR Libc Online Manual, Retrieved from: http://www.nongnu.org/avr-libc/user-manual/index.html
25