TExcelTAD
Home › Electrical & Electronic Measurements › Data Acquisition: Sampling, Quantisation and ENOB

Data Acquisition: Sampling, Quantisation and ENOB

A "16-bit" data-acquisition card promises one part in 65 536. In practice its readings scatter over a dozen codes, a vibration at 9.2 kHz9.2\ \text{kHz} shows up as a 0.8 kHz0.8\ \text{kHz} tone in a 10 kSa/s10\ \text{kSa/s} record, and the datasheet's small print says "ENOB 13.1 bits at 1 kHz". This lesson treats the ADC as a measuring instrument: what sampling does to the spectrum, what quantisation adds, how to specify the anti-alias filter, and how to measure the effective number of bits that the "16 bits" really deliver. The theory of sampling and quantisation is in Signals and Fourier and Quantization; here it becomes a specification.

Sampling and aliasing

Sampling at fsf_s cannot distinguish a frequency ff from f−kfsf - k f_s for any integer kk: every input component appears in the band 00 to fs/2f_s/2 at its alias frequency

fa=∣f−kfs∣,k=round⁡(f/fs)f_a = \lvert f - k f_s \rvert, \qquad k = \operatorname{round}(f/f_s)

Once aliased, a component cannot be removed by any digital processing. The only cure is to keep it out before the sampler: an anti-alias filter.

Simulation. A 7 Hz7\ \text{Hz} input sampled at 10 Hz10\ \text{Hz} appears at 3 Hz3\ \text{Hz}. With the anti-alias filter on (4th-order Butterworth at 0.4fs=4 Hz0.4 f_s = 4\ \text{Hz}) the readout gives its attenuation at 7 Hz7\ \text{Hz}: only about 19 dB19\ \text{dB}, so the alias is reduced to about a ninth, not removed. Move fsf_s up to 50 Hz50\ \text{Hz} and the same signal is far inside the passband; move ff above fsf_s and watch the alias fold again.

-A0+A0.0 s0.2 s0.4 s0.6 s0.8 s1.0 sx (V)input 7.0 Hzafter the filterreconstructed 3.00 Hzsamples, fs = 10.0 Hz0A0102030405060708090100f (Hz)fs/2faliasaliased: f > fs/2 = 5.00 Hz

Quantisation

analog input code 1 LSB = q +q/2 -q/2 error: uniform, rms = q / sqrt(12) quantisation error vs input

An ideal NN-bit converter over a full-scale range FSR\text{FSR} has an LSB of q=FSR/2Nq = \text{FSR}/2^N and rounds each sample to the nearest code. For a busy signal the error is uniform within ±q/2\pm q/2, so its rms value is

erms=q12,SNRideal=6.02 N+1.76 dBe_\text{rms} = \frac{q}{\sqrt{12}}, \qquad \text{SNR}_\text{ideal} = 6.02\,N + 1.76\ \text{dB}

for a full-scale sine (the 1.76 dB1.76\ \text{dB} is 10log⁡101.510\log_{10}1.5: a full-scale sine of amplitude 2Nq/22^{N}q/2 has power 22Nq2/82^{2N}q^2/8, the noise q2/12q^2/12, and 12/8=1.512/8 = 1.5). Real converters add thermal noise, reference noise, clock jitter, differential and integral non-linearity (DNL, INL) and distortion. All of it is captured by SINAD, the ratio of the signal to everything else (noise and distortion), which defines the effective number of bits:

ENOB=SINAD−1.76 dB6.02 dB\text{ENOB} = \frac{\text{SINAD} - 1.76\ \text{dB}}{6.02\ \text{dB}}

SFDR (spurious-free dynamic range) is the ratio of the signal to the largest single spur, the figure that matters when you look for a weak tone in a spectrum. Oversampling by a factor OSR and filtering to the band of interest spreads white quantisation noise over a wider band and keeps only 1/OSR1/\text{OSR} of it: 10log⁡10OSR10\log_{10}\text{OSR} dB more SNR, half a bit per doubling (more with noise shaping, the sigma-delta trick in Inside the DMM).

Worked example: measuring the ENOB of a 12-bit channel

Given: a 12-bit ADC, ±1 V\pm 1\ \text{V}, fs=100 kSa/sf_s = 100\ \text{kSa/s}; a test sine at 0.980.98 of full scale; the front end adds 120 μV120\ \mu\text{V} rms of noise and a little second- and third-order distortion.

Find: the ideal SNR, the measured SINAD, SFDR and ENOB from a 4096-point FFT.

Solve: q=2 V/4096=488 μVq = 2\ \text{V}/4096 = 488\ \mu\text{V}, q/12=141 μVq/\sqrt{12} = 141\ \mu\text{V}, ideal SNR =74.0 dB= 74.0\ \text{dB}. The test uses coherent sampling: the input frequency is chosen so the record holds a whole, odd number of cycles (127 in 4096 samples), so no window is needed and every harmonic lands exactly on a bin:

