Unreliable potentiometer input?

Hey all, I'm having issues getting consistent performance out of my potentiometer. This is part of a much larger project, although I have stripped everything else away in an effort to better diagnose the problem and ask for help. Even with the most basic setup the problem still remains.

I have a 10K pot (specifically this one) connected to the +5V/GND pins of the arduino, with the signal wire going into analog pin A1. My code is as follows:

double side_pot = 0;

void setup() {
    Serial.begin(115200);
    #if !defined(__MIPSEL__)
        while (!Serial); // wait for serial port to connect
    #endif
}

void loop() {
    side_pot = analogRead(A1);
    Serial.println(side_pot);
    delay(20);
}

About as simple as you can get. About half of the time I can get good readings out of my pot (a bit jittery but nothing abnormal), but the other half of time it stays stuck at the max value of 1023. If I bend the wires coming out of the pot with my finger I can get it to jump between the two states (good reading and stuck at max value). However I can't narrow the problem down to an individual wire - I can get it to happen consistently with any one of the three. The pins going into the arduino seem fine, if I wiggle the wire going into A1 the readings stay fine, and same for the 5V and GND. Clearly something is up with the pot itself, or the connections coming out of it.

My solder joints look ok (I think) so I'm not really sure if one of the wires is bad, especially since it happens with all of them. I've read online that excess heat from soldering can damage pots - is this to blame?

I'm using this pot to (eventually) measure and constrain the movement of a motor, so if the values are unreliable it will break my whole mechanism.

Any thoughts? Thanks!

You should NOT have used the holes to solder the wires on.
Those holes are the rivets that connect the lug to the carbon track.
That connection is now unreliable because of the mechanical stress and the flux in between.

Throw away the pot, and connect the wires to the pins (or lugs) of the pot.
Leo..

Yikes, had no idea. That would definitely explain the problems I'm having. Thanks for your help.

I have another pot on hand that I'll try soldering to the pins real quick and see if it's any better.

Always nice for a questioner to supply a schematic for us to check too.

The Red connection looks iffy.

Ok, had a rough time soldering onto the little pins. Still pretty new to this. :-[ Looks pretty bad but the joints feel strong-ish just moving them with my fingers. I tested the lines with a continuity tester and everything seems stable.

The results (as far as getting good values out of it go) are about the same if not worse than before. Is it just another botched solder job or is something else up?

Show us the complete wiring.

Show us a schematic.

Do you have a DVM, if so check the pot for intermittentancy.

Here's my current setup. Just 3 wires. 5V, GND, and signal.

Also, I have a DVM although I am unsure what you mean by checking it for intermittentancy. How do I do this?

With 10k pot at mid-range.
Measure resistance black to yellow, move dupont connectors.
Measure resistance red to yellow, move dupont connectors.
You should always see ~5k ohms, i.e. never infinity.

Measure Bk to Y resistance, rotate shaft, should be a ‘smooth’ 0 to 10k reading.
vice versa for R to Y.

Assume soldered wires under heat shrink are soldered.
Assume proper crimping in dupont pins.

Wonderfully explained, thank you.

I think the assumptions you stated are fair - I feel confident about those.

I measured between the different points as specified and found that the reading would frequently jump to infinity when I moved the connectors. This is was true for both Bk to Y and R to Y.

If I keep everything still I can see a smooth 0 to 10k when turning the shaft.

Sounds like you may have at least one bad crimp.

However, when it went to infinity, confirm you had 100% solid connection with the DVM test leads.

If they were not solidly connected, the infinity reading came from poor test lead connection.

You should have seen ‘no’ infinity readings.

Would I still expect to see no infinity readings if the pot was damaged in some way? Just curious how everything works.

I just performed the test again taking extra care to make sure the leads are pressed firmly against wires and saw a lot less infinity readings. I also did a similar test with the leads directly touching the pins of the pot itself and saw the same results. I think its safe to say the leads may have been slipping a bit when I moved the wires around.

If the pot has dirt within or the wiper is not making proper connection on the resistive material the pot can be considered bad.

However if these pots are new it might be unlikely both are bad.

Do you have any pots like this!

Yeah, both of these pots are new. I got a pack of 2 specifically for this project and they're all I have unfortunately.

What I do with pots is thread the wire through the hole and back round to the solder lug. That provides a little relief on the solder joint- not much, but at least a little, if the wire gets bumped.

Hi jmattingley23,

I'm going through the same issues right now and finding this thread helpful. What was the final fix? Was this all just making sure you had good solder joints?