Signal with Random Noise

Many MCU applications involve measuring analog signals. In the ideal case of a completely noiseless signal, achieving a high-quality digital representation of the signal is simple: single ADC conversions triggered with a fixed time interval are sufficient. In reality, most analog signals are affected by noise, and modern Microchip ADCs provide functionality that can be used to increase the signal-to-noise ratio.

Figure 1 illustrates a noisy signal. Single conversions evenly spaced in time result in a noisy digital representation of the signal. A potential solution could be to filter the acquired samples in software, but this would require additional CPU resources. A better option would be to use the hardware sample accumulator supported by the ADC.

Figure 2 illustrates how a single ADC conversion trigger results in a burst of up to 64 successive ADC conversions. Each conversion will be accumulated in hardware and the average value of the accumulated samples can be calculated by dividing the accumulated result by burst size. Because the sampled noise has a zero mean, the averaged result will be close to the actual signal value.

Here, ADC feature hardware sample accumulator can be used for averaging by configuring ADC to accumulate m samples automatically. ADC sampling rate is affected by the number of samples accumulated. Total sampling time for m samples is the multiplication by m (the number of samples taken) of the sampling time for one sample.

Consider a DC signal mixed with random noise as shown in Figure 1.

Figure 1. DC Signal Mixed with Random Noise

If the signal is zoomed, consider ADC samples which are taken as indicated in part 'A' of Figure 2.

Consider oversampling is done with eight samples. This means that a single burst contains eight samples.

In a single burst, eight samples are taken, which are shown with red markings in Figure 2.

Figure 2. Detailed Noise Signal

As oversampling is done with multiple samples, the average result of all the sampled values will be approximately equal to the original DC signal. That means it results in zero mean noise. Increasing the burst size (accumulating more samples) helps to flatten out more peak signals and results in more suppression in noise.