RC Differentiator and Integrator: Turn a Square Wave into Spikes and a Ramp

Author: Abloom Instruction Date: November 14, 2026
Take one resistor and one capacitor, wire them two different ways, and you get two opposite circuits. Put the capacitor in series and the resistor to ground, and the circuit answers only to changes — a square wave comes out as sharp spikes. Swap them, resistor in series and capacitor to ground, and the circuit answers to the average — a square wave comes out as a smooth ramp. These are the passive RC differentiator and integrator, the simplest waveform-shaping circuits in electronics, and the building blocks of edge detectors, ramp generators and triangle-wave oscillators.
RC differentiator circuit with a 10 nanofarad capacitor in series and a 10 kiloohm resistor to ground, RC integrator with a 10 kiloohm resistor in series and a 1 microfarad capacitor to ground, and plots showing the differentiator turning a square wave into plus and minus 5 volt spikes and the integrator turning a square wave into a plus minus 0.125 volt triangle wave



Figure 1: The differentiator (a) and the integrator (b), and what each does to a 1 kHz square wave (c, d). Same two parts, two opposite jobs. (Schematic, not to scale.)

The differentiator — spikes at every edge

In Figure 1(a) the capacitor is in series with the signal and the resistor goes to ground. A capacitor blocks steady voltage but passes sudden changes, so when the input jumps, the full step appears across the resistor for an instant — then the capacitor charges through the resistor and the output decays exponentially with the time constant:

Ï„ = R × C = 10 kΩ × 10 nF = 100 µs

Feed in a 0–5 V square wave at 1 kHz (period 1 ms, half-period 500 µs). Each rising edge produces a +5 V spike that decays as 5 × e−t/Ï„; each falling edge produces a −5 V spike. After one time constant the spike has fallen to:

vout(Ï„) = 5 / e = 1.84 V

After the 500 µs half-period — five time constants — it has fallen to 5 × e−5 = 0.034 V, effectively zero, before the next edge arrives. That is the condition for a clean differentiator: Ï„ must be much smaller than the half-period. Here Ï„ = 100 µs is one-tenth of the 1 ms period, so each spike dies away cleanly, as in Figure 1(c). If Ï„ were close to the half-period, the spikes would run into each other and the output would look like a distorted copy of the input instead.

The integrator — a square wave becomes a ramp

In Figure 1(b) the parts are swapped: the resistor is in series and the capacitor goes to ground. Now the capacitor charges through the resistor at a nearly constant rate while the input stays steady, so the output is a ramp whose slope is:

dvout/dt = Vin / (R × C)

Feed in a ±5 V square wave at 1 kHz with R = 10 kΩ and C = 1 µF, so Ï„ = R × C = 10 ms — ten times the period, so the capacitor never gets near full charge. The slope is:

dvout/dt = 5 V / 10 ms = 500 V/s

During each 500 µs half-period the output moves by:

ΔV = 500 V/s × 500 µs = 0.25 V

So the output is a triangle wave swinging ±0.125 V (0.25 V peak-to-peak), as in Figure 1(d). The input's sharp corners have become a smooth ramp — the circuit has integrated the square wave, just as integrating a constant gives a straight line in maths. The condition is the mirror image of the differentiator's: Ï„ must be much larger than the half-period, here 10 ms against 0.5 ms, a factor of 20.

Design — a 1 V triangle from a 5 V square wave

Suppose you want a 1 V peak-to-peak triangle from the same ±5 V, 1 kHz square wave. The output must rise 1 V in each 0.5 ms half-period, so the time constant must be:

RC = Vin × (T/2) / ΔV = 5 × 0.5 ms / 1 V = 2.5 ms

Keeping R = 10 kΩ, the capacitor is C = 2.5 ms / 10 kΩ = 0.25 µF. Check the slope: 5 V / 2.5 ms = 2000 V/s, and 2000 V/s × 0.5 ms = 1 V, exactly the wanted rise. In practice a passive integrator like this only works well for small outputs — a real triangle-wave generator uses an op-amp integrator, where a resistor across the capacitor also stops slow drift from building up. And a real differentiator has the opposite practical problem: it amplifies high-frequency noise, so a small resistor is usually added in series with the capacitor to limit the gain.

Key points to remember

  • The differentiator (C in series, R to ground) answers only to changes: a square wave comes out as sharp spikes at each edge.
  • Worked example: R = 10 kΩ, C = 10 nF give Ï„ = 100 µs; a 0–5 V square wave at 1 kHz gives +5 V and −5 V spikes that fall to 1.84 V after one Ï„ and to 0.034 V after the 500 µs half-period.
  • The integrator (R in series, C to ground) answers to the average: a square wave comes out as a ramp or triangle wave.
  • Worked example: R = 10 kΩ, C = 1 µF give Ï„ = 10 ms; a ±5 V square wave at 1 kHz rises at 500 V/s, moving 0.25 V per half-period, so the output is a triangle swinging ±0.125 V.
  • Design example: for a 1 V peak-to-peak triangle from a 5 V square wave at 1 kHz, RC must be 2.5 ms — with R = 10 kΩ, C = 0.25 µF.
  • The rule to remember: a differentiator needs Ï„ much smaller than the half-period; an integrator needs Ï„ much larger than the half-period.