Math Bridge: Sampling and Quantisation Floors

← Back to Sensor Labs: Best Practices
Math BridgeSensorsStruggle-friendly runway

Two floors under every sensor reading

One thread from the DHT22's two-second interval to Nyquist, ADC steps, quantisation noise, and the STUCK check.

Phoebe, the physics guidePhoebe guides
The one targetSeparate a timing limit from a value-resolution limit.
The chapter case2 s DHT22 reads and a 12-bit, 0–100% soil ADC.
What it buys youKnow what averaging can and cannot repair.

Try this in the moving-average smoothing and lag lab, where you change the DHT22 temperature and see the delayed average.

1. Start with two kinds of rounding

A sensor system picks moments in time and codes on a value scale. The DHT22 allows one reading every 2 s. The soil ADC stores one of 4,096 codes. A missed fast change is a timing error; a rounded moisture value is a code-size limit.

Phoebe: Keep these floors separate. More ADC bits cannot recover a change sampled too slowly. Faster sampling cannot make a 12-bit code infinitely fine.

2. Turn the interval into a Nyquist ceiling

1

Invert timef_s=1/T=1/2 s=0.500 Hz.

2

Apply Nyquistf_max=f_s/2=0.250 Hz.

3

Read the period1/0.250 Hz=4.00 s per fastest full cycle.

Content above that limit can fold into a false slower signal. It does not simply disappear.

3. Turn bits into a moisture step

1

Count the codes2^12=4,096.

2

Divide the rangeq=100%/4,096=0.0244% per count.

3

Find RMS rounding noiseσ_q=q/√12=0.00705%.

4

Find ideal SNR6.02(12)+1.76=74.0 dB.

4. Compare the STUCK threshold

The chapter flags a 20-reading window when its standard deviation is below 0.01%. The ideal 12-bit floor is 0.00705%, so 0.01/0.00705=1.42. A real live sensor usually has extra noise. An unusually quiet sequence can therefore be evidence of a frozen ADC.

5. Say what averaging changes

For independent random noise, averaging N readings reduces the RMS noise by √N. It does not reconstruct a frequency that already aliased, and it does not revive a stuck code. The fix must match the failure: sample fast enough, use adequate code resolution, or repair the sensor path.

6. Check yourself

What is the sample rate for one reading every 2 s?
Answer: f_s=1/T=1/2=0.500 Hz.
What is one count on a 12-bit 0–100% scale?
Answer: 100/4,096=0.0244% per count.
Can averaging repair aliasing?
Answer: No. Averaging can reduce suitable random noise, but aliased content has already been relabelled as another frequency.
Honesty boundary.

These are the chapter inputs, worked results, and named teaching assumptions.

2 s interval
Time, interval, or service-life value
12-bit ADC
Digital resolution or converter setting
0–100% scale
Percentage, ratio, or gain
20-reading STUCK window
Device, payload, or sample count
0.01% threshold come from the chapter
Percentage, ratio, or gain

The 0.500 Hz, 0.250 Hz, 4.00 s, 4,096, 0.0244%, 0.00705%, 1.42×, and 74.0 dB results follow from the displayed formulas. The model does not claim an ideal ADC describes field noise.