[sdiy] Digital filtering of pot input

rsdio at audiobanshee.com rsdio at audiobanshee.com
Sat Dec 3 09:11:52 CET 2016


Hi Tim,

The math that you describe is exactly an IIR first-order 6 dB/octave low-pass filter. The corner frequency would be 1/(4*M_PI) of the sample rate, or about 3.5 kHz at 44.1 kHz sample rate. Most pots are scanned much slower, so the corner frequency would be lower. At a 100 Hz sample rate, your filter would be 3 dB down at about 8 Hz. This is all assuming that I didn't type something wrong in my calculator.

Brian


On Dec 2, 2016, at 10:09 AM, Tim Ressel <timr at circuitabbey.com> wrote:
> 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.
> 
> --TimR
> 
> 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




More information about the Synth-diy mailing list