[sdiy] Digital filtering of pot input

Tim Ressel timr at circuitabbey.com
Fri Dec 2 19:09:55 CET 2016

I use an exponential filter that works pretty well. You maintain a 
running value, then each new ADC result gets added to it and then the 
running value is divided by 2. I guess you'd call it a running average. 
It gets rid of the LSB bobble you get from noise.


On 12/2/2016 4:51 AM, Matthias Puech wrote:
> Hi DIYists,
> I have a potentially simple question on filtering. I get my pot reading from a very noisy ADC (on-board STM32F4), but I absolutely need the value to be constant when I'm not touching the pot. It's ok for it to be a bit wobbly while I am turning the pot. Now I'm using hysteresis:
> if (fabs(reading - output) < 0.01)
>    output = reading;
> which gives me a stable value when I'm not turning the pot, but I am annoyed by the staircase effect while I'm turning it. Is there a simple filter that will let signal through when there is consistent movement but hold it when not?
> Thanks in advance,
> 	-m
> _______________________________________________
> Synth-diy mailing list
> Synth-diy at synth-diy.org
> http://synth-diy.org/mailman/listinfo/synth-diy

--Tim Ressel
Circuit Abbey
timr at circuitabbey.com

More information about the Synth-diy mailing list