How to get the best ADC accuracy AN2834
24/49 DocID15067 Rev 3
3.2.2 Reference voltage / Power-supply regulation
The power supply should have good line and load regulation since the ADC uses V
REF+
or
V
DDA
as the analog reference and the digital value is the ratio of the analog input signal to
this voltage reference. V
REF+
must thus remain stable at different loads.
Whenever the load is increased by switching on a pa
rt of the circuit, the increase in current
must not cause the voltage to decrease. If the voltage remains stable over a wide current
range, the power supply has good load regulation.
For example, for the LD1086D2M33 voltage regulator, the line regulation is 0.035% typical
when V
IN
varies from 2.8 V to 16.5 V (when I
load
= 10 mA), and the load regulation is 0.2%
when I
load
varies from 0 to 1.5 A (please refer to the LD1086 series datasheet for details).
The lower the line regulation value, the better the re
gulation. Similarly, the lower the load
regulation value, the better the regulation and the stability of the voltage output.
It is also possible to use a reference voltage for V
REF+
, for instance the LM236, which is a
voltage reference diode of 2.5 V (refer to LM236 datasheet for more details).
3.2.3 Analog-input signal noise elimination
Averaging method
Averaging is a simple technique where you sample an analog input several times and take
the average of the results by software. This technique is helpful to eliminate the effect of
noise on the analog input in case of an analog voltage that does not change often.
The average has to be made on several readings that all correspond to the same analog
input vo
ltage. Make sure that the analog input remains at the same voltage during the time
period when the conversions are done, otherwise you will add up digital values
corresponding to different analog inputs, and you will introduce errors.
In the STM32L0 and STM32L4 microcontrollers, the
ADC hardware oversampling feature
can be used for averaging. This feature simply performs the sum of a given number of ADC
raw samples into one final sample. This final sample can then be right shifted to reduce the
bit width caused by multiple ADC samples accumulation. All these operations (accumulation
and right-bit shifting) are performed by hardware. The STM32L0 and STM32L4
microcontrollers support hardware oversampling up to 256 input samples.
Adding an external filter
Adding an external RC filter eliminates the high frequency. An expensive filter is not needed
to deal with a signal that has frequency components above the frequency range of interest.
In this case, a relatively simple low-pass filter with a cutoff frequency f
C
just above the
frequency range of interest will suffice to limit noise and aliasing. A sampling rate consistent
with the highest frequency of interest will suffice, typically two to five times f
C
.
Note: The R and C that form the external filter sho
uld have values that match the conditions
described in Section 3.2.4 and Section 3.2.7.