Embedded HandbookApps
All sections › VIII. Electronics around the microcontroller
STM32F103, STM32G431 · level intermediate · 13 min read
Open in the interactive handbook

49г. Noise: thermal, shot, 1/f, interference — where it comes from and what limit it sets for the ADC and the amplifier

In sections 49а–49в the signal was deterministic: charge, field, current, wave — everything could be computed in advance. Here is what cannot be computed in advance: noise. Where it physically comes from (thermal motion of electrons, the discreteness of charge, traps in the semiconductor), how to describe it with a number, when it becomes visible against the step of the 12-bit STM32 ADC and why averaging does not always help. Separately — interference: it looks like noise but is not noise, and the spectrum shows that at once.

The noise budget of a signal chain (amplifier, source resistance, filter, bandwidth) is computed in section 165, ADC errors and summing of samples — in 14а.6, choosing an amplifier — in 56, the filter in front of the ADC — in 50а.4. Here is the physics under those calculations and the simulation that checks it.

Basis: the Boltzmann constant and the elementary charge — CODATA 2022 from scipy.constants (scipy 1.18.1, numpy 2.3.3, image stm-ml:1); temperature 27 °C. The thermal noise of resistors is repeated with a .noise analysis in ngspice 39 (image stm-lab:1, file noise49d.cir). ADC sampling capacitance — 5 pF for G4 and 8 pF for F1, from the datasheets, as in 49а.4. The 1/f noise of the amplifier is a generic model: there is no datasheet of a specific op amp with a noise plot on disk. All random records are simulated in calc49d.py with a fixed generator seed. There are no hardware measurements.

What it is called in the documentation

Original Meaning
root mean square (RMS) effective value
noise spectral density, V/√Hz noise per root hertz
thermal (Johnson–Nyquist) noise noise of any resistor
kT/C noise noise frozen on a sampling capacitor
shot noise noise of current crossing a barrier
1/f (flicker, pink) noise low-frequency noise, 1/f
1/f corner frequency where 1/f equals white noise
quantization noise, LSB rounding error of the ADC
effective number of bits (ENOB) bits left after noise and distortion
Welch's method (PSD estimate) averaged spectrum estimate
interference, pickup, spur a line in the spectrum from a definite source
dither added noise

49г.1 What noise is and how to measure it

Noise is a random signal: the next value cannot be predicted from the past ones. So it is described not by its shape but by statistics. The main number is the root mean square (RMS): the square root of the mean squared deviation. For zero-mean noise RMS equals the standard deviation σ.

Peak-to-peak says almost nothing: it grows with record length. In a simulated record of 1 048 576 samples of Gaussian noise the peak-to-peak is 9.6 σ, and 0.097 % of samples lie outside ±3.3 σ. So the familiar rule "peak-to-peak ≈ 6.6 RMS" (section 165.7) is a convention, not a law.

The second number is the spectral density: how much noise falls into a 1 Hz bandwidth. The unit is V/√Hz because powers (squares) add, and power is proportional to bandwidth. If the density e is the same at all frequencies (white noise), then in bandwidth B

U = e · √B

Model check: white noise of 100 nV/√Hz sampled at 100 kHz occupies 0…50 kHz. The formula gives an RMS of 22.4 µV, the record — 22.3 µV; the Welch estimate of the density is 99.9 nV/√Hz. Noise without a bandwidth is not a number. Density is a property of the source, RMS is a property of the source together with the bandwidth of the chain.

On the board. The bandwidth is set not only by the filter but by everything before the ADC sample: anything above half the sampling rate folds down (section 50а.4). So without a filter the noise "bandwidth" is the bandwidth of the input circuit, not the polling rate.


49г.2 Thermal noise: electrons in a resistor do not stand still

Electrons in a conductor move chaotically at any temperature above absolute zero. At every instant there are slightly more of them at one end of the resistor than at the other — a random voltage appears on the terminals. Its density depends neither on the material nor on the current, only on temperature and resistance:

