English
Language : 

AN2834 Datasheet, PDF (32/45 Pages) STMicroelectronics – How to get the best ADC accuracy in STM32Fx Series and STM32L1 Series devices
How to get the best ADC accuracy
AN2834
3.3
3.3.1
3.3.2
Software methods to improve precision
 Averaging samples:
– averaging decreases speed but can give improved accuracy
 Digital filtering (50/60 Hz suppression from DC value)
– set proper sampling frequency (the trigger from timer is useful in this case)
– perform software post-processing on sampled data (e.g.: comb filter - for 50 Hz
noise and its harmonics suppression)
 Fast Fourier Transform (FFT) for AC measurements:
– to show harmonic parts in measured signal
– slower, due to the use of more computation power
 Calibration of ADC: offset, gain, bit weight calibration
– decreases internal ADC errors
– internal ADC structure must be known
 Minimizing internal noise generated by CPU
– design firmware to use minimum disturbance from microcontroller during ADC
conversion - digital silence.
Averaging samples
The principle of this method is to increase ADC precision but decrease ADC conversion
speed (oversampling). If the measured analog signal produces unstable ADC values, then
the mean value of the given input signal can be obtained by averaging a set of values.
Variation can be caused by signal noise or noise generated by the microcontroller itself
(high speed digital signals capacitively coupled to the analog input signal).
Averaging is performed by choosing an appropriate number of samples to be averaged.
This number depends on the required precision, minimum conversion speed and the level of
other ADC errors (if another error has a greater influence on ADC precision, then increasing
the number of averaging values has no effect on total measurement precision).
The advantage of this method is improving precision without any hardware changes. The
disadvantage is lower conversion speed and therefore also lower frequency response (it is
equivalent to decreasing effective sampling frequency).
Digital signal filtering
This method uses digital signal processing techniques.
In principle, averaging is also a simple digital filter with a specific frequency response. But if
the noise frequency spectrum is known, a digital filter can be designed which minimizes
noise influence and maximizes ADC frequency response. For example, if the noise in the
measured signal is coming from the 50Hz power lines, then an appropriate digital filter
suppresses only the 50 Hz frequency and delivers data signal without this noise.
The disadvantage of this method is that it needs appropriate microcontroller processing
power and resources: CPU speed, data/program memory usage.
32/45
DocID15067 Rev 2