python · try it yourself
import numpy as np

# A 12-bit ADC, +/-1 V full scale, sampling a nearly full-scale sine coherently (whole number of cycles).
N, fs, bits = 4096, 100e3, 12
cycles = 127                                     # odd and prime to N: every code region gets exercised
f_in = cycles * fs / N
t = np.arange(N) / fs
rng = np.random.default_rng(8)
x = 0.98 * np.sin(2 * np.pi * f_in * t)
x = x + 0.0008 * x**2 + 0.0004 * x**3            # small 2nd and 3rd order distortion of the front end
x = x + 120e-6 * rng.standard_normal(N)           # input-referred noise, 120 uV rms
q = 2.0 / 2**bits                                 # LSB size
codes = np.clip(np.round(x / q), -2**(bits - 1), 2**(bits - 1) - 1)
y = codes * q

P = np.abs(np.fft.rfft(y)) ** 2
P[0] = 0                                          # ignore DC
k = cycles
signal = P[k]
harm_bins = [(h * k) % N for h in range(2, 6)]
harm_bins = [b if b <= N // 2 else N - b for b in harm_bins]
noise_dist = P.sum() - signal
sinad = 10 * np.log10(signal / noise_dist)
sfdr = 10 * np.log10(signal / np.max(np.delete(P, [0, k])))
enob = (sinad - 1.76) / 6.02
print(f"f_in = {f_in:.2f} Hz ({cycles} cycles in {N} samples), LSB = {1e6 * q:.1f} uV")
print(f"ideal 12-bit SNR = {6.02 * bits + 1.76:.2f} dB; quantisation noise q/sqrt(12) = {1e6 * q / np.sqrt(12):.1f} uV rms")
print(f"measured SINAD = {sinad:.2f} dB, SFDR = {sfdr:.1f} dB, ENOB = {enob:.2f} bits")
print("harmonics (dBc):", ", ".join(f"H{h}: {10 * np.log10(P[b] / signal):.1f}" for h, b in zip(range(2, 6), harm_bins)))
f_in = 3100.59 Hz (127 cycles in 4096 samples), LSB = 488.3 uV
ideal 12-bit SNR = 74.00 dB; quantisation noise q/sqrt(12) = 141.0 uV rms
measured SINAD = 66.27 dB, SFDR = 68.1 dB, ENOB = 10.72 bits
harmonics (dBc): H2: -68.1, H3: -80.4, H4: -100.1, H5: -108.5

Check: the noise alone (1412+1202=185 μV\sqrt{141^2 + 120^2} = 185\ \mu\text{V}) would give an SNR of 20log⁡10(0.693/185×10−6)=71.5 dB20\log_{10}(0.693/185 \times 10^{-6}) = 71.5\ \text{dB}; the second harmonic at −68 dBc-68\ \text{dBc} pulls SINAD down to 66.3 dB66.3\ \text{dB}, i.e. 10.710.7 effective bits. The SFDR equals the second-harmonic level. Improving the front end's linearity is worth more than a 16-bit ADC here.

Specifying the anti-alias filter

For a 16-bit system, an alias should be pushed below the noise floor, about 98 dB98\ \text{dB} below full scale, by the time the input reaches the lowest frequency that folds back into the band of interest, fs−fmaxf_s - f_\text{max}. A Butterworth filter falls at 20n dB20n\ \text{dB} per decade above its cutoff, so the required order depends dramatically on how much faster than 2fmax2 f_\text{max} you sample:

python · try it yourself
import numpy as np

# Anti-alias filter: signals of interest up to 1 kHz, 16-bit ADC, interference up to the folding band.
bits, f_pass = 16, 1e3
needed = 6.02 * bits + 1.76                       # attenuation to push a full-scale alias below the noise
for fs in (5e3, 10e3, 50e3):
    f_stop = fs - f_pass                          # lowest input frequency that folds back onto 0..1 kHz
    # Butterworth: attenuation 20*n*log10(f/fc) far above fc, with fc = f_pass (-3 dB at the band edge)
    n = needed / (20 * np.log10(f_stop / f_pass))
    print(f"fs = {fs / 1e3:4.0f} kHz: alias band starts at {f_stop / 1e3:4.0f} kHz, needs {needed:.0f} dB "
          f"-> Butterworth order {int(np.ceil(n))}")
fs =    5 kHz: alias band starts at    4 kHz, needs 98 dB -> Butterworth order 9
fs =   10 kHz: alias band starts at    9 kHz, needs 98 dB -> Butterworth order 6
fs =   50 kHz: alias band starts at   49 kHz, needs 98 dB -> Butterworth order 3

Sampling ten times faster (50 kHz50\ \text{kHz} instead of 5 kHz5\ \text{kHz}) needs only a 3rd-order filter instead of a 9th. That is why modern DAQ systems oversample and filter digitally. In practice, the attenuation is needed only for interference that is actually present, so you can relax the requirement once you know the environment.

DAQ details that bite

  • Multiplexed inputs share one ADC: switching channels needs settling time, and a high source impedance plus the ADC's sampling capacitor gives crosstalk (the previous channel's charge). Buffer high-impedance sources, or slow the scan. Simultaneous-sampling cards have one ADC (or sample-and-hold) per channel, needed for phase-sensitive measurements such as power.
  • SAR ADC inputs draw a charge pulse at each conversion; the driver (or an RC with a large capacitor) must settle to within half an LSB in the acquisition time.
  • Aperture jitter tjt_j limits the SNR of a high-frequency input to −20log⁡10(2πftj)-20\log_{10}(2\pi f t_j): 1 ps1\ \text{ps} at 100 MHz100\ \text{MHz} caps it at 64 dB64\ \text{dB}.
  • Single-ended vs differential inputs: referenced single-ended inputs share the DAQ's ground with the sensor; differential inputs reject ground differences up to their common-mode range (next lesson).

