A couple weeks ago I built a simple 1KHz 6Vpp Sine Wave Generator from a handful of opamps and passives I had laying around. You can check out that project
here.
I thought it would be fun to quantify just how good of a Sine Wave this circuit was; after all it was just a wave-shaped triangle wave, so I wasn't expecting too much. But if I quantify how good of a sine wave it is I can tweak the circuit to try and make if better.
Since my Sine Wave is at 1KHz I thought I'd measure its quality using an audio Total Harmonic Distortion (THD) technique.
Essentially, a perfect sine wave should only have a single frequency component at the fundamental frequency, but real sine waves have harmonic distortion. This harmonic distortion is the part of the sine wave that we really don't want; a poor sine wave has lots of harmonic content and a good sine wave has little to no harmonic content. So if we measure the amplitude of the harmonics we can quantify how good our sine wave is!
What we need to do is design a Notch filter at 1KHz. This will remove the fundamental frequency and leave the Harmonic content. Below is an LTSPICE schematic of Sine Wave Generator and Notch Filter.
The next picture is the frequency response of the notch filter; you can see it is centered at 1KHz.
When the 1KHz signal is passed through the 1KHz centered notch filter the fundemental frequency is removed and what is left is the Harmonic content. You can see the 3rd harmonic at ~3KHz is what is left.
(The blue is the signal coming out of the Filter)
Below is the FFT of the input Sine Wave and the Output of the Notch Filter; you can see the fundamental frequency amplitude is lower with minimal effect on the harmonic content.
Now that I had a base line simulation working I grabbed my soldering iron and built up the 1KHz Notch Filter dead bug style in an Altoids box. I wish I had a Network Analyzer or at minimum a Spectrum Analyzer with a tracking output to measure my filters frequency response, but all I had was a function generator and a scope. I swept the function generator's output frequency from 10Hz to 100KHz and could see that my filter worked well at filtering out 1KHz signals.
(Channel A = Input Signal, Channel B = Output of Notch Filter)
The output of the Sine Wave generator measured 2.25Vrms and the output of the Notch filter was 139mVrms. This gives me a THD of (139mV/2.25V) = 6%
I wanted a second opinion, so I grabbed a HP 331A Distortion Analyzer and set it up. I hadn't used one of these since I interned at an RF Radio Manufacturer back in 2002. I used it to measure receiver sensitivity performance.
I had to dig up a manual to remember how to setup the HP 331A. It is a bit confusing because you have to setup the meter to 100% full scale based on your input, then adjust the frequency & balance adjustments until you get the lowest % THD reading. I monitored the Output of the 331A with a scope to see that I had fully removed the 1KHz fundamental and all that was left was a dirty looking 3KHz waveform (3rd harmonic).
The HP 331A measured a THD of 7.4%; pretty close to my homemade notch filter 6% reading. It makes sense that my filter's THD measurement would be lower, because it probably attenuated the 3rd harmonic a bit more than the much more precise HP 331A's notch filter would do.
Below is a scope screen shot of the output of my notch filter (top) and the output of the HP 331A (bottom).
Both filters did a nice job removing the fundamental and the 3rd harmonic is defiantly the most dominate remaining frequency. This was a fun project and cool to see that my Notch Filter implementation's THD readings weren't that far off from a HP331A's measurements.
Update: Sept. 13th, 2011
I thought I would do one last test to see the performance of the Notch Filter on a much cleaner sine wave. I used a BK Precision 3011B to generate an identical (but much cleaner) 1KHz 6Vp-p Sine Wave and used the Notch Filter to measure its THD.
The center frequency of my notch filter looks to be ~1074Hz; that is where I got the best filter performance.
(Top = Input Sine Wave, Bottom = Output of Notch Filter)
The THD measured was (19.5mVrms / 2.25Vrms) = 0.86%, a much cleaner Sine Wave than my home brewed one at 6%.
Here are Links to my LTSPICE files:
Sine_&_Filter,
Filter, and
Filter_ac.
Link to HP 331A
Manual.
References:
Distortion Analyzer by Rod Elliott
HP Journal: Distortion Analyzer
Texas Instruments Notch Filter AppNote