To condition a slow-moving analog sensor signal for a microcontroller ADC, build a single-stage passive RC low-pass filter. For a standard 160 Hz cutoff that blocks high-frequency switching noise without overloading the ADC sampling circuitry, use a 10 kΩ 1% metal-film resistor and a 100 nF X7R ceramic capacitor. This two-component topology costs less than $0.05, requires no external power, and provides roughly -70 dB of attenuation at 500 kHz.

Topology and Node Definitions

A single-stage passive RC low-pass filter consists of a series resistor and a shunt capacitor. The topology relies on the frequency-dependent impedance of the capacitor to short high-frequency noise to ground while passing DC and low-frequency signals to the load.

Here is the node-by-node breakdown of the circuit:

  • $V_{in}$ (Input): Connects to the raw sensor output (e.g., a TMP36 temperature sensor or a potentiometer wiper).
  • Node A (Filter Junction): The electrical connection point between the resistor's output lead and the capacitor's positive/signal lead.
  • $V_{out}$ (Output): Tied directly to Node A. This routes to the microcontroller's ADC pin (e.g., ESP32 GPIO 34).
  • GND (Ground): The capacitor's negative lead ties to the system ground plane, establishing the 0V reference for the filter and the MCU.
Why this topology over the alternatives?
You might wonder why we don't use an LC (inductor-capacitor) filter or an active op-amp filter. LC filters require bulky, expensive inductors and suffer from resonance ringing if not perfectly damped. Active op-amp filters (like a Sallen-Key) provide a sharper rolloff but require dual-rail power supplies or virtual ground biasing, adding quiescent current draw and component count. For 95% of hobbyist and commercial IoT sensor applications, the passive RC circuit with capacitor is the optimal choice for its zero-power footprint and inherent stability.

Design Walkthrough: Picking Real Component Values

Let's design this filter for a specific, common scenario: reading a slow-changing analog sensor with an ESP32-WROOM-32 SAR ADC, while rejecting 500 kHz noise from a nearby switching buck converter.

The cutoff frequency ($f_c$) formula is:

$$f_c = \frac{1}{2 \pi R C}$$

Step 1: Constrain the Resistor (R)
The ESP32 uses a Successive Approximation Register (SAR) ADC. Internally, a ~12 pF sampling capacitor switches onto the input pin at high speeds. If your source impedance (R) is too high, the internal capacitor cannot fully charge during the sampling window, resulting in non-linear, artificially low voltage readings. Analog Devices recommends keeping the source impedance below 10 kΩ for most 12-bit SAR ADCs to ensure accurate charge transfer. Therefore, we lock in R = 10 kΩ.

Step 2: Calculate the Capacitor (C)
Our sensor signal (temperature) changes at less than 5 Hz. We want a cutoff frequency well above 5 Hz but far below 500 kHz. Let's target $f_c \approx 160$ Hz. Rearranging the formula to solve for C:

$$C = \frac{1}{2 \pi R f_c} = \frac{1}{2 \cdot \pi \cdot 10000 \cdot 160} \approx 99.47 \text{ nF}$$

Step 3: Select the Physical Component
The closest standard E12 value is 100 nF (0.1 µF). We select an X7R or C0G/NP0 ceramic capacitor (e.g., Kemet C315C104K5R5TA). Ceramic capacitors have extremely low Equivalent Series Resistance (ESR) and maintain their capacitance well into the MHz range, making them ideal for shunting high-frequency switching noise to ground.

Behavior Matrix and Failure Mode Contrast

Understanding how component drift or catastrophic failure affects the circuit is critical for debugging. Below is the behavior matrix showing what happens when elements change, followed by the extreme failure modes.

