The optimal circuit of capacitor and resistor filtering for a microcontroller analog-to-digital converter (ADC) is a single-pole RC low-pass filter configured with a 10kΩ series resistor and a 100nF shunt capacitor. This specific topology yields a cutoff frequency of roughly 159 Hz, providing a robust charge reservoir for the ADC's internal sampling capacitor while attenuating high-frequency switching noise from the breadboard or power supply. Below is the complete design framework, failure analysis, and component selection path to implement this on an ESP32 or Arduino platform.
The RC Low-Pass Topology: Nodes and Core Behavior
A first-order RC low-pass filter consists of two passive components arranged in a specific L-network topology. Understanding the node labels is critical for debugging and oscilloscope probing.
- Node Vin: The raw analog signal input (e.g., from a potentiometer, sensor, or DAC).
- Node Vout: The filtered signal node, located precisely between the resistor and capacitor. This connects directly to the microcontroller's ADC pin.
- Node GND: The common ground reference shared by the signal source, the capacitor, and the microcontroller.
The resistor (R1) is placed in series between Vin and Vout. The capacitor (C1) is placed in parallel (shunt) between Vout and GND. The capacitor acts as a frequency-dependent short to ground; it blocks DC and low frequencies from escaping to ground, forcing them to Vout, while high-frequency noise takes the low-impedance path through C1 to GND.
Element Behavior Matrix
| Component Change | Effect on Cutoff Frequency ($f_c$) | Effect on Settling Time ($5\tau$) | Secondary Real-World Impact |
|---|---|---|---|
| Increase R1 | Decreases (more filtering) | Increases (slower response) | Increases thermal (Johnson-Nyquist) noise; risks failing to charge the ADC's internal sampling capacitor in time. |
| Decrease R1 | Increases (less filtering) | Decreases (faster response) | Draws more current from the source; may overload high-impedance sensors like piezos or passive thermocouples. |
| Increase C1 | Decreases (more filtering) | Increases (slower response) | Provides a stiffer charge reservoir for the ADC; increases physical board footprint and risk of dielectric absorption errors. |
| Decrease C1 | Increases (less filtering) | Decreases (faster response) | May fail to supply the instantaneous charge required by the ADC's sample-and-hold circuit, causing bit-flipping or non-monotonic reads. |
Why RC Over LC or Active Filters?
When designing an input stage, you have three primary topology choices. For 90% of hobbyist and commercial IoT sensor applications, the passive RC network wins on cost, stability, and footprint.
| Topology | Pros | Cons | Best Use Case |
|---|---|---|---|
| Passive RC | Cheap ($0.02), no power required, inherently stable, no phase-margin issues. | Roll-off is only -20dB/decade; loads the source slightly. | General sensor inputs, potentiometers, audio line-in to ADC. |
| Passive LC | Steeper roll-off (-40dB/decade for 2nd order), very low DC resistance. | Inductors are bulky, expensive, and can ring (resonate) with the ADC's switching capacitance. | High-current power supply filtering, RF front-ends. |
| Active (Op-Amp) | Zero source loading, precise Butterworth/Chebyshev response, can provide gain. | Requires dual/split rails or rail-to-rail op-amps, adds noise, costs $0.50+ and board space. | High-precision 16-bit+ ADCs, anti-aliasing for high-speed data acquisition. |
Failure Modes: What Breaks at the Extremes?
Understanding how the circuit of capacitor and resistor elements fail is crucial for designing diagnostic routines in your firmware. Here is the failure-mode contrast for open and short conditions.
Resistor (R1) Failures
- R1 Opens (Infinite Resistance): The Vout node is entirely disconnected from Vin. The ADC will read the residual charge on C1, which will slowly drift to 0V due to leakage currents, or float wildly if EMI is present. Firmware symptom: Readings stuck at 0 or drifting randomly.
- R1 Shorts (Zero Resistance): The filter is bypassed. Vin is connected directly to Vout and the ADC pin. The circuit loses all high-frequency noise rejection. Furthermore, if Vin is subjected to a voltage spike, the ADC pin's internal ESD diodes will take the full brunt of the current without the current-limiting protection of R1. Firmware symptom: Noisy readings, potential permanent damage to the GPIO pin.
Capacitor (C1) Failures
- C1 Opens (Zero Capacitance): The shunt path to ground is removed. The circuit reverts to a simple wire (assuming R1 is intact). High-frequency noise passes directly into the ADC, and the ADC's internal sampling capacitor must be charged entirely through R1, leading to severe settling errors at higher sampling rates. Firmware symptom: High variance in consecutive readings (noise).
- C1 Shorts (Zero Resistance): Vout is hard-tied to GND. The signal is completely destroyed. If Vin is a low-impedance source (like a bench power supply), R1 will dissipate the full power ($P = V^2/R$) and may overheat or desolder itself. Firmware symptom: ADC reads a hard, unwavering 0.
Design Walkthrough: Sizing for an ESP32 ADC
Let's design a concrete circuit of capacitor and resistor filtering for an ESP32 SAR ADC. The ESP32's ADC has an internal sampling capacitor (approx. 12pF) and an internal multiplexer resistance that effectively requires a source impedance of less than 10kΩ to settle accurately within the default sampling window.
Step 1: Pick the Resistor (R1)
We need a resistor high enough to limit current and filter noise, but low enough to satisfy the ESP32's <10kΩ source impedance requirement. We select 10kΩ. This limits a 3.3V fault current to 0.33mA (safe for GPIOs) while providing the maximum acceptable source impedance.
Step 2: Pick the Capacitor (C1)
The external capacitor must act as a charge reservoir. A common rule of thumb is that the external shunt capacitor should be at least 1000x larger than the ADC's internal sampling capacitor to prevent voltage droop during the sample-and-hold phase.
$C_{ext} > 1000 \times 12pF = 12nF$.
We will select 100nF (0.1µF) to provide a generous margin and a solid low-impedance ground path for RF noise.
Step 3: Calculate the Cutoff Frequency ($f_c$)
Using the standard formula $f_c = \frac{1}{2 \pi R C}$:
$f_c = \frac{1}{2 \times \pi \times 10,000 \times 0.0000001} \approx 159.15 \text{ Hz}$.
Step 4: Verify Settling Time ($\tau$)
The time constant $\tau = R \times C = 10k\Omega \times 100nF = 1ms$.
To settle to within 0.7% (5 time constants) after a full-scale step change, the circuit requires $5\tau = 5ms$. If your application samples a slow-moving temperature sensor (changing over seconds), 5ms is perfectly acceptable. If you are sampling a 1kHz audio waveform, this filter will heavily attenuate your signal, and you must reduce R and C.
Decision Tree: Selecting Your Capacitor Dielectric
Not all 100nF capacitors are created equal. The dielectric material dictates how the capacitor behaves under DC bias and temperature changes. Use this decision path to select the exact part number for your BOM.
| Application Condition | If True... | Dielectric Choice | Trade-off |
|---|---|---|---|
| Signal is purely AC (audio, AC coupled sensor) | DC bias effect is irrelevant. | X7R / X5R | Smallest physical size, cheapest, but capacitance drops up to 50% at rated DC voltage. |
| Signal is DC (0-3.3V) and requires <5% absolute accuracy | DC bias capacitance drop will cause filter cutoff shift and settling errors. | C0G / NP0 | Zero DC bias effect, highly stable, but physically larger (0805 or 1206) and more expensive. |
| Operating environment exceeds 85°C | X7R drifts significantly at high temps. | C0G / NP0 | Maintains ±30ppm/°C stability across the full range. |
The Default Recommendation
For high-precision DC sensor measurements on a 3.3V microcontroller, do not compromise on the dielectric. The concrete pick for your BOM is the Kemet C0805C104J5GACTU (100nF, 50V, C0G/NP0, 0805 package, 5% tolerance). The 50V rating ensures you are operating at less than 10% of the rated voltage, completely eliminating DC bias capacitance derating, and the C0G dielectric guarantees the 159Hz cutoff remains mathematically exact regardless of temperature or signal voltage.
Breadboard Testing: Step-by-Step Verification
Before committing the circuit of capacitor and resistor elements to a custom PCB, validate the frequency response on a breadboard using a function generator and an oscilloscope (or a true-RMS multimeter with frequency response up to 1kHz).
- Assemble the Topology: Insert the 10kΩ resistor and 100nF capacitor into the breadboard. Connect the resistor from the left rail (Vin) to a center node. Connect the capacitor from the center node (Vout) to the ground rail. Ensure the ground rail is shared with your function generator's ground clip.
- Inject the Baseline Signal: Set the function generator to output a 10 Hz sine wave, 2.0V peak-to-peak (Vpp), with a 1.65V DC offset (to keep the signal within the ESP32's 0-3.3V ADC window). Connect the generator output to Vin.
- Measure Passband: Probe Vout with the oscilloscope. Because 10 Hz is well below the 159 Hz cutoff, the signal should pass with minimal attenuation. You should read ~2.0Vpp. (If it reads significantly lower, your capacitor is likely shorted or your resistor is the wrong value).
- Measure the Cutoff Point: Increase the function generator frequency to exactly 159 Hz. At the $f_c$ point, the signal should be attenuated by -3dB. Measure Vout; the amplitude should drop to roughly 1.41Vpp ($2.0V \times 0.707$). This confirms your R and C values are correct and the breadboard parasitics aren't wildly shifting the response.
- Measure the Stopband: Increase the frequency to 1.59 kHz (10x the cutoff). A first-order filter attenuates at -20dB/decade. The signal should drop by a factor of 10, reading approximately 0.2Vpp. If it reads higher, your capacitor may have high Equivalent Series Inductance (ESL) or you are probing with a compromised ground lead.
- Verify DC Settling: Switch the function generator to a 1 Hz square wave (0V to 3.3V). Trigger the oscilloscope on the rising edge. Measure the time it takes for the Vout waveform to reach 3.28V (99.3% of final value). It should take approximately 5ms ($5\tau$), confirming the time-domain settling behavior matches your mathematical model.
By following this topology, verifying the failure modes, and selecting a C0G dielectric, you eliminate the most common source of 'noisy ADC' complaints in embedded systems. For further reading on driving SAR ADCs, consult the Analog Devices guide on ADC input filtering, which details the charge-kickback mechanics that make this external capacitor reservoir strictly necessary.






