# Stable readings from a potentiometer

**URL:** <https://forum.arduino.cc/t/stable-readings-from-a-potentiometer/630016>\
**Category:** General Guidance\
**Created:** [January 8, 2020, 10:04am UTC](https://forum.arduino.cc/t/stable-readings-from-a-potentiometer/630016 "2020-01-08T10:04:33Z")\
**Posts on this page:** 9\
**Page:** 1

<div class="post-metadata">

**Author:** ![jifop](https://avatars.discourse-cdn.com/v4/letter/j/e68b1a/32.png) [@jifop](https://forum.arduino.cc/u/jifop)\
**Post date:** [January 8, 2020, 10:04am UTC](https://forum.arduino.cc/t/stable-readings-from-a-potentiometer/630016/1 "2020-01-08T10:04:33Z")

</div>

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?

---

<div class="post-metadata">

**Author:** ![wvmarle](https://dub1.discourse-cdn.com/arduino/user_avatar/forum.arduino.cc/wvmarle/32/1013044_2.png) [@wvmarle](https://forum.arduino.cc/u/wvmarle)\
**Post date:** [January 8, 2020, 2:43pm UTC](https://forum.arduino.cc/t/stable-readings-from-a-potentiometer/630016/2 "2020-01-08T14:43:30Z")

</div>

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

---

<div class="post-metadata">

**Author:** ![SteveMann](https://avatars.discourse-cdn.com/v4/letter/s/5e9695/32.png) [@SteveMann](https://forum.arduino.cc/u/SteveMann)\
**Post date:** [January 8, 2020, 2:57pm UTC](https://forum.arduino.cc/t/stable-readings-from-a-potentiometer/630016/3 "2020-01-08T14:57:09Z")

</div>

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

---

<div class="post-metadata">

**Author:** ![DVDdoug](https://dub1.discourse-cdn.com/arduino/user_avatar/forum.arduino.cc/dvddoug/32/671533_2.png) [@DVDdoug](https://forum.arduino.cc/u/DVDdoug)\
**Post date:** [January 8, 2020, 3:07pm UTC](https://forum.arduino.cc/t/stable-readings-from-a-potentiometer/630016/4 "2020-01-08T15:07:36Z")

</div>

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.

---

<div class="post-metadata">

**Author:** ![PieterP](https://avatars.discourse-cdn.com/v4/letter/p/ecccb3/32.png) [@PieterP](https://forum.arduino.cc/u/PieterP)\
**Post date:** [January 8, 2020, 3:31pm UTC](https://forum.arduino.cc/t/stable-readings-from-a-potentiometer/630016/5 "2020-01-08T15:31:53Z")

</div>

> 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](https://tttapa.github.io/Control-Surface-doc/Doxygen/dc/d58/FilteredAnalog_8ino-example.html) and [here](https://tttapa.github.io/Arduino-Helpers/Doxygen/da/da7/classFilteredAnalog.html#details) 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

---

<div class="post-metadata">

**Author:** ![mikb55](https://dub1.discourse-cdn.com/arduino/user_avatar/forum.arduino.cc/mikb55/32/1149025_2.png) [@mikb55](https://forum.arduino.cc/u/mikb55)\
**Post date:** [January 8, 2020, 3:48pm UTC](https://forum.arduino.cc/t/stable-readings-from-a-potentiometer/630016/6 "2020-01-08T15:48:36Z")

</div>

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.

---

<div class="post-metadata">

**Author:** ![jifop](https://avatars.discourse-cdn.com/v4/letter/j/e68b1a/32.png) [@jifop](https://forum.arduino.cc/u/jifop)\
**Post date:** [January 9, 2020, 9:59pm UTC](https://forum.arduino.cc/t/stable-readings-from-a-potentiometer/630016/7 "2020-01-09T21:59:48Z")

</div>

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.

---

<div class="post-metadata">

**Author:** ![Wawa](https://dub1.discourse-cdn.com/arduino/user_avatar/forum.arduino.cc/wawa/32/1211303_2.png) [@Wawa](https://forum.arduino.cc/u/Wawa)\
**Post date:** [January 9, 2020, 10:12pm UTC](https://forum.arduino.cc/t/stable-readings-from-a-potentiometer/630016/8 "2020-01-09T22:12:43Z")

</div>

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..

---

<div class="post-metadata">

**Author:** ![system](https://dub1.discourse-cdn.com/arduino/user_avatar/forum.arduino.cc/system/32/1140315_2.png) [@system](https://forum.arduino.cc/u/system)\
**Post date:** [May 5, 2021, 7:06pm UTC](https://forum.arduino.cc/t/stable-readings-from-a-potentiometer/630016/9 "2021-05-05T19:06:51Z")

</div>

Closed on May 5, 2021, 7:06pm UTC


