Low Distortion Oscillator and Notch Filter
I have been intrigued by DIY low-cost distortion analyzers ever since Bob Cordell published his article on building one in Audio magazine in 1981. A copy of the article is on his website. It was an ambitious project, and I never got around to it. More recently I have used an old EMU soundcard and REW software as noted in this project.
I was contemplating building a low distortion 1KHz oscillator to refine my REW-based distortion measurement setup. The idea is to eliminate the D/A converter in the sound interface and replace it with a stable, low noise and low distortion source that can produce a pure sine wave, thereby reducing one more variable in the chain.
I researched some designs which could be done as a DIY project, including an old design by Jim Williams which was published in a Linear Technology application note in 1990, now available from Analog Devices as AN43 at this link. See page 33 in the app note. This design was said to achieve 0.0003% THD (3 ppm), below the threshold of most distortion analyzers available at that time. There is also an interesting appendix (Appendix D) in the note written by Bruce E. Hofer of Audio Precision, who worked with Jim on validating the measurements. Similar designs based on Wein bridge topology and using photoelectric or FET AGC level control have been published. One example is here, this one claiming distortion below -140dB.
This thread (and others) in the DIY Audio forum has lots of discussions about oscillators. I started to think about ready-to-run prebuilt or kit oscillators. One that seems popular is from Akita, claiming 0.0002% THD (2 ppm). It is available as a kit for $79. I also came across a little board from DIY Audio member "vicnic". He assembles and tests his oscillator boards, known as Victors oscillator. He has been refining his design for several years and recently upgraded the opamps to get really low THD. No one seems to know exactly how low it goes, since it appears to be below the threshold of contemporary analyzers.
I ordered one from him decided to build it into a spare aluminum enclosure. More recently, I have updated the oscillator project. Scroll down to see the latest.
Here is Victors little oscillator board mounted to the panel in my box. Most of the active circuitry is on the bottom - mainly SMD devices and a small PCB shield over the sensitive components.
The board is battery operated and requires 36 volts. (4x 9-volt batteries). Victor uses a virtual ground approach to split the battery voltage into +/- 18 Volt rails prior to regulation by 15 volt TL431 precision shunt references.
Below is the schematic (the most recent I could find) of Victors oscillator. It is from this post in DIY Audio.
I decided to add a passive notch filter to the box. The idea of using a notch filter after the output of the measured device is to suppress the amplitude of the fundamental tone so that the dynamic range of the measuring A/D converter can be maximized. This is a very simple Hall-type network documented in this article by Kenneth Kuhn. The two pots allow it to be tuned to the oscillator and get the best notch depth possible.
I assembled the filter on a small perf board and mounted it directly on isolated RCA panel jacks. I matched the caps to within about 0.2% by selecting components. The resistors are metal film and the pots are cermet. The notch is completely independent of the oscillator and can be hooked in or not. A preliminary test indicated I could get at least -45db suppression. Better results could be obtained with an active Hall circuit, but adding active devices would increase THD+Noise. Even the types of capacitors and resistors used can influence distortion. There is a good website here describing how to use a notch filter for making distortion measurements.
It would be better to build this with BNC connectors, which are typically used for low noise measurement equipment, but I did not have any handy. I may upgrade the whole thing (including Victors board) to BNC at some point.
Here is the completed box with the notch filter and batteries installed. I got some Keystone 9 Volt battery holders (4) and decided to place them at the rear of the box so I could use USB rechargeable Lithium cells. These have micro-USB ports on the bottom so they can be recharged. The charging cable has to be removed before powering on the oscillator. Also the middle two batteries in the series stack have to be pulled because they will not charge when connected together. One drawback is that the 4 lithium cells only produce a total of about 33.6 volts when fully charged. Since Victor's board has 15-volt shunt references to regulate the rails, there are only about 1.8 volts of margin across each of the dropping resistors, so the cells need to be at or near full charge for the oscillator to behave.
The box is way too big but it is what I had lying around.
A quick REW run with the oscillator directly feeding the XLR input on the EMU 0404 USB (also running on batteries) shows the distortion of the oscillator + the EMU A/D is very low: 0.000084% THD. THD+Noise is much higher, 0.0013%, but that is due to the noisy A/D paths in the EMU. It would require mods to get it lower. Exactly how much of the THD is due to the oscillator vs. the EMU is difficult to tell, but since we are talking about 800 Parts Per Billion, it really does not matter, since this puts the combination on par with analyzers costing thousands of dollars (at least for THD). In a DIY Audio post by Bob Cordell, he did some careful measurements on Victors oscillator and concluded that the distortion was about -150dB, which is better than any he had seen.
Based on a tip from REW's author, turning on coherent averaging in the distortion setting dialog reduces the noise level, although the main purpose is to make the harmonics more visible in the display. It is not really reducing the noise of the system. The effect is similar to using smoothing, which results in a prettier display. Interestingly, though, the THD number drops as well. I am speculating that this is due to jitter in either the oscillator and/or the ADC clock. Also, in the display below, I had switched to an FFT length of 128k and got slightly better results.
As far as using the notch filter, John, the author of REW suggests the following:
"There are two features to help with measurements made using a notch filter.
In the Distortion settings there is an option to manually enter the level of the fundamental rather than have REW determine it from the input.
To correct for the notch you can measure the notch filter response and use that to generate a calibration file which REW will apply to correct the harmonic levels. To do that I would make a sweep measurement of a loopback firstly with the notch filter in place, then another without it, then use the Trace arithmetic feature of the All SPL graph to generate (notch response)/(no notch response) and export that result as a text file to be loaded as a mic cal file. Alternatively you could just measure the notch response, offset the measurement so that the dB values correctly reflect the notch filter loss at the harmonics (the fundamental isn't critical since Manual fundamental deals with that) and export that offset notch response as text and load it as the mic cal file."
DIY member kozard added this post explaining how he did it.
Following their lead, I ran a series of tests using the calibration procedure with the notch both in and out of the loop and applying the correction factors. Theoretically, the distortion contributed by the A/D converter in the EMU should be removed by the calibration process. This is preliminary, and I only had the oscillator outputting 1 Volt into the filter, but the result was impressive. The THD is showing -140 dB. This is equivalent to 0.000009%, about .09 PPM. If I turn on coherent averaging, this drops even more to -156dB (see second chart below). The results are sensitive to the amplitude of the signal. There is only about 2 mV coming out of the filter at 1KHz, so I probably need a low noise amplifier to bring the levels up. Also, the whole setup should be converted to balanced circuitry and use well-shielded BNC connections and good cables. Also note the small bump at 60 Hz, indicating some noise pickup from AC stuff on the bench. If this is a valid setup in REW, then the oscillator is approaching -150 dB distortion, which agrees with other findings. This is below the threshold of any commercially available equipment.
Update! I built a new box for the oscillator. I wanted to have a more compact footprint and add a multi-turn pot for the level control, along with a vernier dial for fine adjust. This required removing the 20K pot from the board and running wires from the bottom of the board to the new 10-turn pot. Also, I bypassed the RCA jacks and wired in BNC connectors.
I added a mini XLR connector for a future balanced output - I'll need to add a small circuit board with an inverting opamp. This will probably be an OPA1656. For now, I don't have anything requiring balanced inputs. One DIY Audio member suggested taking the other half of the differential signal from pin 7 of the existing OPA1656 and this worked for him. The signal level is different there, but it might work OK.
Like the stepped attenuator project, I designed the front panel in KiCad and had some made up in aluminum by JLCPCB.
I built the batteries into a separate box - the same size, 50x100x100mm. I added a power socket to the back of the box to connect the two.
The front panel viewed in KiCad.
This is much better than the huge box I had the oscillator in before.
Now the issue will be - what to do with the notch filter? Well, I have started to design a new project which will combine a balanced (dual) notch filter with a low noise differential amplifier and adjustable gain.
Files: