filtering adc samples using stm32

Status
Not open for further replies.

lowpowermcu

Junior Member level 2
Joined
Aug 8, 2012
Messages
20
Helped
1
Reputation
2
Reaction score
1
Trophy points
1,283
Activity points
1,425
Hi all,

I am acquiring adc voltage using stm32 device and after 1000 samples I am doing the mean value but I have found that this is not sufficient in my case (the value (average) I got is not stable) I thought to increase the number of samples (size of buffer) but I face RAM size issue so I want to know is there some other method to have a stable value other than averaging ?

MCU Lüfter
 

have you tried a running average? also zeroing the least significant bits of the ADC value?
have you looked at your signal with an oscilloscope? have you a lot of noise or could you be aliasing?
 

Instead of storing the samples, why don't you sum the Sample using a counter and then divide per the value of the counter ? If you want to calculate the mean of 5000 samples, you use a variable used to sum each sample at the sampling rate and then (you count the samples with a counter) and then you divide the sum per the value of your counter.
 

Hi guetguet,

because I am using the ARM library, I'll try to test my code as you said and I'll keep you informed.
@horace I tested with zeroing the LSB but w/o success, I didn't find in ARM DSP library running (moving) average algorithm.

MCU Lüfter
 

I read this somewhere and saved it. How to implement a simple single pole digital filter. It works great and I now use it all the time.

 

So try to change a little the code of ARM, it will be pretty easy :razz:
 

Status
Not open for further replies.

Similar threads

Cookies are required to use this site. You must accept them to continue using the site. Learn more…