New York, NY IMG HI 58° LO 56° Home About Contact
IMG-LOGO
Home › Learning Resources › Electronics Engineering Resources › Op-Amp Waveform Generators: Triangular, Square and Sine Wave Circuits
Electronics Engineering Resources

Op-Amp Waveform Generators: Triangular, Square and Sine Wave Circuits

How op-amps generate square, triangular and sine waves: circuits, working principles, design formulas, op-amp selection and calculators for frequency, amplitude and slew rate.

26 November, 2026 11 min read

Quick Answer — Op-Amp Waveform Generators

An op-amp waveform generator creates repeating signals with feedback. A square wave generator is an astable multivibrator: an op-amp comparator with positive feedback and an RC timing network, with period T = 2RC ln((1+β)/(1−β)). A triangular wave generator using an op-amp is a comparator plus an integrator in a loop, with f = R3 / (4 R2 R C). A sine wave comes from an oscillator such as the RC phase shift oscillator (f = 1/(2πRC√6), gain at least 29) or the Wien bridge oscillator (f = 1/(2πRC), gain at least 3).

1. Waveform Generator Basics

With feedback, an operational amplifier can make its own signal without any input. Two ideas appear again and again: a comparator with positive feedback flips between two output levels (a square wave), and an integrator turns a constant level into a steady ramp (a triangular wave). A sine wave needs a different approach: an oscillator whose feedback gives exactly the right phase and just enough gain.

The Three Basic WaveformsSquare waveJumps between +Vsat and -VsatTriangular waveLinear ramps up and downSine waveSmooth, single frequencySquare from a comparator, triangle by integrating it, sine from an oscillator or a shaper.

Figure 1: The three basic waveforms and how they relate.

WaveformCircuitKey idea
SquareAstable multivibrator (relaxation oscillator)Comparator with positive feedback plus RC timing
TriangularComparator + integrator loopIntegrating a square wave gives a ramp
SineRC phase shift or Wien bridge oscillatorLoop phase 360° and loop gain of 1

2. Square Wave Generator Using Op-Amp

The op-amp square wave generator (also called an astable multivibrator or relaxation oscillator) needs no input. The output sits at +Vsat or −Vsat. Resistors R1 and R2 feed a fraction β of the output back to the non-inverting input, while R and C charge the inverting input toward the output level.

Square Wave Generator (Astable Multivibrator)+−VoR1R2RCPositive feedback via R1, R2 sets the thresholds. R and C set the timing.

Figure 2: Positive feedback sets the thresholds; R and C set the timing.

How it works

  1. Suppose the output is at +Vsat. The non-inverting input sits at +βVsat.
  2. The capacitor charges through R toward +Vsat.
  3. When its voltage passes +βVsat, the comparator flips the output to −Vsat.
  4. The threshold becomes −βVsat and the capacitor now charges toward −Vsat.
  5. When it reaches −βVsat, the output flips again. The cycle repeats.
Inside the Square Wave Generator+βVsat-βVsatCapacitorvoltageOutput Vo+Vsat-VsatThe capacitor charges toward the output level; the output flips when it crosses ±βVsat. Here β = 0.5.

Figure 3: Capacitor voltage ramps exponentially between the two thresholds while the output flips.

β = R2 / (R1 + R2)
T = 2 R C ln[(1 + β) / (1 − β)]
f = 1 / T

If R2 ≈ 0.86 R1, then T ≈ 2RC. If R1 = R2, β = 0.5 and T ≈ 2.2 RC. With equal positive and negative saturation levels the duty cycle is 50%.

3. Triangular Wave Generator Using Op-Amp

The most common triangular wave generator using an op-amp uses two op-amps: a comparator (Schmitt trigger) and an integrator connected in a loop. The comparator output is a square wave. The integrator converts it into a triangular wave. The triangle is fed back to the comparator, which flips when the triangle reaches its threshold.