Guided lab: the ENOB of a microcontroller ADC

Hand calculation. A 12-bit microcontroller ADC with a 3.3 V3.3\ \text{V} reference has q=0.81 mVq = 0.81\ \text{mV} and an ideal SNR of 74 dB74\ \text{dB}. Datasheets of such ADCs commonly give ENOB around 1010 to 1111 bits, i.e. a SINAD of about 6262 to 68 dB68\ \text{dB}.

Simulation. Run the ENOB program with your board's numbers (bits, fs), or replace the synthetic y by your recorded samples.

What you would measure. Feed a 1 kHz1\ \text{kHz} sine from a generator, centred at 1.65 V1.65\ \text{V} with about 3 Vpp3\ \text{V}_\text{pp} (through a 1 kΩ1\ \text{k}\Omega resistor and with the generator's offset set first, checked on a scope), sample 4096 points at a rate that makes the number of cycles odd and coprime with 4096, and compute SINAD. Expect an ENOB of 9.59.5 to 1111 bits. It is often lower with the supply as the reference and while the processor, USB or radio is busy, because their switching noise couples into the reference; compare the supply as reference with an external reference, and a busy with a quiet processor.

Hazards and safe setup. Never drive an ADC pin outside 00 to VDDV_\text{DD}: set the generator's offset and amplitude with the output disabled and check them on a scope before connecting, and keep the 1 kΩ1\ \text{k}\Omega series resistor to limit current into the pin's protection diodes.

Pitfalls

  • Relying on digital filtering to remove aliases (too late).
  • Testing an ADC with a non-coherent frequency and no window, and blaming the ADC for the leakage.
  • Quoting the resolution (bits) as the accuracy.
  • Scanning multiplexed channels from high-impedance sources at full speed.

Practice

  1. What are the LSB and ideal SNR of a 16-bit ADC with a ±10 V\pm 10\ \text{V} range?
  2. A converter's SINAD is 80.0 dB80.0\ \text{dB}. What is its ENOB?
  3. A 9.2 kHz9.2\ \text{kHz} vibration is sampled at 10 kSa/s10\ \text{kSa/s}. Where does it appear?
Answer
  1. q=20 V/65 536=305 μVq = 20\ \text{V}/65\,536 = 305\ \mu\text{V}; SNR =6.02×16+1.76=98.1 dB= 6.02 \times 16 + 1.76 = 98.1\ \text{dB}.
  2. (80.0−1.76)/6.02=13.0(80.0 - 1.76)/6.02 = 13.0 bits.
  3. ∣9.2−10∣=0.8 kHz\lvert 9.2 - 10 \rvert = 0.8\ \text{kHz}.

Test yourself

The ideal SNR of an N-bit ADC for a full-scale sine is

  1. 6.02N6.02N dB
  2. 6.02N+1.766.02N + 1.76 dB
  3. 20N20N dB
  4. 3N3N dB

ENOB is computed from

  1. the number of output bits
  2. SINAD: (SINAD−1.76)/6.02(\text{SINAD} - 1.76)/6.02
  3. SFDR only
  4. the LSB size

Oversampling by 16 and filtering to the original band improves the SNR (white noise) by about

  1. 3 dB
  2. 6 dB
  3. 12 dB
  4. 24 dB

Why must aliasing be prevented before the ADC?

  1. aliases are always small
  2. once sampled, an alias is indistinguishable from a real in-band signal
  3. digital filters are too slow
  4. it is not necessary with 24 bits