e = √(4 · k · T · R)      U = √(4 · k · T · R · B)

k = 1.380649·10⁻²³ J/K (CODATA 2022); at 27 °C k·T = 4.144 zJ (4.144·10⁻²¹ J).

Resistor Density In 1 kHz In 1 MHz
1 kΩ 4.07 nV/√Hz 0.129 µV 4.07 µV
10 kΩ 12.9 nV/√Hz 0.407 µV 12.9 µV
100 kΩ 40.7 nV/√Hz 1.29 µV 40.7 µV
1 MΩ 129 nV/√Hz 4.07 µV 129 µV

The .noise analysis in ngspice 39 gave the same numbers for all eight cells (difference in the fifth digit). Noise grows as a square root: a hundred times more resistance — ten times more noise.

kT/C noise. If a resistor charges a capacitor, the bandwidth of the RC circuit is inversely proportional to R while the noise density grows as √R. One cancels the other, and the capacitor is left with

U = √(k · T / C)

for any R. ADC sampling capacitance of 5 pF (G4) — 28.8 µV, 8 pF (F1) — 22.8 µV; a 100 nF capacitor at the input — 0.204 µV. A model of an RC circuit of 10 kΩ and 5 pF with white resistor noise gave 28.5 µV. Every ADC sample "freezes" a random addition of this size on the capacitor — and neither a lower source resistance nor a filter in front of the input removes it. But from sample to sample the additions are independent and average out (49г.6).


49г.3 Shot noise: charge arrives in portions

Current through a p-n junction is not a smooth flow but separate electrons, each crossing the barrier independently of the others. The number of electrons in a time interval is random (Poisson distribution), so the current jitters:

i = √(2 · q · I · B)

q = 1.602176634·10⁻¹⁹ C. Shot noise exists where current crosses a barrier: a photodiode, a diode, input leakage current, the base of a bipolar transistor. An ordinary resistor does not have it — there electrons do not hop a barrier one by one.

Current Density In 1 kHz On 1 MΩ, 1 kHz
1 µA (lit photodiode) 566 fA/√Hz 17.9 pA 17.9 µV
10 nA (dark current, leakage) 56.6 fA/√Hz 1.79 pA 1.79 µV
1 nA 17.9 fA/√Hz 0.566 pA 0.566 µV

The last column is a photodiode with a 1 MΩ transimpedance amplifier. The 1 MΩ resistor itself in the same bandwidth gives 4.07 µV. Shot noise equals thermal noise at a current of 2·k·T / (q·R) = 51.7 nA: in weak light the resistor dominates, in strong light — the light itself.

Model: a current of 1 nA, counting electrons in 1 µs intervals (6242 on average). The current spread in the record is 12.65 pA, the formula for 0…500 kHz — 12.66 pA.


49г.4 1/f noise: slow drift that does not average out

In transistors, op amps, carbon and thick-film resistors the noise density rises at low frequencies: the power as 1/f, the voltage as 1/√f. The cause is charges trapped and released by traps in the semiconductor and at the oxide interfaces; the trapping times differ, from microseconds to hours, and together they give this spectrum. The frequency where 1/f noise equals the white noise is the corner frequency fc. Density:

e(f) = e_w · √(1 + fc / f)

Each op amp has its own fc in the datasheet, usually as a noise density plot. There is no datasheet with such a plot on disk, so below is a generic model with 10 nV/√Hz white noise and three corners.

Corner frequency Noise in 0.1…10 Hz In 10 Hz…10 kHz Density at 1 Hz
10 Hz 74.8 nV 1003 nV 33.2 nV/√Hz
100 Hz 217 nV 1033 nV 100 nV/√Hz
1 kHz 679 nV 1300 nV 316 nV/√Hz

Without 1/f there would be 31.5 nV in 0.1…10 Hz. Slow sensors (thermocouple, strain bridge, scales) live exactly there, and for them what matters is not the white noise density but the corner: with the same white noise the difference is several times. In the audio band and above 1/f is hardly noticeable. The budget of such a chain — section 165.5.

