2026-05-22
You can build a beautiful, rock-steady triangle wave generator from just two op-amps, two resistors, and a capacitor — no crystal, no exotic ICs. The circuit pairs an integrator with a Schmitt-trigger comparator in a positive-feedback loop. The comparator output (a square wave) feeds the integrator's input; the integrator's output (a triangle wave) feeds the comparator's threshold input. Each block forces the other to flip at precise voltage limits, producing two synchronized waveforms: square out of one op-amp, triangle out of the other. This is the classic function generator core — exactly what's inside the venerable ICL8038 and XR-2206 chips.
How it works: The comparator output sits at either +Vsat or −Vsat. The integrator sees a constant input, so its output ramps linearly (V = −(Vin/RC)·t). When the triangle crosses the comparator's upper threshold, the square flips negative, and the integrator ramps the other way. Linear ramps in, sharp transitions at the corners — a near-perfect triangle.
Concrete example: Build a 1 kHz triangle generator with ±5 V peaks using a TL072 dual op-amp on ±12 V rails. Use a non-inverting Schmitt comparator with R1 = 10 kΩ from the triangle output to the +input, and R2 = 10 kΩ from the square output (call it ±10 V after saturation losses) to the same +input. The thresholds are ±Vsat·(R1/R2) = ±5 V — exactly what you want. For the integrator, pick C = 10 nF. The frequency formula is:
f = R2 / (4 · R1 · R · C)
Solving for R (integrator resistor) at f = 1 kHz: R = R2/(4·R1·C·f) = 10k/(4·10k·10nF·1k) = 25 kΩ. Use a 22 kΩ fixed resistor in series with a 10 kΩ pot for fine tuning.
Practical gotchas:
Rule of thumb: Frequency is inversely proportional to integrator RC. Halve the capacitor, double the frequency. The amplitude depends only on the comparator resistor ratio — change R1/R2 to tune peak voltage without touching frequency.
