Op-Amp Differentiator: Turn a Triangle Wave into a Square Wave

Author: Abloom Spark Date: November 21, 2026

Yesterday's integrator turned a square wave into a triangle wave. Today's circuit is its mirror image: the op-amp differentiator gives an output proportional to how fast the input is changing — so a triangle wave, which rises and falls at a constant slope, comes out as a square wave. The same circuit sits inside waveform generators, edge detectors and FM demodulators. This article builds one and works out the numbers.

Schematic of an op-amp differentiator with a 10 nanofarad capacitor and 100 ohm resistor at the input, a 10 kilo-ohm feedback resistor and 10 picofarad capacitor in parallel, beside a plot showing a plus-minus 5 volt triangle wave at 1 kilohertz turning into a plus-minus 2 volt square wave

Figure 1: An op-amp differentiator (a) — the capacitor is at the input and the resistor is in the feedback loop, the exact opposite of the integrator. A ±5 V triangle wave comes out as a ±2 V square wave (b). (Schematic, not to scale.)

How it works — the formula

The input capacitor passes a current proportional to the rate of change of the input voltage, I = C × dVin/dt, and the op-amp pushes that same current through the feedback resistor RF, so the output is:

Vout = −RF × C × dVin/dt = −RC × dVin/dt

where RC is the time constant. With RF = 10 kΩ and C = 10 nF, RC = 10,000 × 10 × 10−9 = 100 µs. The minus sign comes from the inverting connection: a rising input gives a negative output. A steady DC input has a slope of zero, so it gives 0 V out — unlike the integrator, a differentiator has no DC drift problem, and the op-amp's input offset current of about 20 nA through the 10 kΩ feedback resistor leaves only 20 nA × 10 kΩ = 0.2 mV of output offset.

Worked example — a ±5 V triangle wave at 1 kHz

Feed a ±5 V triangle wave at 1 kHz into the circuit. The triangle rises from −5 V to +5 V in half a period, 0.5 ms, so its slope is:

dVin/dt = 10 V / 0.5 ms = 20,000 V/s

While the triangle is rising, the output is:

Vout = −RC × dVin/dt = −100 µs × 20,000 V/s = −2.0 V

— and while the triangle is falling, the slope flips sign and the output is +2.0 V. The slope is constant on each ramp, so the output is a clean ±2 V square wave at 1 kHz. The edges of the square wave are not perfectly instant: the output has to jump 4 V, and a 741 slews at 0.5 V/µs, so each edge takes 4 / 0.5 = 8 µs — only 1.6% of the 500 µs half-period, so the square wave still looks square.

What a sine wave does — gain that rises with frequency

A sine input, Vin = 1 V peak × sin(2Ï€ft), has a maximum slope of 2Ï€f × 1 V, so the output is a cosine wave — shifted 90° from the input, and flipped by the minus sign — with a peak of:

Vout(pk) = RC × 2Ï€f × Vin(pk)

With RC = 100 µs and a 1 V peak input, the output is 0.063 V at 100 Hz, 0.63 V at 1 kHz, and 6.28 V at 10 kHz. The gain is 2Ï€fRC, so it rises 20 dB per decade — 0.063 at 100 Hz, 0.63 at 1 kHz, 6.3 at 10 kHz. That is the differentiator's blessing and its curse: it amplifies fast signals, but it also amplifies high-frequency noise and any sharp edge, which is why a practical differentiator always has the two extra parts in Figure 1.

The catch — why R1 and CF are there

Without them, the gain would keep rising with frequency until the op-amp ran out of bandwidth, and the circuit would oscillate. The 100 Ω resistor R1 in series with the capacitor stops the gain from rising past −RF/R1 = −10,000/100 = −100 (40 dB): above the frequency f = 1/(2Ï€ × R1 × C) = 1/(2Ï€ × 100 × 10 nF) = 159 kHz, the circuit stops differentiating and behaves like an ordinary inverting amplifier with a gain of 100. The 10 pF capacitor CF across RF adds a pole at 1/(2Ï€ × RF × CF) = 1/(2Ï€ × 10 kΩ × 10 pF) = 1.59 MHz, rolling the gain off before the op-amp's own phase shift can turn the feedback positive. Below 159 kHz the circuit differentiates cleanly; above it, R1 and CF keep it stable.

Designing a ±1 V square wave from a ±5 V triangle

Suppose you need a ±1 V square wave from the same ±5 V, 1 kHz triangle. The slope is still 20,000 V/s, so the time constant must be:

RC = Vout / slope = 1 / 20,000 = 50 µs

Keeping RF = 10 kΩ, that means C = 50 µs / 10 kΩ = 5 nF. The nearest standard value is 4.7 nF, which gives RC = 47 µs and an output of 47 µs × 20,000 V/s = ±0.94 V — close enough, and if you need exactly ±1 V, use a 5.1 nF capacitor (RC = 51 µs, Vout = ±1.02 V) or trim RF to 10.6 kΩ. Remember to keep R1 small compared with the capacitor's reactance at the working frequency — here the reactance at 1 kHz is 1/(2Ï€ × 1000 × 4.7 nF) = 33.9 kΩ, far larger than 100 Ω, so R1 does not disturb the calculation.

Key points to remember

  • A differentiator gives Vout = −RC × dVin/dt: the output follows the slope of the input, not its size.
  • Worked example: ±5 V triangle at 1 kHz, RC = 100 µs → slope ±20,000 V/s → a clean ±2 V square wave; the 4 V edges take 8 µs on a 741.
  • A 1 V peak sine gives 0.063 V at 100 Hz, 0.63 V at 1 kHz and 6.28 V at 10 kHz — gain rises 20 dB per decade, so noise is amplified too.
  • R1 = 100 Ω caps the high-frequency gain at 100 (above 159 kHz) and CF = 10 pF adds a pole at 1.59 MHz — without them the circuit oscillates.
  • Design rule: for a ±1 V square from a ±5 V, 1 kHz triangle, RC must be 50 µs — C = 4.7 nF with RF = 10 kΩ gives ±0.94 V.