Triangular Wave Generator: Comparator + IntegratorCOMPARATOR (Schmitt trigger)Output switches between +Vsat, -VsatThreshold set by R2 / R3INTEGRATOR (R, C)Turns constant level into a rampOutput = triangular wavesquaretriangle fed back to comparatorVsqVtriThe ramp reverses each time it reaches the comparator threshold.

Figure 4: The loop alternates between ramping up and ramping down.

Design equations

Let R2 connect the triangle output to the comparator input, and R3 connect the comparator output to the same input. R and C are the integrator components.

Vp = Vsat × (R2 / R3)  (peak amplitude)
f = R3 / (4 R2 R C)
T = 4 R2 R C / R3

Where the formula comes from: the integrator ramps at Vsat/(RC). The triangle must travel 2Vp = 2 Vsat R2/R3 each half cycle, which takes 2 R2 R C / R3. A full period is twice that.

Tune amplitude and frequency separately

R2/R3 sets the amplitude; once it is fixed, R and C set the frequency. Keep R2 smaller than R3 so the peak stays within the output swing.

4. Sine Wave Generators: RC Phase Shift and Wien Bridge

RC phase shift oscillator

An RC phase shift oscillator uses an inverting amplifier (180°) and three RC sections. Each section shifts the phase by about 60°, so the loop totals 360°. It oscillates at the frequency where this happens, provided the gain is large enough.

RC Phase Shift Oscillator: The Feedback LoopINVERTING AMPgain at least 29shift 180°RC section160°RC section260°RC section360°feedback to amplifier inputTotal phase around the loop = 180° + 3 x 60° = 360°, so oscillation can start.Condition: loop gain must reach at least 1 at f = 1 / (2πRC√6).

Figure 5: Three 60 degree sections plus the inverting amplifier give a full 360 degree loop.

f = 1 / (2π R C √6) ≈ 0.065 / (R C)
Gain required: |A| ≥ 29 (Rf ≥ 29 R)

Wien bridge oscillator

The Wien bridge oscillator uses a non-inverting amplifier and a series-parallel RC network that gives zero phase shift at one frequency.

f = 1 / (2π R C)
Gain required: A ≥ 3 (Rf ≥ 2 Rg)

Both circuits need amplitude control (for example a small lamp, diode limiter or JFET) so that the amplitude settles without clipping. Too much gain gives a distorted, clipped wave; too little gives no oscillation.

Triangle to sine

A triangular wave can be rounded into an approximate sine by a diode shaping network or a differential pair. This is useful when you already have a triangle generator and need a sine of fixed frequency.

5. Comparison and Formulas

CircuitFrequencyKey requirement
Square wave (astable)f = 1 / [2RC ln((1+β)/(1−β))]β = R2/(R1+R2)
Triangular (comparator + integrator)f = R3 / (4 R2 R C)Vp = Vsat R2/R3
RC phase shiftf = 1 / (2π R C √6)Gain ≥ 29
Wien bridgef = 1 / (2π R C)Gain ≥ 3

6. Choosing the Op-Amp

  • Slew rate: for a sine of peak Vp at frequency f you need SR ≥ 2π f Vp. Square and triangular waves also need fast edges.
  • Bandwidth: gain-bandwidth must be well above the oscillation frequency.
  • Supply and output swing: Vsat is usually a volt or two below the supply rails, and rail-to-rail types swing closer.
  • Low input bias: helps with large resistors in timing networks.

7. Interactive Calculators

Square wave generator calculator

Triangular wave generator calculator

Sine oscillator calculator

Required slew rate

8. Common Problems and Fixes

