All articles

    RC Filters: A Resistor and a Capacitor to Clean Up a Signal

    The low-pass and high-pass RC filter explained with diagrams: the cutoff frequency fc = 1/(2πRC), what −3 dB and 20 dB per decade mean, a step-by-step example of designing a filter for a sensor, smoothing PWM and settling time, cleaning up a sensor reading, blocking DC in audio, the filter in code, a second-order filter, and how to choose the values.

    Updated 5 min read

    Just a resistor and a capacitor, yet you can remove noise from a sensor reading, turn PWM into a steady voltage, or block the DC from an audio signal. That's an RC filter, one of the simplest and most important circuits.

    Low frequencies pass, and beyond the cutoff frequency the signal weakens
    Low frequencies pass, and beyond the cutoff frequency the signal weakens
    The same resistor and capacitor: with the capacitor to ground it's a low-pass, and in series it's a high-pass
    The same resistor and capacitor: with the capacitor to ground it's a low-pass, and in series it's a high-pass

    Low-pass: passes the low

    R in series with the signal, and C from the output to ground:

    • Slow signals pass.
    • Fast signals (noise) find the capacitor an easy path to ground, so they weaken.

    Why? A capacitor's opposition to alternating current falls as the frequency rises. So fast changes see it as a "short" to ground, and slow ones see it as "open".

    High-pass: passes the high

    C in series, and R from the output to ground:

    • DC (zero frequency) doesn't pass at all.
    • Fast changes pass.
    • Its best-known use: the coupling capacitor in audio circuits, passing the sound and removing the DC.

    The cutoff frequency

    fc = 1 ÷ (2π × R × C)
    • At fc, the signal falls to about 70% (meaning −3 dB).
    • Beyond it, each time the frequency rises 10 times, the signal falls 10 times (20 dB per decade) in a low-pass.

    Examples

    RCApproximate fc
    10k1 µF15.9 Hz
    1k100 nF1.6 kHz
    10k10 nF1.6 kHz

    The same R × C is the time constant, so you can work it out with the RC charge calculator.

    dB in one sentence

    dB is a way of writing a ratio: −3 dB ≈ the signal is now 70%, −20 dB = it's a tenth, and −40 dB = a hundredth. So "20 dB per decade" means: 10 times higher frequency → a signal 10 times weaker.

    A step-by-step design example

    A temperature sensor that changes slowly (about once a second), with 50 Hz noise from the mains on its wire:

    1. Choose fc: well above the signal and well below the noise: 5 Hz.
    2. Choose R: 10k (not so small that it loads the sensor, and not too large).
    3. Calculate C: 1 ÷ (2π × 10000 × 5) ≈ 3.2 µF → the nearest value is 3.3 µF.
    4. The result: 50 Hz is 10 times above fc, so it's weakened about 10 times, and the temperature passes unchanged.

    If you want more attenuation, add a second filter after the first (below), or a filter in code.

    Practical uses

    1. Smoothing PWM into a voltage

    PWM from the Arduino (~490 Hz) + a 10k and 10 µF filter (fc ≈ 1.6 Hz) → a nearly steady voltage proportional to the duty cycle. The drawback: it changes slowly, and there's a little ripple. If you need speed and accuracy, use a DAC.

    The numbers: 490 Hz is about 300 times above fc, so the ripple is reduced to about tens of millivolts. But when you change the duty, the output takes about 5 × RC = half a second to reach the new value. That's always the compromise: smoother = slower.

    2. Cleaning up a sensor reading

    A filter before the ADC (for example 1k and 100 nF) removes fast noise. A filter in code (averaging readings) helps too. See reducing noise.

    3. Blocking DC

    A coupling capacitor (for example 1–10 µF) between two audio stages. See the common-emitter amplifier.

    4. Against button bounce

    A resistor and capacitor on a button form a low-pass that swallows the fast pulses of bounce. The details are in the buttons article.

    The same idea in code

    A low-pass filter in software in one line:

    float y = 0;              // the filtered output
    const float a = 0.1;      // smaller = smoother and slower
    
    void loop() {
      int x = analogRead(A0);
      y = y + a * (x - y);    // moves towards the reading by a fraction a each time
    }

    This behaves exactly like an RC. And if you read every 10 ms with a = 0.1, the time constant is about 100 ms. A filter in code is flexible and easy to change, but it's no substitute for a real filter before the ADC for very fast noise.

    Choosing the values

    • Decide fc first: above the signal you want, and below the noise, with a good margin.
    • R: not too small (it loads the source), and not too large (it's affected by the load after it). Usually between 1k and 100k.
    • The load after the filter changes its behaviour. If the load is heavy, add an op-amp as a buffer.
    • One filter too weak? A second order (two filters in a row) gives 40 dB per decade.

    The second order

    Two filters in a row: make the second R about 10 times larger than the first (and the capacitor smaller by the same ratio for the same fc), so the second filter doesn't load the first and spoil its calculation. Or put an op-amp between them.

    The right capacitor

    • Ceramic for small values (up to a few µF).
    • Electrolytic for large values, but don't use one in an audio high-pass if the DC could reverse its polarity.
    • Film for audio if quality matters.

    FAQ

    Why is the output lower than the input, even for DC? Because the load after the filter (for example a low-resistance input) forms a voltage divider with R. Keep R much smaller than the load's resistance, or use a buffer.

    Does an RC filter work for high current? No; the resistor will drop voltage and heat up. For power supplies, an LC filter (inductor and capacitor) is used.

    Circuits Nerd
    © 2026 Circuits Nerd. All rights reserved.