>
section 6 of 134 min read

6. Waveform Generators

The op-amp comparator and integrator combination produces square and triangle waves with a few parts.

6.1 Square-wave (astable) oscillator: comparator + RC

A Schmitt trigger configured as a comparator, with the input fed by the output through an RC. The output drives the cap up through the resistor; the cap voltage rises until it crosses the upper threshold; the comparator flips low; the cap discharges through the resistor; crosses the lower threshold; flip high again. Result: a continuous square wave.

plaintext
              R_2
          ┌──[==]──●── V+ (positive feedback, gives hysteresis)
          │        │
   V_C ───●─── V- ─●── V_out
          │        │\│
          │        │ \●──● (to V+ via R_2 and to top of R, C)
         [C]        │ /
          │      ──│+/
          │       R_1│
         GND      GND
                       
               R
          ●────[==]── (feedback path: V_out drives the cap through R)

Period:

T=2RCln1+β1β,β=R1R1+R2T = 2 R C \ln\frac{1 + \beta}{1 - \beta}, \quad \beta = \frac{R_1}{R_1+R_2}

For β=0.5\beta = 0.5, T=2RCln32.2RCT = 2 R C \ln 3 \approx 2.2 R C.

6.2 Triangle-wave generator: comparator + integrator

Pair the square-wave generator with an integrator. The square wave is the integrator's input; the integrator's output is a triangle wave (since the integral of a square wave is a triangle).

plaintext
  Comparator → square out ─[R]──┐

                                ●── V- of integrator ──● Triangle out
                                │\│                     │
                                │ \                     │
                            GND─│+/                    [C]
                                │/                      │
                                                       GND

                       Triangle out feeds back to comparator's V+
                       through a divider, providing the hysteresis
                       and closing the loop.

Two outputs: the comparator gives a square wave, the integrator gives a triangle wave, both at the same frequency. Adjust RR on the integrator to slow down or speed up.

6.3 Sawtooth and ramp generators

Replace the integrator's continuous-discharge path with a fast reset switch (a transistor or analog switch driven by the comparator) and you get a sawtooth: the integrator ramps slowly, then snaps back to zero, then ramps slowly again. CRT timebases and op-amp-based PWM modulators use this.

6.4 Function generators

A function-generator IC like the ICL8038, XR2206, MAX038 combines a triangle generator with a sine shaper (a piecewise-linear circuit using diodes that approximates a sine from a triangle by clipping the corners). Result: simultaneous square, triangle, and sine outputs at any frequency from sub-Hz to MHz. The XR2206 also offered amplitude and frequency modulation inputs, hence the name "function generator." Modern bench instruments use direct-digital synthesis (DDS) instead, but the analog-IC approach is still popular in low-cost or low-power designs.

6.5 Wien-bridge oscillator with op-amp

A series-RC and a parallel-RC form a frequency-selective bridge whose output is in phase with the input at exactly one frequency, f0=1/(2πRC)f_0 = 1/(2\pi RC). Wrap it as positive feedback around a non-inverting amp with gain 3, and you get a sustained sinusoidal oscillation at f0f_0.

plaintext
                    ┌── R ──── C ──┐
                    │              │
   V_out ●──────────┤              ●── V+
                    │              │
                    ●── R ── ┐     │
                    │       (parallel)
                    │       [C]    │
                    └────────●─────●──── GND
                                       (also, gain-3 path: R_f / R_g
                                        from V_out to V- with R_f = 2 R_g)

The 1939 Hewlett-Packard 200A audio test oscillator (HP's first product) was a Wien-bridge oscillator. The amplitude-stabilization element was a clever incandescent lamp in the gain divider: a small bulb whose resistance rose with current, providing automatic gain control. Modern Wien-bridge oscillators use a JFET or a thermistor for the AGC. Distortion as low as 0.001% is achievable.

6.6 Voltage-controlled oscillator (VCO)

Output frequency varies with control voltage. The simplest VCO is a relaxation oscillator (cap charging through a current source) where the current is set by the control voltage. Frequency goes linear with control voltage.

VCOs are the heart of every PLL (next section), every FM modulator, every function generator's frequency knob.

The classic part is the ICL566 / NE566 VCO (sine and square outputs, 0.001 Hz to 1 MHz). The VCO74 is a CMOS variant. Modern PLL ICs include integrated VCOs with much wider tuning ranges.

6.7 Monostable (one-shot) with op-amp

Comparator + RC + a trigger input. Triggered, the output flips high, the cap charges through R until it crosses a threshold, then the comparator flips back low. Output: a fixed-width pulse, T=RCln(ratio)T = RC \ln(\text{ratio}). The dedicated 555 timer (Section 7) does this with a single chip, more robustly than discrete op-amp solutions.