How to get 1/f noise in a model: take white noise, go to the spectrum, multiply each frequency by the required factor and go back:

def colored(rng, n, fs, sigma_w, fc):
    """Белый шум с СКЗ sigma_w в полосе 0…fs/2 плюс 1/f с угловой частотой fc: S(f) = Sw·(1 + fc/f)."""
    x = rng.standard_normal(n) * sigma_w
    X = np.fft.rfft(x)
    f = np.fft.rfftfreq(n, 1 / fs)
    h = np.zeros_like(f)
    h[1:] = np.sqrt(1 + fc / f[1:])
    return np.fft.irfft(X * h, n)

A 21 s record at 200 kHz sampling with a 100 Hz corner, a Welch spectrum estimate and a fit of a + b/f returned white noise of 10.0 nV/√Hz and a corner of 90.4 Hz: at low frequencies the record holds few periods, and the estimate there is noisy.

Noise spectral density on a log scale from 1 Hz to 100 kHz: op amp white noise 10 nV/√Hz and 1/f noise with a 100 Hz corner, the Welch estimate of the simulated record matches the model; a 10 kΩ resistor — 12.9 nV/√Hz; quantization noise of a 12-bit ADC at 3.3 V and 1 MHz sampling — 329 nV/√Hz; an op amp with a gain of 100 gives 1 µV/√Hz at its output, above quantization


49г.5 Adding noises and ADC quantization noise

Independent sources add as squares: U = √(U₁² + U₂² + …) (section 165.1). Thermal, shot, 1/f and quantization noise are independent — so that is how they are added.

Quantization noise. The ADC rounds the voltage to the nearest code. The step of a 12-bit ADC with a 3.3 V reference is 805.7 µV. The rounding error lies uniformly within ±half a step, its RMS is q/√12 = 232.6 µV (a model on a million random inputs — also 232.6 µV). The signal-to-noise ratio of an ideal 12-bit ADC for a full-scale sine is 74.0 dB, hence the ENOB formula of section 14а.1. At 1 MHz sampling this noise is spread over 0…500 kHz with a density of 329 nV/√Hz — the line in the figure.

When chain noise matches quantization. ENOB of an ideal ADC with added noise σ is 12 − log2(√(σ² + (q/√12)²) / (q/√12)):

Source Noise ENOB
divider 10 kΩ / 10 kΩ (5 kΩ), 1 MHz 9.10 µV 12.00
divider 1 MΩ / 1 MΩ (500 kΩ), 1 MHz 91.0 µV 11.90
kT/C on the 5 pF sampling capacitor 28.8 µV 11.99
op amp 10 nV/√Hz, gain ×10, 1 MHz 100 µV 11.88
op amp 10 nV/√Hz, gain ×100, 1 MHz 1000 µV 9.858
op amp 10 nV/√Hz, gain ×100, 10 kHz 100 µV 11.88

For the thermal noise of a single resistor to match quantization it takes 3.26 MΩ in 1 MHz or 326 MΩ in 10 kHz. A resistive divider is no problem for a 12-bit ADC — the real STM32 ADC has an ENOB of about 10.6 anyway (section 14а.2). An amplifier is different: it multiplies its noise by the gain. A 10 nV/√Hz op amp matches quantization at a gain of 23.3 in 1 MHz and 233 in 10 kHz. Hence the rule: after an amplifier, a filter in front of the ADC, with exactly the bandwidth the signal needs (165.6, 50а.4).


49г.6 Averaging, interference and dither

Averaging N samples reduces white noise √N times — the mean of N independent numbers is √N times less spread. With 1/f noise this does not work: neighbouring samples are related, the slow component is the same over the whole window and stays in the mean. Model: ADC at 10 kHz, white noise 1 LSB, a 419 s record; RMS of the mean, in LSB:

N White noise With 1/f, corner 1 Hz With 1/f, corner 10 Hz 1/√N
1 1.000 1.00 1.02 1.00
16 0.250 0.255 0.294 0.250
256 0.0626 0.0765 0.149 0.0625
4096 0.0158 0.0387 0.113 0.0156
65536 0.00401 0.0270 0.0853 0.00391

With white noise the sum follows √N exactly. With a 10 Hz corner the gain almost stops after 256 samples: 0.149 → 0.0853 for a 256-fold longer window. How many bits summing gives on a real ADC — sections 14а.6 and 15а.5.

Interference is not noise. The 50 Hz mains, the ripple of a switching supply, the edges of digital lines — signals of a definite frequency. The electric field couples them through capacitance (49а.5), the magnetic field through a loop (49б.3, 49б.5), and a long conductor receives them as an antenna (49в). They are not averaged out like noise: a window of 16 samples at 10 kHz (1.6 ms) leaves an RMS of 1.40 LSB out of 1.41 from a 50 Hz signal of 2 LSB amplitude. A window of exactly one mains period — 200 samples, 20 ms — removes it completely (0 in the model).

The spectrum tells interference from noise. Model: an ADC record at 1 MHz, 1 048 576 samples, white noise 0.7 LSB, mains 50 Hz and 150 Hz, supply ripple 300 kHz with a 600 kHz second harmonic and a short 10 LSB pulse every millisecond (digital traffic). In time this is just noise with an RMS of 1.53 LSB instead of 0.700 — one number does not reveal the source. In the spectrum (Welch method, 7.63 Hz step):

The line frequency names the culprit: 50 Hz and odd harmonics — the mains, the converter frequency and its harmonics — the supply (section 58), a comb with the period of a task or a transfer — your own digital part. The white floor cannot be removed by layout, the lines can (section 181).

Dither. If the noise is smaller than the ADC step, averaging is useless: an input of 1000.3 LSB without noise gives 1024 identical codes, the mean is off by 0.30 LSB. With 0.5 LSB of noise the same mean is off by 0.017 LSB: the noise "smeared" the input over neighbouring codes. Details — section 165.8.


49г.7 Pitfalls

Noise is "measured" as peak-to-peak on a scope. Peak-to-peak grows with record length: 9.6 σ on a million points. Compare RMS in a known bandwidth.

Noise is given in V/√Hz but used in the calculation as volts. The density must be multiplied by the square root of the bandwidth — and the bandwidth counted up to the ADC, with everything that folds from above (49г.1, 50а.4).

The source resistance was reduced, but the sampling noise did not change. This is kT/C: 28.8 µV on 5 pF for any R. The sampling capacitance is fixed by the chip; the additions are independent from sample to sample — averaging helps.

4096 samples averaged, but the low bits still wander. 1/f noise or drift: the mean of the slow component does not fall as √N. Only a lower 1/f corner helps (another op amp, a zero-drift amplifier) or a circuit that moves the signal above the corner.

16 samples summed against 50 Hz — no use. Interference of a definite frequency is not random. Make the averaging window a multiple of 20 ms, or sample in sync with the mains.

A line in the spectrum that "cannot be there". A frequency above half the sampling rate folded down: 600 kHz at 1 MHz shows up at 400 kHz.

A ×100 amplifier added "for accuracy". Its 10 nV/√Hz noise became 1 µV/√Hz at the output — in 1 MHz that is 1000 µV and ENOB 9.858. Without a filter the gain made the result worse.

The photodiode is noisier than the resistor calculation says. Above 51.7 nA on 1 MΩ the shot noise of the current itself dominates.


49г.8 Summary

Next: section 49д "Heat: power, thermal resistance, die overheating, heatsink, thermal time constant" — the fifth section of the series "Physics for the developer": where the heat of a die and a board goes, how to compute the temperature of an STM32 and a transistor from the datasheet thermal resistance, what heatsink is needed, and why a transistor survives a pulse of amperes but not the same current continuously.

Open in the interactive handbook