  ## Sine-wave oscillator

In Fig. 1, an op-amp can be made to oscillate by feeding a portion of the output back to the input via a frequency-selective network, and controlling the overall voltage gain.

For optimum sine-wave generation, the frequency-selective network must feed back an overall phase shift of zero degrees, while the gain network provides unity amplification at the desired oscillation frequency. The frequency network often has a negative gain, which must be compensated for by additional amplification in the gain network, so that the total gain is unity. If the overall gain is less than unity, the circuit will not oscillate; if the overall gain is greater than unity, the output waveform will be distorted. As Fig. 2 shows, a Wien-bridge network is a practical way of implementing a sine-wave oscillator. The frequency-selective Wien-bridge is constructed from the R1-C1 and. R2-C2 networks. Normally, the Wien bridge is symmetrical, so that C1= C2 = C and R1= R2 = R. When that condition is met, the phase relationship between the output and input signals varies from  90° to + 90°, and is precisely 0° at a center frequency, fo, which can be calculated using this formula:
f = 1/(2piCR)

The Wien network is connected between the op-amp's output and the non-inverting input, so that the circuit gives zero overall phase shift at fo, where the voltage gain is 0.33; therefore, the op-amp must be given a voltage gain of 3 via feedback network R3-R4, which gives an overall gain of unity. That satisfies the basic requirements for sine-wave oscillation. In practice, however, the ratio of R3 to R4 must be carefully adjusted to give the overall voltage gain of precisely unity, which is necessary for a low-distortion sine wave.

Op-amps are sensitive to temperature variations, supply-voltage fluctuations, and other conditions that cause the op-amp's output voltage to vary. Those voltage fluctuations across components R3-R4 will also cause the voltatage gain to vary. The feedback network can be modified to give automatic gain adjustment by replacing R3-R4 gain-determining network wit a gain-stabilizing circuit. figs 3 through 7 show practical versions of Wein-Bridge oscillators having automatic amplitude stabilization. Fig 3 shows a 1KHz fixed frequency oscillator. the output amplitude is stabilized by a Negative Temperature Coefficient (NTC) thermistor Rt which, together with R3 forms a gain-determing feed back network. The thermistor is heated by the mean power output of the op-amp.

The desired feedback thermistor resistance value is triple that of R3, so the feed-back gain is x 3. When the feedback gain is multiplied by the frequency network's gain of 0.33, the overall gain becomes unity. If the oscillator output amplitude starts to rise, RT heats up and reduces its resistance, thereby automatically reducing the gain of the circuit, which stabilizes the amplitude of the output signal. An alternative method of thermistor stabilization is shown in Fig. 4.In that case, a low-current lamp is used as a Positive Temperature Coefficient (PTC) thermistor, and is placed in the lower part of the gain- determining feedback network. If the output amplitude increases, the lamp heats up thereby increasing its resistance, reducing the feedback gain, and providing automatic amplitude stabilization. That circuit also shows how the Wien network can be modified by using a twin-ganged potentiometer to make a variable-frequency oscillator over the range 150 Hz to 1.5 kHz. The sine-wave output amplitude can be made variable using R5.

A slightly annoying feature of thermistor-stabilized circuits is that, in variable-frequency applications, the output amplitude of the sine wave tends to "jitter" or "bounce" as the frequency control potentiometer is swept up and down its range. ## Diode stabilization

The jitter problem of variable-frequency circuits can be minimized by using the circuits of Figs. 5 or 6, which rely on the onset of diode or Zener conduction for automatic gain control. In essence, R3 is for a circuit gain slightly greater than unity when the output is close to zero, causing the circuit to oscillate; as each half-cycle nears the desired peak value, one of the diodes starts to conduct, which reduces the circuit gain, automatically stabilizing the peak amplitude of the output signal. That "limiting" technique typically results in the generation of 1% to 2% distortion on the sine-wave output. The maximum peak-to-peak output of each circuit roughly double the breakdown vc age of its diode regulator element.

In Fig. 5, the diodes start to conduct at 500 mV, so the circuit gives output of about 1-volt peak-to-peak. In Fig. 6, the Zener diodes D1 andl are connected back-to-back, and can have values as high as 5 to 6 volts, giving a p-p (peak-to-peak)output about 12 volts. Each circuit is set by adjusting R3 for the maximum value (minimum distortion) at which osciliation can be maintained across the frequency band. The frequency range of Wein bridge oscillators can be altered by changing the Cl and C2 values increasing Cl and C2 by a decade reduces the output frequency by a decade. Figure 7 shows the circuit of a variable-frequency Wien oscillator that covers the range 15 Hz to 15 kHz in three switched-decade ranges. The circuit uses Zener-diode amplitude regulation, and its output is adjustable by both switched and fully-variable attenuators. Notice that the maximum useful operating frequency is restricted by the slew-rate limitations of the op-amp. The limit is about 25 kHz using a LM741 op-amp, or about 70 kHz using a CA3140. ## Twin-T oscillators

