Potentiometer issues

My team is trying to set up a string potentiometer and we are having trouble reading the voltage that it gives out. I tried running the robot in test mode to see all variables, and I see the potentiometer that we had in the code (and for some reason I also see the “potentometer” that we misspelled but fixed later) and it doesn’t waver from ~0. I’m confused as to why this could be happening because when we check the voltage with a voltmeter, it is outputting the correct number of volts. Even when pulling on the screen it doesn’t change. In the code all we have is something that just gets the potentiometer, the code doesn’t do anything besides that.

Thanks in advance for your help!

<Same team as OP>

I guess our main question is:

What code do we need to read the 1-60 mV output of the potentiometer? We have it wired into Analog breakout 1, and using a multimeter on the prongs shows the correct mV output as the string is retracted.

What we currently have is based on this analog input guide from team 358

When we boot up and enter test mode, we see the output from “potentiometer” and it appears to be live (its constantly changing) however it only changes from -0.0001 to 0.0001 and doesn’t appear to be reading any real voltage values.

How do you have it wired? The two “ends” of the pot need to be connected to +5 and (-) on the Analog Breakout, and the “wiper” goes to the SIG pin.

We had difficulties as well. We were attempting to link a potentiometer to the tilt axle on our shooter and use the voltage drop as a way of calculating the tilt position. I added a carbon resistor to the low side of the circuit, because I was afraid of creating a high current situation. When I put a multimeter across the circuit, I always was able to detect a clear and repeatable change on the signal wire, but when trying to read the value it would read as a nonsense value. Someone told me I should have a capacitor in the circuit as well, but I don’t really understand why.

We replaced the potentiometer circuit with an absolute position rotary encoder from the KOP a few years ago and we were able to do what we wanted, but we had some problems with that as well…and I think the potentiometer solution would have been better if we had gotten it to work.

Can anyone suggest what they have used in applications like this? The entire travel of the axle is only about 110 degrees from full up to full down.

A properly wired potentiometer is an “absolute rotary encoder” with an analog output. What sort of high current situation did you think you might encounter? What kind of value were you seeing on the signal wire when you measured it, and how were you powering it?

Thanks…yes, not the best clarification. We used the magnetic rotary encoder from Austriamicrosystems. But to answer your questions, I was concerned what would happen if the potentiometer was turned to a point where it was adding such a small amount of resistance that the current would exceed 500mA, and we would get a value that hung around 0.27 on the signal pin regardless if how the potentiometer was turned. And we were powering it with the 5 volts from the analog breakout.

What value potentiometer are you using?

I used a 1 meg linear taper potentiometer and a 10K carbon resistor…thinking was at full, the 1 meg made the 10k essentially nothing, thus nearly all of the 5 volts would drop across my variable resistance.

A megohm is quite a large value. That’s likely to result in a lot of noise on the Analog Input. A 10k to 100k pot is typical for a sensor in an FRC robot, with lower values giving better noise immunity but requiring more current.

If you’re worried about “variable resistance”, then you might not be understanding the proper use of a potentiometer. You’re supposed to connect +5 and (-) across the device, and the wiper goes to the Analog Input. 5 volts is always across the pot. The output is a voltage which is proportional to the turning of the shaft.

The only way you’d need to be concerned with excess current is if you improperly connected the wiper to one of the power supply pins (or if you used a pot with much too small a value).

That make sense, we’ll try that - and you’re right, I had no idea how to properly connect…where would one find that out without experimentation and exactly what I’m doing now.

For educational purposes - Why is a larger value potentiometer value synonymous with additional noise?

It’s a matter of source impedance. The higher the resistance, the less able it is to overpower any noise being induced on the signal.

Thank you for the much needed lesson…
We are currently picking up the signal from our encoder and multiplying it by 72 to simulate degrees around the circle. The problem we’re having is that the break point between 360 and 0 (between 5 volts and 0 volts from the encoder) is very close to the top of our travel, and there were times when we over drove the tilt and surpassed the maximum point on the circle. Then, our autonomous code read the current angle to be something like 3 degrees (rather than 355 degrees) and tried to raise rather than lower the shooter to reach the desired set point. We should have rotated the magnet as soon as we discovered this, but we thought we could handle it by adjusting the limit switch location…hind sight!

Can I install a potentiometer in the manner discussed here without any significant code changes (except perhaps the multiplier and the desired “set point”) and read the value just like we’re reading the encoder value?

Yes, it should be that simple. The one difference between the sensors that you need to worry about is that potentiometers typically have physical limits on how far they travel. If you do get a continuous-travel pot, the “dead zone” at the transition from maximum directly to minimum is usually a significant angle. For your purposes, just make sure the pot is rotated so the normal range of travel is not exceeded.