Electronics > Projects, Designs, and Technical Stuff
Stabilizing analog read on a potentiometer
<< < (4/5) > >>
Neomys Sapiens:
Another function that can help is a 'sliding window'. This would mean that you only use samples (the first, the last or the average) whose difference to each other stays within a certain amount.
langwadt:

--- Quote from: mikerj on July 21, 2019, 12:42:59 pm ---
--- Quote from: Sterno on July 19, 2019, 08:29:22 pm ---I have had good luck filtering a noisy analog signal by taking 16 sucessive readings on the ADC, storing these in an array, summing the total and then shifting that result 2 bits to the right.

If I recall, method is called "decimate and shift" and is said to preserve accuracy which can be lost through standard averaging.

--- End quote ---

This is using oversampling to generate more bits of resolution e.g. samplinge 16 times and you get 2 more bits of resolution, providing you have more than 0.5 LSB of noise present.  This will not reduce noise in the final value, in fact it will most likely increase it.

--- End quote ---

with a few assumption on the noise such as a zero mean it can

IDEngineer:

--- Quote from: David Hess on July 21, 2019, 12:27:31 pm ---You might be expecting too much.  The settability of a common single turn potentiometer is about 1 part in 100 or roughly 7 bits.  The best ones can achieve 1 part in 200 or roughly 8 bits.  So if you are expecting more than about 7 or 8 noise free bits, then forget it.
--- End quote ---
Exactly, which is why I said that a toggling LSB isn't unexpected at all. The pot could cause it, noise on the signal from the pot could cause it, his supply rails could cause it... the list is long.

I haven't seen where he tells us the resolution of his A/D but I bet it's more than eight bits.  :palm:
IDEngineer:

--- Quote from: Etesla on July 20, 2019, 11:06:24 pm ---Thank you all for your suggestions. I ended up trying averaging in software first since it came up a lot (using the 10 most recent readings, reading every 10 ms or so) and it worked a treat.
--- End quote ---
BTW, think in binary (or hex), not decimal. Unless you have a solid mathematical reason to average ten samples, try sampling eight or 16. The math becomes a matter of bit shifts instead of actual division, and processors are significantly more efficient at the former than the latter.
David Hess:

--- Quote from: IDEngineer on July 22, 2019, 02:19:08 am ---
--- Quote from: David Hess on July 21, 2019, 12:27:31 pm ---You might be expecting too much.  The settability of a common single turn potentiometer is about 1 part in 100 or roughly 7 bits.  The best ones can achieve 1 part in 200 or roughly 8 bits.  So if you are expecting more than about 7 or 8 noise free bits, then forget it.
--- End quote ---

Exactly, which is why I said that a toggling LSB isn't unexpected at all. The pot could cause it, noise on the signal from the pot could cause it, his supply rails could cause it... the list is long.

I haven't seen where he tells us the resolution of his A/D but I bet it's more than eight bits.  :palm:
--- End quote ---

12 bit microcontroller ADCs toggle a lot more than just the LSB even under ideal conditions.

The potentiometer will be quieter than practically any microcontroller ADC but the potentiometer's limited settability places a limit on precision so there is no reason not to filter the ADC output down to 7 or 8 bits at best removing most or all of the noise.

Navigation
Message Index
Next page
Previous page
There was an error while thanking
Thanking...

Go to full version
Powered by SMFPacks Advanced Attachments Uploader Mod