We’ve had an issue where potentiometers plugged in to the roboRIO’s Analog In ports have a large amount of noise. The noise is inconsistent but usually enough to make the signal useless. A related issue is that sometimes, when expecting a signal between 0 and 1, the signal is in some other seemingly random range, like 0.16 and 0.75. These issues have happened with 4 SRX Mag Encoders with the analog encoder wires broken out, and a separate standalone potentiometer (I don’t know specifically which one).
We’ve seen these issues across two roboRIOs so I’m a bit at a loss. I can always focus on trying to filter out the noise, but I don’t think the amount of noise we’re seeing is normal.
The SRX Mag encoders’ ribbon cables are plugged into a small breakout board, and three wires are soldered to the breakout board. Those wires three wires plug in to one Analog In port. I can’t find the exact breakout board used but I know it’s CTRE.
I’m not sure about the other potentiometer but it simply plugs into the Analog In port.
Re: the mag encoder, Joe Ross’ response above is the key. There is no analog output from the mag encoder. If you want an absolute output, you need to use the PWM duty cycle output and plug that into a digital input on the Rio using the DutyCycleEncoder class. If relative is fine you can use the quadrature outputs to two DIOs.
No. A normal potentiometer should operate with the analog input port, but I’ve seen potentiometers fail in weird ways if mechanically stressed. The exact wiring is also critical for all 3 wires. Does it read correctly with a multimeter? Eg power 5V and ground and measure voltage between wiper (signal) and ground with a DMM. Doing a (unpowered) resistance measurement of the electrical paths (ground to wiper, wiper to power, ground to power) while manipulating the position can also be informative. Is the pot a one-turn, 3/5/10 turn, or continuous?
This was an old untested potentiometer so that may be a separate issue. Regardless, now I’m fairly certain that we were wiring the SRX Mag encoders incorrectly. Next time I’m in the shop I’ll rewire the SRX Mag encoders and test the potentiometer. Thanks everyone for the help
Could it be a 5k ohm vs 10k ohm issue? I know one works and the other basically just generates noise and I can never remember which one’s which. Beyond that, maybe try adding ferrite cores to the wire to help block external noise sources?
I’m not sure exactly what you’re referring to, but resistance shouldn’t make any difference. Maybe if you picked something really low, like 100 Ohms, something bad could happen, but 1k, 5k, 10k… should all behave exactly the same when plugged into the RIO.
As @CarlosGJ stated, the 5 k and 10 k pots should both work properly.
Noise in a variable resistor will not be related to the resistance value.
Is it possible that you have bad or cold solder joints where the wires are attached to your pot? Gently move the wires while observing the output, preferably with an oscilloscope. Otherwise, apply a small amount of liquid flux to each solder joint, heat up each solder joint and apply a small amount of fresh solder while holding the wires perfectly still until the solder solidifies. If the solder looks tarnished after it cools, it is possibly a bad solder joint (unless you are using one of the exotic high temperature solders).
I have seen two failure modes in variable resistors where the output is noisy.
One cause is if the pot has been sitting around for some number of years and the surface of the resistance element has become oxidized. Turning the pot from one end, fully to the other end then fully back 10-20 times should “wipe” away the oxide layer so that the moving wiper makes good contact over the whole length of the resistive element.
The second failure mode is if the resistive element becomes damaged somehow. Most commonly, this is through extensive use so that the wiper has worn through the resistive element so that there are holes in it along the path of the wiper. This damage can be seen if one opens up the pot. The only practical fix is to replace the pot. Please note that this failure mode really only applies to the pots with conductive plastic resistive elements and is highly unlikely to occur in wire-wound types.
You pretty well cover it and I’ll add two oddities that we had happen:
the pot’s package label and the pot itself disagreed on if there was a “K” in the resistance or not. That’s a fairly large difference that could in some values effect analog input.
We’ve seen cross-talk with adjacent AI.
It would have been helpful if OP told us if the noise is as the pot wiper is being moved or if the pot wiper is stationary.
I have friend who’s car was making increasingly too much noise on the highway so she kept turning up the radio. It wasn’t too many more miles before she was walking to a phone (to find a motel to stay at for days while the transmission was replaced).
[And I admit that I had not thought of the pot making an irritating buzz. That, too, has happened.]
+1 on the “you can wear a hole in the track”; I’ve seen that on old position controlled damper motor’s feedback pots.
Wire wound pots are a LOT more electrically noisy than the Cermet and conductive plastic pots, especially if they have some vibration.
A small capacitor between the signal line and ground at the RoboRio will kill accidental RF pickup. 0.1 microfarad is reasonable for a 1K pot. Maybe 0.01 mics for a 10K pot. That will give you a corner frequency around 1.5 kHz. Even 10x that value should be OK for things you might be measuring with a pot Use a non-polar capacitor. Really, anything but electrolytic will work fine. Even that would be OK if you got the polarity right.
All the commonly available capacitors with values in the range you suggested will be non-polar types. Just make sure the voltage rating is something like 25 V or higher.
The effectiveness of the capacitor will be the greatest when it is located as close to the RoboRio as possible. The ground/return end of the capacitor should also go to a ground pin on the RoboRio that is as close to the signal pin as possible.
Update: Plugged the SRX Mag Encoders into the digital input port on the roboRIO, changed the code to use the DutyCycleEncoder, and now it works great. Thanks for the help @Peter_Johnson, @Joe_Ross, and @bovlb.