VEX potentiometerThis is the second of a series of posts that examines each VEX sensor in turn. The aim of this series is to help teams that are new to using sensors have an idea of what is available and what they might like to use on their own robots.

And since this post has gotten kinda lengthy, here’s your Potentiometer Table o’ Contents: (a) installation, (b) mark your sensors before using, (c) test, test, test, (d) OMG I broke it, (e) how does it work? (f) uses


$13 for a 2-pack

We’ve come to love the potentiometer. Along with the 2 sensors mentioned in my previous post (bump switch and limit switch), this is one of VEX’s most reliable sensors, and it’s pretty durable to boot. This one, however, is not digital but rather analog—returning values from 0 to 4095 (RobotC) or 0 to 1023 (easyC).

This sensor is not for a chassis or other spinning motor. It is used on a component that has a rather small arc of motion, like a lifting arm. Why? Because this sensor can only turn about 250º.


robot with potentiometer

Renegade Robotics Starstruck robot; potentiometer can be seen in upper right corner, at the top of the forklift arm

The hole in the middle of the sensor is square, and you run the arm’s shaft through it. The small white inner part of the sensor is square and can rotate (hard to see until you’re holding one); the big red part is screwed onto the robot. My brain wanted to screw this thing onto the movement arm itself. Wrong! You screw this thing onto a part of your robot that does not move. Then when the arm lifts, its axle turns that inner white portion of the sensor to produce a reading.

This sensor, along with the optical shaft encoders (subject of my next post) require some advance planning in your robot design. They take up space. It’s difficult to slap one of these on after the fact; doing so usually involves taking the arm joint apart and changing all of your spacers, etc. to get it to fit. And maybe you have a tight spot, in which it will never fit. That’s why you have to include this sensor at the start of your design process.

If your arm is geared—the motor is turning at speed X and through gears makes the arm move at speed Y—be sure to install the potentiometer on the shaft that stays within that 250º arc. Do not install it on the shaft that is spinning more than one full revolution. If you do, the sensor’s “stops” at each end of the arc will break, but more importantly the data will be meaningless.

Mark Your Sensors Before Using

