Potentiometer, need help with programming

On our robot for the FRC Competition we have a axle on our grab arm. We’d like to wire a potentiometer to it so that we can control the voltage that goes in and out of it depending on which side it goes to. (Up or down, I guess). And we’d also like to know how we could get the input from that potentiometer and translate it to a program in LabView, whether manually or otherwise. We’re not sure if that was explained correctly or in a way that makes sense. The team isn’t exactly sure how to do this in any way. We’d like to stop the grab arm from going back down after we bring it up, we want it to lower manually but have it stop and lock automatically after we raise it.
-Team 4641

You’re better off using an encoder. You can mount an encoder to the shaft which will tell you, basically, the angle at which your arm is at.

You’re definitely better using a potentiometer.

An encoder (most FRC ‘encoders’ are quadrature incremental encoders) tells you how far you have gone since your zero point.

A potentiometer tells you exactly where you are, but when you exceed the limits it will break.

There are also ‘absolute encoders’ which work just like a potentiometer, but roll over to the other end of their range when they hit their limits.

In any case, in LabVIEW, use an ‘AnalogChannel’ to measure the voltage of the potentiometer. Connect the pot’s ends to the black and red wires (+5v and Gnd), and the wiper to the white wire (Signal). The voltage in on the analog module will be between 0 and 5v.

Once you have the position, you can scale it from volts to degrees, or whatever units you want, or leave it in volts. From there, you can run a control loop (search here for ‘PID control’) for your position control.

Have you looked at the potentiometer example in the NI FRC examples?

I agree, a potentiometer is a much better choice for an arm then an encoder.

Agreed. A pot is the sensor to use in this application.

One note: Before you connect up your pot, use an ohmmeter and check the resistance range from the wiper (center) to one of the two outer pins across the entire range of motion. We have had problems in the past with people installing pots with 270 degrees of motion but only 60 degrees of resistance change. As soon as we replaced these joystick pots with normal ones (270 degrees of motion and 270 degrees of resistance change), a lot of things worked so much better.