cancel
Showing results for 
Search instead for 
Did you mean: 

Filtering ADC samples

lowpowermcu
Associate II
Posted on July 30, 2010 at 11:38

Filtering ADC samples

1 REPLY 1
raptorhal2
Lead
Posted on May 17, 2011 at 14:00

The first step is to read AN2834 ''How To Get Best ADC Accuracy.....'' available on the STM download section to make sure that you are getting the best conversion accuracy and noise.

Assuming you have done that, a simple filter is a first order lag implemented as:

     New Value = Previous Value + K*(New Sample - Previous Value)

K should not be greater than 1.

K = 0 or 1 does no filtering.

Low values of K result in more filtering, but the frequency response is lower. You will have to pick a value of K suitable for your application.

If the selected K is = 1/(power of 2), a simple right shift of (New Sample - Previous Value) can be used.

This method can work on any mcu, not just STM32s.

Cheers, Hal