Another way of designing a sine- wave oscillator is to wire a twin-T network between the output and input of an inverting op-amp, as shown in Fig. 8. The twin-T network comprises R1-R2-R3-R4 and CI-C2-C3. In a "balanced" circuit, those components are in the ratios R1 = R2 = 2(R3 + R4), and Cl = C2 = C3/2. When the network is perfectly balanced, it acts as a notch filter that gives zero output at a center frequency (f0), a finite output at all other frequencies, and the phase of the output is 180° inverted. When the network is slightly unbalanced by adjusting R4, the network will give a minimal output at fo.

By critically adjusting R4 to slightly unbalance the network, the twin-T gives a 180° inverted phase shift with a small-signal fo. Because the inverting op-amp also causes a 180° input-to-output phase shift, there is zero overall phase inversion as seen at the inverting op-amp input, and the circuit oscillates at a center frequency of 1 kHz. In practice, R4 is adjusted so that oscillation is barely sustained, and under that condition the sine wave has less than 1% distortion. Figure 9 shows an alternative method of amplitude control, which results in slightly less distortion. Here, Dl provides a feedback signal via potentiometer R5. That diode reduces the circuit gain when its forward voltage exceeds 500 mV. To set up the circuit, first set R5 for maximum resistance to ground, then adjust R4 so that oscillation is just sustained. Under those conditions, the output signal has an amplitude of about 500 mV p-p. Further R5 adjustment enables the output signal to be varied between 170 mV and 300-mV RMS.

Note that twin-T circuits make good fixed-frequency oscillators, but are not suitable for variable-frequency operation due to the difficulties of varying three or four network components simultaneously. ## Square-wave generator

An op-amp can be used to generate square-waves by using the relaxation oscillator configuration of Fig. 10. The circuit uses dual power supplies, and the op-amp output switches alternately between positive and negative saturation levels. When the output is high, Cl charges via R1 until the stored voltage becomes more positive than the value set by R2-R3 at the non-inverting input. The output then regeneratively switches negative, which causes Cl to start discharging via R1 until Cl voltage falls to the negative value set by R2-R3. The output then regeneratively switches positive again, and the whole sequence repeats ad infinitum.

A symmetrical square wave is developed at the output, and a non-linear triangular waveform is developed across Cl; those waveforms swing symmetrically on both sides of ground. Notice that the operating frequency can be varied by altering either the R1 or Cl values, or by altering the R2-R3 ratios, which makes that circuit quite versatile. Figure 11 shows how to design a practical 500 Hz to 5-kHz square- wave generator, with frequency variations obtained by altering the attenuation ratio of R2-R3-R4. Figure 12 shows how to improve Fig. 11 by using R2 to preset the range of frequency control R4, and by using R6 as an output amplitude control. Figure 13 shows how to design a general purpose square-wave generator that covers the 2 Hz to 20-kHz range in four switched-decade ranges. Potentiometers R1 to R4 are used to vary the frequency within each range: 2 Hz-20 Hz, 20 Hz-200 Hz, 200 Hz-2 kHz, and 2 kHz-20 kHz, respectively. ## Variable duty-cycle

In Fig. 10, Cl alternately charges and discharges via R1, and the circuit generates a symmetrical square-wave output. That circuit can be modified to give a variable duty-cycle output by providing C1 with alternate charge and discharge paths. In Fig. 14, the duty cycle of the output waveform is fully variable from 11:1 to 1:11 via R2, and the frequency is variable from 650 Hz to 6.5 kHz via R4. The circuit action is such that Cl alternately charges through R1-D1 and the bottom of R2, and discharges through R1-D2 and the top of R2. Notice that any variation of R2 has negligible effect on the operating frequency of the circuit. In Fig. 15, the duty cycle is determined by CI-DI-RI (mark), and by C1-D2-R2 (space). The pulse frequency is variable between 300 Hz to 3 kHz via R4. ## Resistance activation

