We detect you are using an unsupported browser. For the best experience, please visit the site using Chrome, Firefox, Safari, or Edge. X
Maximize Your Experience: Reap the Personalized Advantages by Completing Your Profile to Its Fullest! Update Here
Stay in the loop with the latest from Microchip! Update your profile while you are at it. Update Here
Complete your profile to access more resources.Update Here!

What Is Oversampling?

Oversampling is a simple way to reduce the noise when measuring an analog signal. See the difference in signal precision and learn about performing this on our ADC with Computation (ADCC) peripherals.


Analyzing ADC Variability with 500 Power Supply Samples

In a perfect world, when measuring a signal with an Analog-to-Digital Converter (ADC), only one sample is needed to get a precise and accurate result. But the real world is often noisy and full of errors. To demonstrate this, 500 samples were taken of the output of an old linear power supply and plotted on the graph below. The bottom X-axis is the ADC result (in units of bits), the top X-axis is the equivalent measured voltage and the Y-axis is the number of samples.

No-Oversampling-ADC-Graph

Noise comes from many sources—the source itself, cables, vibrations, Electromagnetic Interference (EMI), thermal gradients, etc… Some noise sources can be reduced or eliminated by careful design and selection of components, while others are not cost effective or impossible to control.

One method to reduce the amount of noise in an ADC result is to use oversampling. Oversampling is the process of taking multiple measurements of the same signal, then averaging them together. Generally, the number of samples collected is a power of two, which allows the division to be performed by bit-shifting.

This requires the signal to be stable during the measurements, so fast changing signals cannot be used with oversampling. But signals like temperature are usually slow to change, and thus stable enough for this method. However, oversampling only can reduce noise above the effective sampling frequency. Below this, the noise is common to all samples acquired, and cannot be averaged out.

The acquisition time of the ADC can be reduced by using signals that are low-impedance or by using an integrated Operational Amplifier peripheral to buffer the input signal. This reduces the acquisition time portion of the measurement, which can be a substantial percentage of the total conversion time.

When oversampling is possible, the impact of noise can be greatly reduced. The images below show the results from oversampling the same power supply output by 2x, 4x, 8x and 16x.

Oversampling-2x-4x-8x-16x-Graphs

In each of these graphs, the peak is at about the same value, but the standard deviation has decreased significantly. This is due to the ADC acting like a low-pass filter from the oversampling. In the table below, the computed mean, median and standard deviation of each set of samples is shown.

 

Mean

Median

Standard Deviation

No Oversampling

2011.2

2012

7.100

2x Oversampling

2012.028

2012

5.430

4x Oversampling

2011.728

2012

3.485

8x Oversampling

2011.348

2011

2.713

16x Oversampling

2012.08

2012

1.804

Oversampling can be performed in software, but some devices, like the PIC16F17146 family of microcontrollers contain 12-bit fully differential ADCCs that can perform this calculation automatically. The ADCC also functions while the rest of the device is in sleep, which minimizes the noise contributed by the microcontroller during runtime operation.

Another way to use oversampling is to get a higher-resolution result than what is possible with the native converter. For instance, the PIC16F17146 has a 12-bit differential ADCC. If two samples are summed together, they generate a result that can be up to 13-bits in size. However, above the native resolution, the conversion results will have extra error. For instance, in the 13-bit example, the value 0x01FF is not achievable by the ADC (0xFFF + 0xFFF = 0x1FFE), and the rounding operation is lossy, which means some values will be statistically more likely to occur than others. To improve the performance, oversampling and then averaging down the result can be used. For instance, if eight samples were acquired to make a 15-bit result, then it was averaged down to a 13-bit value, the performance will be better than just accumulating two results to make a 13-bit value. However, it should be noted that results above the rated resolution of the ADC will have larger error than the native performance.

As shown earlier, oversampling can reduce the standard deviation of the analog measurements, but it does not really change the mean or median values. However, this reduction in noise can be critical in some types of applications. For instance, if the input offset voltage of the OPAMP was being nulled, the calibration algorithm needs stable measurements to step the offset adjustment register in the microcontroller. Random noise can slow or prevent the algorithm for completing the adjustment correctly. The ADCC found on microcontrollers like the PIC16F17146 family can perform this automatically while also functioning in sleep mode. For more information, check out our ADCC web page.

Robert Perkel, Apr 25, 2024
Tags/Keywords: Industrial and IoT