Potentiometer noise

We have observed significant point noise in potentiometer reading. Imagine quite a slowly moving mechanism (1deg/10ms) observed by a potentiometer (no PID, just waiting for a limit, then stopping the movement).
In the nice flow of slowly changing values we have some single-sample outliers of > 200 units lower values. Such as (last column)

1334, 70.060, 36     , 1841
1335, 70.070, 36     , 1870
1336, 70.080, 36     , 1874
1337, 70.090, 36     , 1598
1338, 70.100, 5      , 1958
1339, 70.110, 5      , 1935
1340, 70.120, 5      , 1956
1341, 70.130, 5      , 1988

Since it is typically a single outlier, students quickly added a primitive 3-way filtering, but I still wonder where this comes from.
Interestingly, I have also observed some correlation with change in the sonar reading, which is legitimate. At around 70.100, an object really got in front of the sonar (third column), and the potentiometer outlier happened just around that time (and I have seen this in multiple cases).
Any idea where could this change come from? Could it really be related to the sonar activity (i.e. triggering an interrupt that somehow messes up with the potentiometer ADC)?

This is indeed quite interesting. Assuming that you are correct about the sonar correlation…

Do you use PROS or RobotC? If you are using PROS, maybe @hotel or @edjubuh might know something about the interrupt behavior. Otherwise, @jpearman would know for RobotC.

Another possibility (not software related) is that perhaps the sonar is drawing more current when you pass an object in front of it and thus experiences voltage drop that disrupts the poteniometer readings. Could you try running this test with the sonar unplugged?

Also, try this same test with the programming environment you are not using (using RobotC, try PROS, and vice versa) because if it is software related at a low level than it is possible that the other will behave differently. If you expierence the same behavior, it is more likely that it is electrical and if you expierence different than it is software.

If you are wrong about the sonar correlation, it is also possible that the pot is just wearing down which happens naturally over time because of the constant current on the resistor. Can you try replacing the pot? (Although this behavior is not really indicative of a pot wearing down)

edit: Can you post the relevant section of the code used to collect this data also?

Thanks for the reply.
My sonar correlation could be completely accidental and we didn’t collect that many runs to be sure. The data I posted were collected using the RobotC built-in datalog service, so the “code” was pretty much:

#pragma config(DatalogSeries, 4, "sonar", Sensors, Sensor, dgtl7, 10)
#pragma config(DatalogSeries, 5, "mobilePot", Sensors, Sensor, in3, 10)

Anyway, having a good night sleep on it, I think such noise would be quite natural to a potentiometer - you’re dragging a spring-loaded contact over a resistive element on a moving, shaking robot. Remember old radios with analog volume knob and how did it crackled while turning it? Likely the same thing.
(but it might be a worn out/faulty pot - this one has seen plenty abuse before, where the motor forced it beyond the normal physical limits of 270 degrees).

I am actually glad we run into this issue, especially during a team practice when they had the datalog available - that allowed me to introduce the programmers to the concept of faulty sensors and the need to validate and condition the incoming data. Priceless!
Once the datalog revealed what’s going on, the team programmer solved the problem it caused literary in minutes using trivial filtering. We haven’t had much time to characterize the issue more thoroughly yet.

Pot brushes are generally noisy, so you can apply a low pass filter to them. Also, if you do see a correlation to the sonar, make sure that the pot cabling is not wrapped together with the sonar cables. If they need to pass each other then do it at 90 degree angles.

The sonar pulse is definitely an impulse function that could cause noise on analog cables.

Yup. Low pass filter is a good way to deal with pot noise like this.

I do not remember any old radios with ANALOG knobs , only radios I’ve ever used have been built into cars that use digital encoders for knobs. lol days of analog stuff is before my time :wink: