Course contentsShow
← Embedded Systems & Computer Architecture
Lesson 301 of 9364. Peripheral Interfacing and ControlFree lesson

Analyzing Quantization Error and Signal Noise

Learners will evaluate the inherent errors introduced during the rounding of analog values to the nearest digital representation.

Analyzing Quantization Error and Signal Noise

In this lesson, you will learn how to evaluate the inherent errors introduced when your microcontroller rounds a continuous analog voltage into a discrete digital value.

The Quantization Gap

When an Analog-to-Digital Converter (ADC) samples a voltage, it maps an infinite range of analog values onto a finite set of digital codes. Imagine your ADC has a range of 0V to 3.3V and a resolution of 10 bits. It divides the 3.3V range into 1,024 discrete "buckets" (or steps). If your input voltage falls between two buckets, the ADC must round it to the nearest digital integer. This rounding creates quantization error.

This error is essentially the difference between the true analog value and the rounded digital representation. Because the ADC always rounds to the nearest step, the maximum error is always half of one Least Significant Bit (LSB).

Visualizing the Error

If your ADC step size is Vstep=Vref2nV_{step} = \frac{V_{ref}}{2^{n}}, then any input signal will have an uncertainty of ±Vstep2\pm \frac{V_{step}}{2}.

Consider a simple check in code to see how a digital value represents an input:

// Step size calculation for 3.3V reference and 10-bit ADC
float v_ref = 3.3;
float v_step = v_ref / 1024.0; 

// If ADC reads a raw value, the 'noise' is inherent to the resolution
uint16_t adc_raw = get_adc_value();
float measured_voltage = adc_raw * v_step;

// The uncertainty (quantization noise) is:
float error_margin = v_step / 2.0;

Signal Noise vs. Quantization

While quantization error is a mathematical consequence of turning analog signals into numbers, signal noise refers to external electrical interference (like electromagnetic noise from motors or power lines).

When you look at your adc_raw value, you aren't just seeing the quantization error; you are seeing the original signal plus "floor noise." If your noise level exceeds the v_step size, your ADC readings will "flicker" between two adjacent digital codes even if the input voltage is perfectly stable. This is why high-precision systems often require physical filtering (like a capacitor on the input pin) before the signal reaches the ADC, as software cannot distinguish between the signal, true quantization error, and external environmental noise once the conversion is complete.

Key Takeaway: Quantization error is an unavoidable rounding uncertainty of ±0.5\pm 0.5 LSB, whereas signal noise introduces additional fluctuations that can be mitigated through external hardware filtering.