Function generators often play a critical role in the design, testing, and operation of encoders, modulators, demodulators, and measurement instruments. Here's an inexpensive way to build a bus-controlled sinewave oscillator that has downright low distortion.
The circuit generates a sinusoidal output with typical second and third harmonics down from the fundamental by -76.1 and -74.2 dB, respectively, across its full output range of 10 Hz to 10 kHz. That performance represents better than a 40-dB improvement over common diode-shaped sinewave generators, which employ a diode-shaping technique to transform a square wave into a sinewave. Typically, their second-and third-order harmonics are down from the fundamental by -35 and -25.5 dB, respectively.
The circuit consists of four sections (see the figure). At the heart of the design, the first one is the oscillator comprising an IC dual-filter building block (U1), a second-order clocked filter (whose bandpass-filter section sets the oscillator's frequency), and a comparator (U2A). The bandpass filter determines the oscillator's frequency by allowing signals only around its center frequency to pass. Equation 1 shows the oscillator frequency, and Equation 2 the filter
The second circuit section is the tracking notch filter, which is set to and tracks the oscillator's third harmonic, which is the higher-amplitude harmonic. The tracking filter is synchronously clocked with the oscillator's frequency-setting filter to provide lock-step oscillator-tracking filter-response characteristics.
Equation 3 gives the -3-dB cutoff point of the tracking filter, and Equation 4 shows the notch-filter frequency:
The third section has a buffer amplifier (U3A) with a gain of -1. This section includes a 13.3-kHz low-pass filter to reduce the high-frequency component generated by the clocking steps in the output waveform.
The fourth section is a bus-controlled clock generator that mainly comprises an IC serial-port programmable oscillator (U4), which can be either the LTC6903 for the serial peripheral interface (SPI) or the LTC6904 for the Inter-IC (I2C) interface. Some pull-up resistors, a decoupling capacitor, and a resistor in series with the output are the only external components required.
Plus, the circuit can be modified easily to produce a quadrature, sine/cosine-waveform output. Just add a second output op amp and take its input from the bandpass output of U1 (BPB at pin 11).