Stable readings from a potentiometer

I want to use a fader as an input on a project I’m working in but I can’t seem to get a stable enough reading from one to make it viable.

The minimum resolution I can goto is 8bit 0-255 and even with this when the fader is set to 50% the readings jump between 125-128.

I’m using a 10K pot and have tried a low pass filter (although I’m not 100% sure of the best value capacitor to use for this).

I also tried hysteresis and smoothing in the software but this made the fader to unresponsive.

I’ve tried using an external regulated PSU and the usb power but I get the same behaviour either way.

What do you normally do to deal with this?

Start with a decent quality pot, that is not worn out, and then soldering all wires.

You might consider a 10-turn pot. Or switch to digital.

You can always have "jitter" of +/- 1 digit because the analog voltage can be on the "hairy edge" between two digital values. Filtering can slow that down but it can't completely remove the uncertainty/instability. It can be removed with hysteresis.

Try 1uF or higher. The higher the value the more filtering.

It should be more stable if you use the Arduino's power 5V supply because the analog voltage and reference will "track" together.

If you have long wires, shielding will help.

For smoothing you can choose the number of samples and the timing.

Of course, hysteresis will make it less responsive. That's the whole idea. But, you should be able to tweak it for a good compromise.

SteveMann: You might consider a 10-turn pot. Or switch to digital.

That won't help, there will always be some noise, even if the pot is perfect, and the ADC can always flip back and forth between two values if the voltage is right on the edge.

I always use this FilteredAnalog class for filtering my potentiometers. It uses a combination of fast single-pole low-pass filtering and hysteresis (using powers of 2), and it uses oversampling for even higher resolution and better results.

Here's an example and here is the documentation.

You can tweak the filter factor for a perfect balance between stability and responsiveness. I've always been able to get a stable reading without any noticeable latency using this method.

Pieter

Normally you would see 1 or 2 bits of noise when using a 10 bit ADC.
3 bits of noise in a 8 bit reading is pretty bad. Check with an oscilloscope to see if it is really random. Try using screened cable and add some ferrite beads.

Thankyou for your help everyone, I'll take a look at the filtered analogue class and I'll also tweak the hysteresis and see how I get on.

A common 10kB pot should not jump more than one or two values out of 1024. If it does, then there is someting wrong with the hardware/setup. A software fix should NOT be the first solution. Try to give the pot it's own 5volt/ground connection to the Arduino, and/or post a picture of the setup. Leo..