In audio electronics, the Total Harmonic Distortion (THD) is one of the most fundamental measurements.
This project aims at designing a circuit that can be used as a rough THD measurement at the frequencies 1kHz and 20kHz. These frequencies are often used when measuring and comparing performance.
The filter is designed to be able to measure THD at two frequencies:
In addition, three alternative measurement bandwidths can be selected with a switch:
Harmonic Distortion and noise
In audio electronics engineering, one of the main goals is to keep the signal as pure and undistorted as possible through the signal chain. What this means is that a pure sine wave of any frequency within the frequency range could be amplified or attenuated, but no extra frequency components (harmonics) should be introduced.
Total Harmonic Distortion (THD)
Of course, this idealization can not be acieved in practice, and harmonics will always be introduced to some extent. Introduction of these additional frequency components – or harmonics – is generally called harmonic distortion.
Specifically, the ratio of the RMS voltage of all the “extra” (unwanted) harmonics to the RMS value of the original (undestorted) is called the Total Harmonic Distortion. Mathematically, this can be written as in Equation (1) in Figure 7, where the numerator is the RMS value of the (unwanted) harmonics and the denominator is the RMS value of the fundamental.
Noise, THD+N and practical measurements
Any electronic signal chain also adds noise to the signal, in addition to the harmonic distortion. When actually measuring the distortion it is more practical to include the noise in the measurement. In that ces, the measurement is called Total Harmonic Distortion and Noise, or THD+N. A basic THD+N measurement can then be done by filtering out the fundamental with a sharp notch filter, and then measure the output of the filter with a True RMS multimeter or oscilloscope. Then the fundamental can be measured, and the THD+N can be calculated from Equation (2) in figure 7.
Where Vdist is the mearured RMS value of the notch filter output and Vin is the measured value of the original sine wave input signal at the measurement frequency. THD can take several forms but is always a ratio and is ususlly given in percentage, decibels of as a decimal number.
The practical measurement procedure is described in the User Manual document.
Measurement frequencies and measurement bandwidth
Ideally you would like to measure THD+N throughout the frequency range of the device under test, but this requires extremeny expensive equipment. However, in practical audio engineering you can get far by measuring the frequencies 1kHz and 20kHz. The circuit developed in this project has two parallel notch filter circuits at these frequencies, and a switch to select between them.
One should also limit the bandwidth of the measurements. The measurement bandwidth for THD is usually between 80kHz and 200kHz [Cordell] p. 463. The 1kHz-circuit in [Marston p. 70] has a measurement bandwidth of 10kHz.
In the circuit developed in this project the user can select between three measurement bandwidths; 10kHz, 100kHz and 200kHz.
In-depth treatment of distortion and noise can be found in the references.
Twin-T notch filter
A fundamental building block of any THD meter is an effective notch filter, which filters out the fundamental of the frequency we wish to measure. After all, the point is to measure anything (noise and harmonics) that falls outside the fundamental sine wave, and then compare that to the fundamental. Then the true rms voltage of the remaining components of the signal (harmonics and noise) can be used to calculate the THD+N of the circuit under test.
One version of the notch filter is the Twin-T filter. It’s name is evident from it’s cicuit diagram, shown in Figure 1, with component values that give a notch frequency of 1kHz.
For the filter to be effective it must be “balanced”, which means that it must be precisely tuned so that R3 has half the value of R1 or R2, and C3 has double the value as C1 and C2. In the case of the circuit below, R3 must be 8K. In practice it is necessary to have trimmable resistances (or capacitances), to trim the circuit into balance. Figure 2 shows a SPICE simulation of the circuit above, with R3 as a parameter. The sharpest notch (red curve) is for R3 = 8K, where the circuit is balanced.
The Twin-T filter has the advantage that it has a common ground (for input and output), and that it has a phase of exactly zero whan balanced, or to be more precise; the balanced filter switches abruptly between +90 and -90 degrees at fC. This can be seen on the phase plot in Figure 3, where the sharp, red curve shows the phase of the balanced circuit. This feature will be exploited when tuning/trimming the circuit, explained in the User documentation.
The drawback is that the circuit has a low Q value, which means that the attenuation at the second harmonic is quite large, around 9dB, while it should ideally be zero. This will will give a quite large error in the THD measurement (after all, the point is to measure the higher harmonics as accurately as possible, without attenuation). The magnitude plot above clearly showt the attenuation of the second harmonic.
The filter can be made considerably sharper (higher Q) by bootstrapping the common ground to the output, which opposes the attenuation. The bootstrapped version of the circuit is shown in Figure 4.
The bootstrapping comes with a natural penalty of also attenuating less at the center frequency, where we actually want more attenuation. This can be improved by using an “active” bootstrap that eliminates loading effects on the output. This improved circuit is shown in Figure 5, along with its magnitude plot in Figure 6.
We see that now the attenuation at the second harmonic is virtually zero.
It is this “actively bootstrapped” version we will use in the filter.
For a more thorough theoretical treatment of the Twin-T filter, see [Marston].
The circuit basically consists of three subcircuits;
1kHz notch filter subcircuit
The notch frequency given by Equation (3), see Figure 7.
The resistor values will be composed by one fixed resistor plus one trimpot, to tune the frequency to its notch frequency.
The following values are used; 10nF and 16kΩ (and 15kΩ + 2kΩ trim). This gives the following notch frequency:
FC = 994,7Hz@16kΩ
The practical solution will be 15kΩ in series with 1kΩ, hand pick resistors in the higher end (not below the stated values.
For the “grunded” branch the resistors shall have half the values, i.e. 7,5kΩ, or in practical values 6,8kΩ + 680Ω = 7,48kΩ.
20kHz notch filter subcircuit
For 20kHz, 470pF and 16kΩ will be used, again with 15kΩ in series with 1kΩ and values in upper end. For the “grunded” branch 7,5kΩ is used, in practice 6,8kΩ + 680Ω = 7,48kΩ.
Measurement bandwidth filters
There shall be three measurement bandwidths; 10kHz, 100kHz and 200kHz. The above formula also apply to these filters.
The component values will be as follows:
10kHz: 10nF 1,5k 10 610Hz
100kHz: 1nF 1,5k 106 103Hz
200kHz: 470pF 1,8k 188 126Hz
Choice of op amp
The op amp in this application should have the following characteristics:
For a sine voltage signal, the slew rate (SR) is given by Equation (4) in Figure 7.
The derivative is max for t = T = 1/f, for which cosine is 1, thus Equation (5).
In this case nominal inlut amplitude is 1VRMS , corresponding to √2 = 1,41V amplitude ≈ 1,5V max amplitude, at 200kHz, which gives
Thus, the op amps hould have a minimum slew rate of about 2V/μs.
Common, low-cost candidates that seem to satisfy these requirements:
Both op amps are probably excellent. Initially, we go for the TL072 to aboid problems with the realtively large input current of the NE5532. But most likevy, we will test out both.
Op amp decoupling capacitors
To make the circuit as immune to noise as possible, the power pins of the op amps must be decoupled. A common value to use is 0,1μF. While this value work well for lower frequencies (below about 10MHz depending on capacitor type), it might be counterproductive for higher frequencies. The reason is that parasitic inductance creates a resonant RC circuit around this frequency, and above it the capacitor becomes inductive. The solution is to still use the 0,1μF capacitor to cover the lower frequencies, but to add in parallel 1nF and a 33pF capacitor, both NPO. For a mode detailed treatment of this, see [Carter p. 192].
As a result I choose to add the mentioned capacitors to the positive and negative supply pins (as close as possible) of each op amp package.
Power supply filter capacitors
These are relatively large capacitors, used to smooth out noise and variations in the supplied power itself. Depending on the type of power supply a larger or moderate value can be used. In our case a regulated lab power supply is used in a controlled environment, so the value is not critical. A 10μF electrolytic should be sufficient.
Input DC block capacitor
This capacitor is meant to block DC components from entering the circuit, thereby eliminating this source of output offset.
The value is not critical. We choose a value of 1μF, and together with the 10k potmeter this should block frequencies of about 16Hz and lower.
With input voltage of 1V, the max output voltage will also have an amplitude of 1V (far outside of the notch frequency).
The maximum output current of the filter op amp will happen at frequencies where the bandwidth limiting capacitors are shorted. This means that the current through one of the 1,5k resistors will be (assuming 1V amplitude)
Imax = 1V/1500Ω = 0,7mA
The output current of the bootstrapping capacitor can be considered negligible, since the output of the potential difference between its output and the ground of the filter is just a fraction (about 1/10) of the output voltage, and the resistance it sees about 10 times higher.
Only one of the subcircuits (1kHz and 20kHz) draws output current at any time. On the other hand, all 4 op amps draws a supply current of 2,5mA each dual packet, that is, 5mA.
The total (maximum) current for the circuit is 5,7mA.
[Marston] R. M. Marston; Instrumentation and test gear manual, Newnes, 1993
[Carter] Bruce Carter; Op Amps for everyone; Newnes, 2013
[Cordell] Bob Cordell; Designing Audio Power Amplifiers, McGraw-Hill, 2011
[Self 1] Douglas Self, Small Signal Audio Design, 2nd Edition, Focall Press, 2015
[Self 2] Douglas Self, Audio Power Amplifier Design, 2nd Edition, Focall Press, 2013
Click to enlarge images below
Figure 3 Phase resonse of passive Twin-T notch filter. The different curves represent different values of R3, with the red curve showing the balanced circuit ( R3 = 8K). In this case, the phase shifts abruptly between +90 and -90 degrees, which is exploited when trimming the circuit into balance. SPICE simulation.