A bigger RC in front of an ADC is not always better: sampling-capacitor kickback
A SAR ADC input pin is just a sample switch of a few hundred Ω to a few kΩ and a sampling capacitor C_sh of a few pF, and if the input does not settle within 1/2 LSB during the sample period, the shortfall becomes measurement error. Adding an external C "to be safe" can also cut the conversion rate by orders of magnitude if it is the wrong size.
The sample switch and the sampling capacitor
Inside the pin of a SAR (successive approximation) ADC there is usually only a sample switch (on-resistance of a few hundred Ω to a few kΩ) and the sampling capacitor Csh connected to it (a few pF in an MCU). In the sample (acquisition) period the switch is closed and Csh charges or discharges toward the pin voltage. In the hold (conversion) period the switch opens, and the SAR digitizes only the voltage on the isolated Csh by binary search.
What the ADC measures is not the input voltage itself but how far Csh settled by the end of the sample period. If the source has a resistance R (a divider, the sensor's internal resistance and so on), Csh charges along a first-order RC curve with R, and whatever has not settled appears in the code as a systematic error, not as noise.
How many τ to settle within 1/2 LSB: 9τ at 12 bits
The error of a first-order RC falls as e−t/τ (τ = R·C) over time t. To settle within 1/2 LSB at N bits, the error must be at most Vref/2N+1, so
the condition is t/τ ≥ ln(2N+1) = (N+1)·ln2, that is, e−t/τ ≤ 1/2N+1. In node, 12 bits (N = 12) gives ln(213) ≈ 9.01, which is where the rule "9τ at 12 bits" comes from.
| Resolution N | τ needed | Typical use |
|---|---|---|
| 8bit | 6.24τ | Coarse monitors |
| 10bit | 7.62τ | Typical MCU built-in ADC |
| 12bit | 9.01τ | Many MCU built-in ADCs (this article's example) |
| 14bit | 10.40τ | High-resolution SAR |
| 16bit | 11.78τ | Precision measurement SAR |
Connecting a high-resistance divider directly: 100kΩ/100kΩ battery monitoring
A circuit that divides a lithium battery voltage by 100kΩ/100kΩ and feeds the ADC directly is common. The source resistance (Thevenin resistance) is 50kΩ, and with Csh = 5pF, τ = 250ns and the time to settle at 12 bits is 9τ ≈ 2.25µs.
Yet because people want short sample times, many MCUs end up with something near the default, tacq = 1µs. In node, tacq/τ = 4 and the remaining error is e−4 ≈ 1.83%, about 75LSB at 12 bits (4096 codes), or about 60mV at Vref = 3.3V.
This is a systematic error that always leans toward the not-yet-settled side, so no amount of averaging removes it. It is separate from divider tolerance and loading errors (see the resistor-divider error article): it is an error of simply not having enough time.
Reading the datasheet's "allowed source resistance"
Many MCU datasheets have a table of maximum source resistance RAIN(MAX). It is a value paired with the sample time (number of cycles) you set: the longer the sample time, the larger the allowed RAIN. Read it as a combined condition, "with this sample time, keep the source resistance below so many Ω."
Easy to miss is switching channels on a multiplexer. Right after the switch, Csh still holds the previous channel's voltage, so the difference to settle is the voltage difference between channels (worst case, full scale).
Adding an external capacitor: charge-sharing arithmetic
When you cannot lengthen the sample period or lower the source resistance, the standard fix is an external capacitor Cext right at the ADC pin. Cext acts as a reservoir, so the fast charge exchange when the switch closes does not have to pass through the source resistance R.
Charge sharing between Cext and Csh follows from charge conservation. When Cext is much larger than Csh, the node voltage moves by about Csh/(Csh + Cext) after sharing. To make that at most 1/2N+1, equal to 1/2 LSB, Cext ≥ Csh·(2N+1 − 1) ≈ Csh·2N+1 is the guide. For 12 bits and Csh = 5pF, node gives Cext ≥ about 41nF.
In practice people pick an X7R of 0.1µF (100nF) for margin, where Csh/(Csh + 100nF) ≈ 5×10−5, less than half the threshold 1/213 ≈ 1.22×10−4.
The recharge time caps the conversion rate
This is the heart of "bigger is not better." The small charge that moved in or out of Cext during sharing must be restored to the original voltage through the source resistance R before the next sample. The time constant is τ = R·Cext, far larger than for Csh.
In the earlier example (R = 50kΩ, Cext = 100nF), node gives τ = 5ms, so waiting 9τ at 12 bits takes 45ms and the sampling rate falls to about 22SPS. With no external C and the sample time set to 9τ (2.25µs), the maximum is, in theory, 444kSPS.
With a high external source resistance, a "comfortably large C" cuts the conversion rate by orders of magnitude. Choose Cext by checking both the charge-sharing error and this recharge time.
Seen as average current: C_sh·fs acts as an input resistance
Some datasheets state the source condition as an average input impedance instead. If Csh charges to V at every sample and this repeats fs times per second, the average current from the source is Csh·V·fs, the same as connecting an equivalent input resistance Req = 1/(Csh·fs). In node, Csh = 5pF and fs = 1MSPS give Req = 200kΩ. For high-resolution, high-impedance sources, though, the 9τ settling condition is usually the tighter one.
Buffering with an op amp: a large C on the output invites oscillation
Placing an op amp voltage follower between the source and the ADC lowers the closed-loop output impedance by the loop gain, so the effective source resistance gets small. The trouble starts when you hang an external C directly on its output.
With the op amp's open-loop output resistance Ro and load capacitance Cload, the two make a new pole. For Ro = 50Ω and Cload = 0.1µF, the pole is 1/(2π·50Ω·0.1µF) ≈ 31.8kHz (node). If it falls inside the feedback loop near the unity-gain bandwidth, it cuts the phase margin sharply and causes ringing or oscillation. The root is the same as the loop gain in the op amp error article.
The standard fix is one isolation resistor of tens of Ω (for example 20 to 100Ω) between the op amp output and the capacitor (the ADC pin). Take feedback from before the resistor, the op amp output itself, and the large load C sits outside the feedback loop, so loop stability is unaffected. For how to take feedback, see the inverting, non-inverting and VCVS article.
Combining it with the anti-aliasing RC
The isolation resistor and the small C next to the ADC pin also form a first-order anti-aliasing filter. Put its cutoff well below half the sampling frequency, where it gives enough attenuation in the noise band you care about. The attenuation curve is in the RC filter attenuation article.
Do not confuse this stage's C with Cext, the large charge-reservoir C. The C paired with the isolation resistor (tens of Ω) is driven by a low-impedance op amp output, so its time constant is small and a high fs is no problem. A large Cext directly on the source itself (high impedance) puts a firm cap on fs through the recharge time.
| Use | Series R | C at the ADC | Notes |
|---|---|---|---|
| High-impedance source, direct | A few hundred Ω to a few kΩ (the sensor itself) | None (internal Csh only) | Only if the sample time can be 9τ or more |
| Divider or passive sensor + reservoir C | Source resistance as is (tens of kΩ is possible) | 1000pF to 0.1µF | fs is capped by source R × C recharge time |
| Buffered by an op amp | 20 to 100Ω (isolation) | 100pF to 1nF | Prevents oscillation. MSPS-class fs is possible |
| Doubling as anti-aliasing | 100Ω to a few kΩ (after the buffer) | Choose so fc is well below fs/2 | See the RC filter attenuation article |
実機で引っかかるところ
The reading drifts in one direction because the settling error is not random, so averaging and oversampling do not remove it. Suspect the combination of sample time and source resistance first.
Noise or offset changes with the potentiometer position because the divider's impedance changes with the wiper position. Only the first point after a multiplexer switch is wrong because Csh still holds the previous channel's voltage; sampling the same channel twice in a row and using the second reading is a common workaround.
If adding an external C made things slower or carries old values, check whether 9τ of R·Cext has grown longer than the sampling period.
Frequently asked questions
If I set the sample time as long as possible, is a direct connection with no external C fine?
Where in the datasheet is C_sh?
What symptoms appear if the external C is too large?
What should the op amp isolation resistor be?
Can I use the same 9τ calculation when switching channels on a multiplexer?
Standards and references
- Horowitz & Hill, The Art of Electronics — RC time constants and settling time, and sample-and-hold basics
- Analog Devices, Op Amp Applications Handbook — Stability of op amps driving capacitive loads, and isolation resistors
- MCU manufacturers' ADC datasheets and reference manuals — Sampling capacitance C_ADC, sample switch resistance, and how allowed source resistance R_AIN(MAX) depends on sample time