[sdiy] Digital filtering of pot input

Matthias Puech matthias.puech at gmail.com
Fri Dec 2 13:51:21 CET 2016


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



More information about the Synth-diy mailing list