Measure Your Filter's Characteristics
Once you understand the differences between filters, you can make corrections to take precise measurements.
Chao-Sun Pang, RC Electronics, Santa Barbara, CA -- Test & Measurement World, 4/1/1999
| Data-acquisition systems frequently use analog filters to reduce errors caused by aliasing. If your system uses a low-order antialiasing filter, or if you don’t know the characteristics of your filter, then you could collect inaccurate data. By running three tests in the time domain and in the frequency domain, you can learn which filter the manufacturer installed, or if you even have a filter. Data-acquisition systems often include Bessel, Butterworth, or Cauer (elliptical) analog filters to minimize aliasing. The three types of low-pass analog filters have different characteristics (see Table 1). Some have sharper cutoffs than others but may introduce errors on their pass bands. Some amplify their input signals near the cutoff frequency while others attenuate signals there. (Some systems use Chebychev filters, but we won’t discuss them in this article.)
Systems that use sigma-delta analog-to-digital converters (ADCs) may also use digital filters to further process the signals. But digital filters can’t minimize aliasing, so you still need an analog filter ahead of the system’s ADC. To test the filters, you’ll need a function generator, and you should have software in your data-acquisition system that can display digitized analog signals in graphic format (a scope-like display). If your system doesn’t have such software, you can export the data to a spreadsheet. Test 1 helps you identify the filter type. Generate a square wave with a frequency that’s low relative to the filter’s cutoff frequency, as listed in the data-acquisition system’s specs. Typically, the filter’s cutoff frequency will be in the tens to hundreds of kilohertz. For a 1-kHz filter and a 10-kHz sample rate, we suggest using a 5-V, 20-Hz square wave. That will produce the results in Figure 1 and Table 2. Table 2 shows that you can identify the filter by the amount of ringing at the edges of the square wave.
Thus, by simply looking at the ringing produced by a square-wave, you can find which filter type—Cauer, Butterworth, Bessel, linear phase—you have. Just knowing which type of filter you have, however, won’t help you collect accurate data. You need more tests. The next test lets you view the filter’s frequency response. For Test 2, use a fast Fourier transform (FFT) of a digitized square wave to produce a frequency plot that will reveal the filter’s rolloff. The rolloff will tell you if your filter is providing enough protection against aliasing. To perform the frequency-response measurement, produce a square wave at a low frequency. In our tests, we used the same square wave that we used in Test 1. Capture about one cycle of the square wave and perform an FFT on the data. If your system samples at 10 ksamples/s (100 ms per sample) and you perform a 512-point FFT, a single cycle period will be 5.12 ms (100 ms x 512) or 19.5 Hz. Filtering with an FFT The FFT gives you a good visual representation of your filter’s cutoff frequency and rolloff. The graphs also indicate whether or not your filter is adequate. If you have a system with a filter that doesn’t remove all signal frequency at half of your sampling rate, you’ll have trouble with aliasing. Because we used a 10-kHz sampling rate, the filter must attenuate all signals with frequencies of 5 kHz and above to the noise floor. Even if your filter’s output rolls off well below half your sampling rate, the filter may not faithfully reproduce the signal that’s in the filter’s passband. The results from Test 3 can provide the missing information. To perform this test, alter the frequency of a sine wave and measure either the peak-to-peak voltages or rms levels. If you sweep the frequency of a sine wave from 100 Hz to 4 kHz, you’ll get results like those in Table 3. Because we chose to measure RMS volts, a measurement of 0.707 V indicates no attenuation by the filter.
Although Test 3 uses a sine wave and Test 2 used a square wave, these measurements provide similar rolloff readings. Test 3, however, also provides passband information that the rolloff test can’t. Note that for the Cauer filter, the measured RMS voltage is higher at 900 Hz than at 100 Hz. That indicates that a Cauer filter’s response falls within the passband. Although the Bessel filter’s frequency response fell to the noise floor adequately in Test 2, the filter attenuates the signal and doesn’t give a faithful reproduction of the signal in its passband. The Bessel filter’s response doesn’t roll off as quickly above the 1-kHz cutoff frequency as do the Cauer and Butterworth filters (Table 2). The linear-phase digital filter has the sharpest cutoff. While you do need an analog filter, you can use a digital filter to compensate for limitations on it. (continued) So far, we’ve assumed that your data-acquisition system has a filter, but not all do. If your system has no filter, then Test 1 will show a perfect square wave similar to the Bessel filter. If you compare the Bessel filter’s square wave output to an unfiltered one, you’ll find the risetime of the unfiltered signal is faster than the risetime of a Bessel filter. The square wave on the left side of Figure 2 looks the same as the square wave for the Bessel filter in Figure 1. (The graphs shown lack the resolution to view the difference in risetimes.) The lack of a filter will also affect the results of Tests 2 and 3. With no filter, Test 2 will produce a flat line to 5 kHz after an initial decay (Fig. 2). When you perform Test 3 with no filter, you’ll get inconsistent measurements because the sine wave has frequency components that exceed half of your maximum sampling rate (5 kHz in this example). Those inconsistencies are caused by aliasing.
Although the Bessel, Butterworth, Cauer, and linear-phase delay filters are accepted anti-aliasing filters, none are perfect. If your filter doesn’t remove all signal frequency above one-half of your sampling rate, your anti-aliasing filter won’t provide adequate protection. If your filter doesn’t hold a steady signal in the passband, your system will lose accuracy. T&MW FOR FURTHER READING Chao-Sun Pang holds a B.S. in Physics and an M.S. in Scientific Instrumentation from the University of California at Santa Barbara. He currently is the vice president of marketing at R.C. Electronics. chaop@rcelectronics.com. |