Notice from the description of the oscillator in Fig. 10 that the output changes state at each half cycle when the Cl voltage reaches the threshold value set by the R2-R3 voltage divider. Obviously, if Cl is unable to attain that value, the circuit will not oscillate. Figure 16 shows a resistance activated oscillator that will oscillate only when R4, which is in parallel with Cl, has a value greater than R1. The ratio of R2:R3 must be 1:1. The fact that R4 is a potentiometer is only for illustration. Most resistance-activated oscillators use either thermistors or LDR's, which simulate the potentiometer action. Figure 17 is a precision "light-activated" oscillator (or alarm), and uses a LDR as the resistance activating element. The circuit can be converted to a "dark-activated" oscillator by transposing the position of LDR and R1. Figure 18 uses a NTC thermistor, RT, as the resistance-activating element, and is a precision over-temperature oscillator/alarm. The circuit can be converted to an under-temperature oscillator by transposing RT and Rl.

The LDR or RT can have any resistance in the range from 2000 ohms to 2 megohms at the required trigger level, and R1 must have the same value as the activating element at the desired trigger level. RI sets the trigger level; the Cl value can be altered to change the oscillation frequency. ## Triangle/square generation

Figure 19 shows a function generator that simultaneously produces a linear triangular wave and a square wave using two op-amps. Integrator ICI is driven from the output of IC2, where IC2 is wired as a voltage comparator that's driven from the output of ICI via voltage divider R2-R3. The square-wave output of IC2 switches alternately between positive and negative saturation levels.

Suppose, initially, that the output of IC1 is positive, and that the output of IC2 has just switched to positive saturation. The inverting input of IC1 is at virtual ground, so a current IR1 equals + VsAT/R1. Because RI and Cl are in series, IR1 and Icl are equal. Yet, in order to maintain a constant current through a capacitor, the voltage across that capacitor must change linearly at a constant rate. A linear voltage ramp therefore appears across Cl, causing the output of ICI to start to swing down linearly at a rate of 1/ Cl volts per second. That output is fed via the R2-R3 divider to the non-inverting input of IC2.

Consequently, the output of ICI swings linearly to a negative value until the R2-R3 junction voltage falls to zero volts (ground), at which point IC2 enters a regenerative switching phase where its output abruptly goes to the negative saturation level. That reverses the inputs of IC1 and IC2, so IC1 output starts to rise linearly until it reaches a positive value that causes the R2-R3 junction voltage to reach the zero-volt reference value, which initiates another switching action.

The peak-to-peak amplitude of the linear triangular-waveform is controlled by the R2-R3 ratio. The frequency can be altered by changing either the ratios of R2-R3, the values of R1 or Cl, or by feeding RI from the output of IC2 through a voltage divider rather than directly from op-amp 1C2 output. In Fig. 20, the current input to Cl (obtained from R3-R4) can be varied over a 10:1 range via RI, enabling the frequency to be varied from 100 Hz to 1 kHz; resistor R3 enables the full-scale frequency to be set to precisely 1 kHz. The amplitude of the triangular waveform is fully variable via R5, and the square wave via R8. The output generates symmetric waveforms, since Cl alternately charges and discharges at equal current values determined by R3-R4. Figure 21 shows how to modify Fig. 20 to make a variable symmetry ramp/rectangular generator, where the slope of the ramp and duty cycle is variable via R4. Cl alternately charges through R3-D1 and the upper half of R4, and discharges through R3-D2 and the lower half of R4. ## Switching circuits

Figure 22 shows the connections for making a manually triggered bistable circuit. Notice that the inverting terminal of the op-amp is tied to ground via RI, and the non-inverting terminal is tied directly to the output. Switches SI and S2 are normally open. If switch Si is briefly closed, the op-amp inverting terminal is momentarily pulled high, and the output is driven to negative saturation; consequently, when S1 is released again, the inverting terminal returns to zero volts, but the output and the non-inverting terminal remains in negative saturation. The output remains in that state until S2 is briefly closed; that switches the output to a stable positive saturation state until SI is closed again. Figure 23 shows how Fig. 22 can be modified for operation from a single- ended power supply. Finally, Fig. 24 shows how to connect an op-amp as a Schmitt trigger, which can be used to convert a sine wave into a square wave. Suppose, -initially, that the op-amp's output is at a positive saturation value of 8 volts. Under that condition the R1-R2 divider feeds a positive reference voltage about 80 mV to the non-inverting input. Consequently, the output remains in that state until the input voltage rises to a value equal to 80 mV. The op-amp's output will then switch regeneratively to a negative saturation level of  8 volts, thereby feeding a reference voltage of  80 mV's to the non-inverting input. The output remains in that state until the input falls to  80 mV; at that point, the output regeneratively switches back to the positive saturation level. The switching levels can be altered by changing the R1 value.

Revised 2013 by Larry Gentleman