ProblemLikely causeFix
Slanted or rounded square waveOp-amp slew rate too lowUse a faster op-amp or lower frequency or amplitude
Frequency off from calculationComponent tolerance, saturation voltage differs from assumedUse 1% parts and the real Vsat from the datasheet
Sine oscillator does not startLoop gain below the required valueIncrease the feedback ratio slightly
Sine wave is clippedGain too highAdd amplitude control or reduce gain
Triangle drifts or saturatesDC offset in integratorAdd a large resistor in parallel with the integrator capacitor
Triangle amplitude too largeR2 too close to R3Reduce R2/R3

Quick Summary

WaveformCircuitFrequency
SquareAstable multivibrator1 / [2RC ln((1+β)/(1−β))]
TriangularComparator + integratorR3 / (4 R2 R C)
SineRC phase shift1 / (2π R C √6), gain ≥ 29
SineWien bridge1 / (2π R C), gain ≥ 3

About the Formulas

The equations assume ideal op-amps and symmetrical saturation levels. Real circuits differ slightly because of component tolerances, op-amp slew rate and saturation voltage. Use the calculators for design estimates and check results against your op-amp datasheet.

Frequently Asked Questions (FAQ)

It combines a comparator with a Schmitt-trigger style positive feedback and an integrator. The comparator produces a square wave, the integrator turns that constant level into a rising or falling ramp, and the ramp is fed back to the comparator. When the ramp reaches the comparator threshold, the square wave flips and the ramp reverses, creating a triangular wave.

For the standard comparator plus integrator circuit with threshold resistors R2 (from the triangle output) and R3 (from the comparator output), the frequency is f = R3 / (4 R2 R C), and the peak amplitude is Vp = Vsat x R2 / R3. R and C are the integrator components.

It is an astable multivibrator, also called a relaxation oscillator. The op-amp acts as a comparator with positive feedback from a divider (R1, R2). The output charges or discharges a capacitor through a resistor R. When the capacitor voltage crosses the threshold of plus or minus beta times Vsat, the output flips and the capacitor starts charging the other way.

The period is T = 2RC ln((1 + beta)/(1 - beta)), where beta = R2/(R1 + R2). If R2 is about 0.86 times R1, the period is approximately 2RC, so f is about 1/(2RC). With R1 equal to R2, beta is 0.5 and T is about 2.2 RC.

It is a sine wave oscillator made of an inverting amplifier and a feedback network of three RC sections. Each section shifts the phase by about 60 degrees, giving 180 degrees in total. With the amplifier's 180 degrees, the loop phase is 360 degrees, so the circuit oscillates if the loop gain is at least one.

For three equal RC sections, the frequency is f = 1 / (2 pi R C sqrt(6)), which is about 1 / (15.4 RC). The amplifier gain must be at least 29, so the feedback resistor should be about 29 times the section resistor or more.

The phase shift oscillator uses an inverting amplifier with three RC sections and needs a gain of at least 29. The Wien bridge uses a non-inverting amplifier with a series and parallel RC network, oscillates at f = 1 / (2 pi R C) and needs a gain of at least 3. Wien bridge oscillators are common for low-distortion audio signals.

Pass the triangular wave through a wave-shaping circuit, such as a diode shaping network or a differential pair, that rounds the peaks into an approximate sine. The result is not a perfect sine, but with careful design the distortion can be low enough for many uses.

Choose by slew rate and bandwidth. A general-purpose op-amp such as the classic 741 has a slew rate of roughly 0.5 V per microsecond, which limits square and triangular waves to low frequencies. Faster op-amps allow higher frequencies. Also check supply voltage and output swing against your needs.

The op-amp's slew rate is limiting how fast the output can change. Edges become slanted when the frequency or amplitude is too high for the op-amp. Use a faster op-amp or lower the frequency or amplitude.

An integrator produces an output proportional to the time integral of its input. When the input is a constant positive or negative level, the output is a linear ramp down or up. A square wave input therefore produces a triangular wave output.

They are used in test signal sources, function generators, timing and clock circuits, PWM and modulators, audio tone generation and teaching examples of feedback and oscillation. Dedicated function generator ICs and microcontrollers are also common in modern designs.