ADC sampling and honest resolution
Convert ADC codes into calibrated quantities and choose sample rate, reference, and filtering from the signal rather than from nominal bit count.
- Translate ADC counts to voltage with uncertainty, identify clipping and aliasing, and design a repeatable low-voltage sampling test.
Related study — optional context
Understand
The working idea
An analog-to-digital converter turns a continuous input range into numbered bins. It is like reporting a ruler position using only whole millimeters: nearby values may receive the same code. For an ideal N-bit converter spanning 0 to V_ref, there are 2^N codes and a nominal step near V_ref/2^N. A 12-bit, 3.3 V range therefore has about 0.806 mV per code. That is code width, not guaranteed measurement accuracy.
A useful conversion is V_est = code × V_ref/(2^N - 1) when the device maps the maximum code to the reference. Documentation may specify a different convention. Reference tolerance, input noise, nonlinearity, source impedance, and calibration all affect the result. A voltage divider must remain inside the pin’s allowed range under worst case, not merely at its typical input. For a 5 V signal into a 3.3 V-only ADC, equal resistors would produce 2.5 V, but input protection, grounding, source impedance, and fault voltage still need review.
Sampling also describes time. A sample rate f_s can represent a sinusoid unambiguously only when the signal is suitably band-limited below f_s/2. Sampling a 70 Hz tone at 100 samples/s can resemble 30 Hz: aliasing. More samples do not repair information already folded by inadequate analog bandwidth. A simple RC low-pass before the ADC can limit high-frequency content, but its time constant and ADC acquisition requirements must be chosen deliberately.
The build decision for a slow temperature sensor might be 10 samples/s and averaging, while a microphone envelope needs different bandwidth. A common misconception is that 12 bits means four decimal digits of truth. Repeated codes can reveal noise and effective resolution, but agreement with a calibrated reference establishes accuracy. Clipped runs of zero or maximum code indicate range failure, not a stable physical phenomenon.
Follow the reasoning
Worked example
A 12-bit ADC uses a measured 3.28 V reference and returns code 2480. Using the endpoint-calibrated convention that maps code 4095 to the reference, estimate input voltage and the approximate quantization half-step.
- 1
Maximum code is 2^12 - 1 = 4095.
- 2
V_est = 2480 × 3.28 V / 4095 = 1.986 V (rounded).
- 3
The ideal code-bin width is 3.28 V / 4096 = 0.801 mV, so the approximate quantization half-step is ±0.400 mV before other errors. The endpoint calibration factor above is a different convention from the bin width.
The code corresponds to about 1.986 V with an ideal quantization half-step near ±0.00040 V; total measurement uncertainty is larger unless other errors are bounded.
Sanity check2480/4095 ≈ 0.606 of full scale, and 0.606 × 3.28 V ≈ 1.99 V, safely within the range.
Try it yourself
Independent check
Move to the bench
Calibrate an ADC channel against a multimeter and distinguish quantization, noise, and clipping.
- 3.3 V microcontroller with ADC
- 10 kΩ potentiometer
- multimeter
- breadboard and jumpers
- serial console
Experiment
- With power disconnected, wire the potentiometer ends to 3.3 V and ground and its wiper to the ADC; check the board’s ADC range.
- At roughly 25%, 50%, and 75% rotation, collect 100 codes and separately measure wiper voltage with the meter.
- Calculate mean, minimum, maximum, code spread, and voltage estimate using a measured supply/reference if the board exposes it.
- Introduce a deliberate safe fault by moving the wiper near the upper rail until codes clip; identify the repeated maximum and then return to midrange.
- State whether differences are resolution, repeatability, reference, or meter uncertainty rather than calling them all ADC error.
Observe
- Expected: mean code rises monotonically with wiper voltage and near-rail readings may clip.
- Record actual meter voltage, code statistics, and conversion residual at each point; expected values are not measurements.
- Expected fault signature: many consecutive maximum codes lose information about further voltage increase.
Specify sample rate, input range, and one anti-alias measure for logging a slowly changing vacuum-blower pressure sensor without opening or modifying an appliance.
- Keep the wiper strictly within the documented ADC voltage range; disconnect power before changing wiring and do not probe household appliances.
Keep evidence
Bench note
Record what you expected, what you actually measured or observed, and one difference worth investigating. This is self-reported evidence, not a certification.