Table 1: Component Variation Behavior Matrix
Element Changed Direction Effect on Cutoff Freq ($f_c$) Effect on ADC Loading Effect on Noise Attenuation
Resistor (R) Increase (e.g., to 100 kΩ) Decreases (16 Hz) Severe (causes SAR ADC droop/errors) Improves at high-freq, but ruins DC accuracy
Resistor (R) Decrease (e.g., to 1 kΩ) Increases (1.6 kHz) Minimal (ADC charges easily) Worsens (lets more 500 kHz noise through)
Capacitor (C) Increase (e.g., to 1 µF) Decreases (16 Hz) Minimal (caps don't load DC) Improves, but slows down sensor step-response
Capacitor (C) Decrease (e.g., to 10 nF) Increases (1.6 kHz) Minimal Worsens (high-freq noise reaches ADC)

What Breaks at the Extremes?

When prototyping or troubleshooting a circuit with capacitor and resistor elements, you must account for physical failures like cold solder joints or shorted dielectrics.

  • Resistor Opens: Node A is disconnected from $V_{in}$. The ADC pin floats, picking up ambient electromagnetic interference (EMI). The MCU will read random, rapidly fluctuating garbage values.
  • Resistor Shorts: The filter is completely bypassed. $V_{in}$ connects directly to $V_{out}$. The ADC will read the correct DC voltage but will be slammed with the full 500 kHz switching noise, causing jitter in the readings.
  • Capacitor Opens: The shunt path to ground is broken. Similar to a shorted resistor, the low-pass filtering action ceases, and high-frequency noise passes unattenuated to the ADC.
  • Capacitor Shorts: Node A is hard-shorted to GND. The ADC will read a constant 0V. If the sensor driving $V_{in}$ cannot handle a direct short to ground, it may overheat or be permanently damaged.

Step-by-Step Breadboard Testing Procedure

Do not trust your math until you verify it on the bench. Follow this procedure to validate your RC filter using a function generator and an oscilloscope.

  1. Verify Components: Use a digital multimeter (DMM) to measure the 10 kΩ resistor. It should read between 9.9 kΩ and 10.1 kΩ. Ceramic capacitors are harder to measure with a basic DMM, but ensure it does not read as a dead short (0 Ω).
  2. Wire the Topology: Insert the resistor and capacitor into the breadboard. Keep the physical distance between the capacitor's leads and the MCU input pin as short as possible to minimize parasitic trace inductance.
  3. Inject a Passband Signal: Connect a function generator to $V_{in}$. Set it to output a 1 Vpp sine wave at 10 Hz (well below the 160 Hz cutoff). Probe $V_{out}$ with your oscilloscope. You should see ~1 Vpp. (Note: At 10 Hz, attenuation is negligible).
  4. Inject a Stopband Signal: Change the function generator to 500 kHz, keeping the amplitude at 1 Vpp. Probe $V_{out}$ using the oscilloscope's ground spring instead of the long alligator ground clip. The long clip acts as an antenna and will falsely show noise. With the ground spring, you should see the 500 kHz signal attenuated to just a few millivolts.
  5. Verify Step Response: Switch the generator to a 10 Hz square wave. Observe the rising edge on the scope. You should see the classic exponential RC charging curve, reaching 63.2% of the final value in exactly 1 millisecond ($\tau = R \times C = 10k \times 100n = 1ms$).

Frequently Asked Questions

Why does my circuit with capacitor still show high-frequency noise on the oscilloscope?

If your math is correct but you still see 500 kHz spikes on $V_{out}$, the issue is almost always measurement technique or physical layout. First, remove the long ground alligator clip from your oscilloscope probe and use the short ground spring; the clip loop acts as an inductor that picks up radiated EMI. Second, check your breadboard routing. If the wire running from Node A to the MCU is long and runs parallel to a noisy switching regulator, it will act as an antenna, picking up noise after the filter. Keep the post-filter trace as short as physically possible.

Can I use an electrolytic capacitor instead of ceramic in this RC circuit with capacitor?

No. While a 100 nF electrolytic capacitor might theoretically provide the same low-frequency rolloff, electrolytics have high Equivalent Series Resistance (ESR) and significant parasitic inductance. At 500 kHz, an electrolytic capacitor behaves more like an inductor than a capacitor, completely failing to shunt the high-frequency noise to ground. Always use multi-layer ceramic capacitors (MLCC) with X7R or C0G/NP0 dielectrics for high-frequency bypass and filtering applications.

How do I calculate the power rating for the resistor in this circuit?

Use Joule's law: $P = V^2 / R$. If your sensor outputs a maximum of 3.3V, the power dissipated by the 10 kΩ resistor is $(3.3^2) / 10000 = 1.089$ milliwatts. A standard 1/4W (250 mW) or even 1/8W (125 mW) through-hole resistor is more than sufficient. You only need to worry about wattage ratings if you are using this RC topology to filter a high-voltage signal (e.g., a 100V industrial sensor), in which case you would need to calculate for higher dissipation and potentially use a high-voltage rated resistor to prevent internal arcing.