2010-07-30 02:38 AM
Filtering ADC samples
2011-05-17 05:00 AM
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