Before you even get this sensor on your robot, plug it into the cortex and do some testing using the online window (easyC) or the debugger window (RobotC). With the sensor plugged into the cortex (or a separate test bed):

  1. Insert a short shaft into the center hole
  2. Very gently, turn it all the way in one direction—say, clockwise—and then all the way the other way; now you know the sensor’s available range
  3. Turn it again all the way back to the end where your online/debugger window tells you the value is 0 (or whatever its lowest value is; may be above 0)
  4. Take a Sharpie marker and draw a straight line (spoke) coming out from the shaft to mark this end of the dial; be sure the line is on the red part and the inner white part
  5. On the red part, write “0” or “min” or something so you know which end gives you low values
  6. Now spin the sensor up to its maximum value; as you spin you should see your teeny Sharpie mark on the white part (from step #4) move too
  7. At the maximum value, extend that same Sharpie mark from the center and draw a new spoke, marked with “max” or something helpful

This will save you time and frustration if you do this at the start. You still run the risk of screwing it on backward (flipped around), but you’ll be several steps closer to the finish line if you’re not doing this blindly.

Test Test Test

A warning: Despite what VEX says in their documentation, the shaft does not “slide easily” into the sensor; you really have to shove it in. This stiffness increases the likelihood of inserting your square arm shaft in not-quite-the-right orientation of the sensor. Take your time and think through and visualize each step before you commit to it and screw everything back together.

Install it “just enough” at first; no need to tighten it completely or put lock nuts on yet. Using the online/debugger window, manually move your robot’s arm up & down to make sure that the sensor data is between 0 and 4095 (or 0 to 1023 for easyC users) at all times. If the sensor value does not move smoothly through the range—it stays at one number for a long time, or has a gigantic jump—then you’ve got it on the wrong way.

Your arm’s potentiometer values (POT, for short) don’t need to start at zero at the bottom of your robot’s arm movement. The only important thing is that the arm’s lowest position and highest position are both in the sensor’s range as listed above. When doing your testing, write down the minimum and maximum values for your robot’s arm movement and put them in your engineering notebook. Your programmers will need this information.

OMG I Broke It

Never fear. Every potentiometer in our lab is “broken”—that is, the inner dial can turn 360º, instead of having built-in “stops” at each end of its arc. It’s really, really easy in your testing and installation to break these stops by turning the axle too far or the wrong way. The stops are…how do you say…flimsy.

Never fear! If the stops are broken, it’s still totally usable! You just need to do the same testing you would have done anyway (above) and make sure that when it’s screwed onto your robot, your arm’s movements give acceptable, smoothly continuous numbers as you manually move the arm up & down. If you get a value of 0 the whole time or values that jump from 200 to 4000, then you know you’ve got it installed either backward or in the wrong part of the arc. Keep trying different orientations until  you see reasonable sensor data.

How Exactly Does It Work?

Inside of a potentiometer

Potentiometer inside; photo credit jpearman, VEX Forum

Inside the red casing is an adjustable resistor; turning the shaft changes the resistance, allowing varying amounts of voltage to get to the other end of the circuit. That amount of voltage is measured and converted by the cortex into a numerical value in the ranges listed above.

Here’s VEX’s documentation sheet with the technical specs.

I was highly amused by the photo at left. From the outside, it looks like the big red part of the potentiometer is the business end (it’s big!), but no, inside the big red part is empty air. The business end of things is actually pretty small, in the center, where you put the shaft through.


As described throughout this section, by far the most common use of a potentiometer is to mount it on a movement arm or manipulator in order to know or regulate the position of the arm, frequently for the 15-second autonomous period. But wait! There’s more!

  • Potentiometers are not just for use in autonomous! They are certainly useful in that capacity, but they are often used in joystick mode as well. 
    • On our Starstruck robot, we used POT readings to disable the joystick if the forklift was at its highest point to prevent gear-grinding and -breaking; when it got to the top, our program checked to see if the user was still pressing the joystick in the upward direction; if so, then set motors to 0. If the user was moving the joystick back down from the max, let the joystick operate as usual.
    • Often in driver-control mode, one picks up a game object and moves it somewhere. Knowing the potentiometer’s range of values allows for programming one or more joystick “hold” buttons. When a given button is pressed, the program uses a PID algorithm (a topic for another post), to keep the arm at the requested hight, providing variable- and just-enough-power to keep the arm in place. Multiple buttons can be programmed for various heights if that’s needed for your robot. To get out of the hold-loop, one could either program a “release” button, or have the joystick lever serve as a break/override.
  • Potentiometer used as an autonomous code selector. Photo credit: RoboDesigners, VEX Forum

    Potentiometers are also used in not-autonomous and not-driver-control. Huh? What’s left? The “initialize” (easyC) or “pre-autonomous” (RobotC) portion of your competition code! Some clever teams use POTs as an autonomous routine selector instead of an LCD screen. In this case the POT is not connected to a movement arm, but rather serves as a knob, with pre-set markings on it. Before the match starts, the knob is turned according to these pre-set markings; if the POT is between values A and B, auton-pattern-1 is run; if it’s between B and C, auton-pattern-2 is run, and so on.

    • Some *really* clever teams use two POTs to select various different features of autonomous (pattern and starting location, for example). LED jumper pegs are placed in cortex digital ports to signal/verify what’s been chosen. It gets complicated, but it’s doable! (The alternative is to get a $50 LCD screen, which may not be feasible for all teams.)
    • [Edit Oct. 17, 2017] Here’s a VEX Forum post with sample code on how to do this POT-as-auton-selector; clear & readable. [Edit Feb. 2, 2018] Here’s another Forum post with sample code (3rd comment after the original post).
    • For more discussion & examples, do a google search on something like VEX Forum + potentiometer + autonomous; there are many discussion threads where people describe their different ways of accomplishing this task. (The search box IN the VEX Forum seems to be not very helpful; I recommend doing all searches starting from google.)

Additional Posts on VEX Sensors