Say you have a 4 or 6 bar linkage, and you would like to include a sensor to govern the rotation. It seems a pot and an encoder do more or less the same thing?
An encoder can track multiple rotations while a potentiometer is limited to a range of like 180 degrees.
So an encoder wouldn’t track an arm very well but it could track the motor powering the arm extremely well.
A pot could be directly attached to an arm and track it easily.
Encoders are also limited as they track based off of starting position. If your arm is up when you turn the robot on the robot will think it is down while a pot will not have this issue.
Depending on your robot, don’t rule out using a limit switch aswell. It can make your life much easier, for instance in sack attack, my lift had only two positions, ground and trough, so the programming was very simple and easy to maintain, “if(SensorValue[lift]==1) //Do something”
If you are choosing between encoder and potentiometer , they have tradeoffs like tabor said. A pot will give you the same readings every time you run your robot, but will likely need to update your code a lot as you modify your robot, while an encoder will always start from 0, you need to make sure you have your lift down at a consistent height every time to run it.
To clarify, the potentiometer has absolute rotational position sensing from ~0-270 degrees. It gives an analog signal, so on a Cortex, this is a number from 0-4095 mapping 0-270 degrees. This is a much better precision than an encoder, which is only 90 ticks per revolution, even if it’s geared up.
The encoder also operates via interrupt ports, which means that for every tick, it’s “interrupting” the Cortex for a split-millisecond. So don’t gear it up too fast, or the program will lock up because there’s too many ticks to count. The potentiometer is always giving a value, but you can poll it whenever you want.
Just a slight correction, on PIC its 90 ticks per revolution, on Cortex it is 360 ticks per revolution for an encoder.
As Totally Generic Name said, the pot is limited from 0 to 270 degrees, although you may want to consider not using the first 30 degrees I believe, based on some findings from jpearman (I think it was jpearman).
The pot has the advantage that it doesn’t need resetting for the lowest point, plus it is smaller than a quad encoder, or you could use an IME.
don’t rule out using a limit switch and a potentiometer or an encoder. That way you can have the zero value for the encoder or potentiometer reset every time that the lift comes down or goes up. This can greatly increase reliability.
Encoders go round and round, pots go like one turn (ish).
Encoders take two interrupt inputs, pots take one analog.
Encoders go on wheels, pots are better for arms and joints with limited travel that fits within the range of the pot.
Encoders work with two inferred light sensors positioned out of phase of each other. They track ticks on a wheel which spins with the shaft. One can give you the number of ticks, two can both the number and direction. It is possible to use only one of light sensor if you already know the direction of travel but it will limit the resolution of the sensor. IE, half the ticks. Again this is only if you know what your doing and want to get all fancy.
Pots work using a different method. They are essentially a variable resistor, which is able to govern the amount of voltage that passes through the element depending on it’s position.
As the element turns a blade of sorts moves along a resistive path increasing or decreasing the distance between the two contacts. This in turn lowers or raises the voltage which an analog to digital circuit can turn into 1’s and 0’s. The Cortex has ports that can do this. This blade has a limited travel which is why pots only go so far.
For a joint, pots offer an advantage. When an encoder starts up it’s position is assumed to be 0 (encoders only count, they have no notion of state). This is bad, imagine if your arm is in a mid position when the robot turns on, now that is assumed to be 0 when say it’s really half way up. Bad.
Whereas a pots position depends directly on where they are positioned which is maintained between power cycles. This is good for an arm. Just keep in mind that pots are NOT the solution for wheels which spin over and over (it can break the pot and will not give you the reading you want).
The one downside to using a pot on an arm is that they are not perfect. You will need to calibrate them to compensate for differences when changing out a pot or using two together.
This usually just invokes recording their min and max values on the joint in question.
Hope this helps. -Cody