APPLICATION BULLETIN ® Mailing Address: PO Box 11400 • Tucson, AZ 85734 • Street Address: 6730 S. Tucson Blvd. • Tucson, AZ 85706 Tel: (602) 746-1111 • Twx: 910-952-111 • Telex: 066-6491 • FAX (602) 889-1510 • Immediate Product Info: (800) 548-6132 SIMPLE FILTER TURNS SQUARE WAVES INTO SINE WAVES by R. Mark Stitt (602) 746-7445 Many signals are digitally generated or transmitted as square waves. It is often desirable to convert these signals into sine waves. For example, the 350Hz, 440Hz, 480Hz, and 620Hz telephone supervisory tones transmitted over fiber-optics may appear at curb-side as square waves. To be used in telephone equipment it is desirable to convert the square waves into low-distortion sine waves. This can be done with a simple filter. square wave. This is because the fundamental has an amplitude of 4/π times that of the square wave as shown by the Fourier series. The bandpass filter will also filter out any DC component of the square wave input as shown in Figure 1B. The circuit for a “tuned-circuit” bandpass filter using a BurrBrown UAF42 universal active filter chip is shown in Figure 2. The UAF42 contains op amps, gain-set resistors, and onchip precision (0.5%) 1000pF capacitors to form a time continuous filter, free from the anomalies and switching noise associated with switched-capacitor filters. The only external components required are three 1% resistors to set center frequency and Q. In this example, resistors are selected to produce a “tuned-circuit” bandpass filter simulating a tuned-circuit response with 350Hz center frequency and Q = 10. A computer-aided design program, FilterPro, is available free of charge from Burr-Brown to make it easy to design all kinds of active filters using the UAF42. According to its Fourier series, a 50% duty-cycle square wave consists of odd order harmonic sine waves with the fundamental at the same frequency as the square wave. Fourier Series for a Square Wave 4k sin x + 13 sin 3x + 15 sin 5x + L π where k = peak amplitude of the square wave ( ) To design a “tuned-circuit” bandpass filter with Q = 10: load FilterPro FILTER42, select Bandpass filter response, select Order n = 2, set the desired center frequency (fCENTER), and set the bandwidth to 1/10 the center frequency. You can plot the filter response and print out component values. A sine wave with the same frequency as the square wave can be gleaned by filtering out the harmonics above the fundamental. A “tuned-circuit” bandpass filter with a Q of 10 attenuates signals at three times the bandpass frequency by 28.4dB. Since the amplitude of the third harmonic is 1/3 that of the fundamental, the total attenuation of the third harmonic compared to the fundamental is nearly 40dB. The result is a low distortion sine wave as shown in Figure 1A. Notice that although the filter has unity gain, the amplitude of the sine wave output signal is greater than that of the A fourth, auxiliary, op amp in the UAF42 is available for use in other circuitry. If the auxiliary op amp is not used, connect it as a unity-gain follower with the input to ground (connect –IN to VOUT and +IN to ground). +2V +1V 0V 0V –1V 1a. A square wave passed through a simple “tunedcircuit” bandpass filter produces a low distortion sine wave. 1b. DC components of a square wave passed through bandpass filter are eliminated to produce a low distortion sine wave. FIGURE 1. Low Distortion Sine Wave. © 1993 Burr-Brown Corporation AB-058 Printed in U.S.A. December, 1993 Mismatches between the frequency of the input square wave and the center frequency of the bandpass filter will affect the sine wave output. Figure 3 shows measured sine wave output total harmonic distortion (THD) and gain variation for mismatches from 0 to ±5%. A typical mismatch of 1% gives less than 1.5% THD and less than 2% gain deviation. Variations of the square-wave duty cycle from 50% will also increase distortion due to second-order harmonic content. In applications with a pulse train or other non-50% duty cycle square wave, it may be desirable to place an inexpensive divide by two digital flip-flop ahead of the filter to assure a 50% duty cycle square-wave input. Band-Pass VOUT RF1 453kΩ 13 RF2 453kΩ 8 7 14 RF1 50kΩ R2 50kΩ VIN 2 3 R3 50kΩ C1 1000pF A1 C2 1000pF A2 A3 R4 50kΩ UAF42 RQ 2.8kΩ 11 CENTER FREQUENCY (Hz) RF1, RF2 (Ω) RQ (Ω) 350 440 480 620 453k 365k 332k 255k 2.8k 2.8k 2.8k 2.8k Component values for selected Q = 10 “tuned-circuit” bandpass filters. FIGURE 2. A Simple 350kHz, Q = 10, “Tuned-Circuit” Bandpass Filter Built with the UAF42 Requires Only Three External Components. 3.0 Gain Error 2.67 –1 2.33 2.0 –2 THD (%) Normalized Gain Error (dB) 0 1.67 THD 1.33 –3 1.0 –5 –4 –3 –2 –1 0 1 2 3 4 5 Frequency Mismatch (%) FIGURE 3. Measured Sine Wave Output THD and Normalized Gain Error vs Mismatch between Filter Center Frequency and Square Wave Input Frequency for the “Tuned-Circuit” Bandpass Filter Shown in Figure 2. The information provided herein is believed to be reliable; however, BURR-BROWN assumes no responsibility for inaccuracies or omissions. BURR-BROWN assumes no responsibility for the use of this information, and all use of such information shall be entirely at the user’s own risk. Prices and specifications are subject to change without notice. No patent rights or licenses to any of the circuits described herein are implied or granted to any third party. BURR-BROWN does not authorize or warrant any BURR-BROWN product for use in life support devices and/or systems. 2