VEX Pontentiometers

Has anyone ever used a vex potentiometer to raise/lower an arm to different heights? If so, how did it work? Please include any other thoughts on it.

I haven’t tried them with an arm yet, but I am planning on doing the same thing. I am working on a robot for Elavation with an arm on it.

I did write a program to test them out though and I know that you can’t make a motor stop when a potentiometer exactly reaches a certain value. I had to program the motor to stop when the potentiometer was greater or less than a certain value depending on which way the motor was going.

I hope this helps,

Do you mean you want to use the pot as a control so you can easily set an upper limit by (manually) turning the pot? Or do you want to use it as a sensor in a feedback mechanism, where it directly reads the arm’s position?

I’ve used it both ways with great success. As a control, I’ve used it to set the black/white threshold setting for the line sensor kit. As a sensor, I’ve used it in a force gauge. I was able to translate the force being applied on the robot’s bumper to an approximate force.

As a control, it is excellent. It holds its setting well and provides a fairly stable signal. It doesn’t add much weight or size to the bot, and is easy to mount just about anywhere.

As a sensor, it has fairly high friction, which has two implications: 1st, it will rob some of the power from the mechanism being driven. 2nd, the friction will cause hysteresis, which means the reading will vary slightly depending on which direction the arm is moving. For example, a reading of 123 will represent a slightly different position on the upstroke than the downstroke.

As for programming a feedback loop, you will need to watch out for oscillations. These will occur because there is a delay between when you tell the motor to move and when the potentiometer reads the final position. The more hysteresis the system has, the harder it will be to avoid oscillations. Take a look at some material on PID control loops. It seems fairly intimidating at first, but the concepts are not that complex.

Hope this helps,

  • Dean

At the moment we’re using a potentiometer to limit the movement of our arm and measure its height(s) for our autonomous mode(s). It sure beats 2 limit switches, and works great. I imagine that it wouldn’t be too hard to make use is make an arm go to a certain height but you do have to wait factor in inertia as the motors will not stop at the exact spot that your potentiometer reads a certain value.

Arm positioning is what pots are best at. Two thumbs up.

Hello,

Yes I’ve used the pot on arms and claws. It works just like you would expect it to work.

Picture: https://vexforum.com/gallery/showimage.php?i=1666&catid=searchresults&searchid=211536

There is a always some hysteresis in any pot being used that way. So before you try to position the arm to a particular measured height, start it from a good distance away from where you want it to end. It should not be difficult but you will probably have to experiment a bit before you get it to work with reasonable consistency. More overall motion should result in more accurate positioning. Hope that makes sense.

Another option might be to have the arm’s motor slow down as the pot’s reading gets closer to the desired measurement, and then use a limit switch to determine the final position to stop.

The VEX pots work great. In fact if they ever get the gyro released I’m going to order that and pick up a couple more pots too.

Regards,
KHall

Thanks guys, this will really help me out.

This is really good advice that can save a huge amount of testing time. The DiscoBots 2587 also used pots to control arm position. http://picasaweb.google.com/texasrobotics/VEXRobotics#5272072649035125042

Just got our pots in the mail today. We are very happy with how they work.

Hey folks,

After a fruitless search for the answer to my question, I’m being lazy and asking it here before building something to give me an empirical answer or studying the microcontroller’s circuitry.

Can anyone out there confirm (not guess or assume) that the analog voltage that comes out of a Vex Pot (when the pot is in a given position) is independent of the Vex Bot’s battery’s output voltage?

I am assuming that the pot is energized by an approximately 5 Volt signal from the Microcontroller, and that the microcontroller’s circuitry keeps that voltage very nearly constant no matter what the battery voltage is (so long as the battery voltage is a bit higher than the voltage the microcontroller sends to the Pot).

Blake

Yes, you are correct as long as the vex battery stays above about six volts the output should be five volts.

Empirically, the pot readings have been dead consistent for us regardless of battery health.

For what it’s worth, our programming standard is to NOT assume that the pot hasn’t been banged around since it was last used. If you always start your computer with the mechanism in the same state you can use this pseudo code to account for small changes in orientation.

Wrong way to program the pot:

Start main loop
REM want to set arm to pot level for “up”
While pot_value < 425
Set arm_motor = 50
end while
end main loop

The way we would do it:

Initialize starting conditions at power-up
Pot_initial_value = read pot sensor value

start main loop
REM want to set arm value to “up” which is 200 pot units above starting position

While pot_sensor_value < (pot_initial_value + 200)
set arm_motor = 50
end while

end main loop

Of course, we would usually set constants for some of these (like ARM_START and ARM_HIGH), but I think this gives the idea of using a relative value rather than an absolute value for pot values.

To elaborate on this answer a bit. The potentiometer forms a variable voltage divider between the GND and +5VDC supply coming from the VEX microcontroller.

As long as the battery provides enough voltage for the 5V supply to stay stable, the readings should not vary. I’ve observed that the analog reading sometimes drift up a few ticks right before the microcontroller shuts down due to low battery. It is also possible that a heavyish load on the 5V supply (like a relay) could cause some spikes in the reading when you turn the load on or off. I don’t think any VEX sensors would ever present such a load, though.

Variations in components mean that the same potentiometer plugged into different microcontrollers (or even different ports on the same micro) may provide slightly different readings. Different pots rotated to the exact same angle may also provide slightly different readings.

Also, temperature may effect the analog voltage, but I have no idea if the effect would be enough to cause the reading to vary by even a single count.

If you need the potentiometer reading to be exact, I recommend that you re-calibrate after you change the potentiometer, the microcontroller, or the way the two are connected. Ideally, re-calibrate in a similar thermal environment to the one in which the robot must operate.

Probably much more than needed to be said on the subject, but there you go :smiley:

  • Dean

Can a Vex Potentiometer be connected to the Vex RC Controller as an external motion input device? If so, does it need a capacitor (value) to work the same way as the four internal potentiometers? Has anyone tried this experiment with the RC Controller and gotten it to work?

Hmm, you mean to replace the potentiometer on one joystick axis with a VEX Potentiometer? It would probably work, though you might have to tune it a bit with external resistors to get the range of motion and ramp just right. I’m trying to picture how this would be useful, though. What do you have in mind?

I haven’t seen anybody do much hacking on the VRC remote, though I am planning to open one up pretty soon to see about changing the carrier frequency to 27MHz. I’ll measure the pots when I have it open to see if there is a chance…

Cheers,

  • Dean

I’d be willing to bet you could hack the transmitter to replace the back switches with a potentiometer.

I would like to connect other resistive motion input devices to the Vex RC remote and have them function just like the two joysticks. In fact I would also like to have the switches and joysticks be switched between internal and external devices using pin headers, but I don’t know how to make it work.

For example connecting a game steering wheel to it so that I can tele-operate a robot platform from a distance using the Vex RC remote, receiver and controller.

I just poked around a bit inside a VEX RC controller (the big remote from the “Red” line, not the 27MHz VEX “Blue” one).

The good news is that the transmitter looks very hackable. The Joysticks and Back buttons are all connected to the logic board via individual wires. You can take over any channel without having to cut any PCB traces or do fine soldering. Any such mod you make should be 100% reversible.

There is not a lot of extra room, but I think you could fit in a small board and/or external connector.

The joystick potentiometers are 5K linear taper pots. Because the pots can’t rotate fully, their resistance range seems to be from about 700Ω to about 4.3KΩ. (On my Mac running Safari, “Ω” shows up as the ohms symbol - not sure if it looks right on other browsers.)

If you just want to hook up a different potentiometer (like a steering wheel), that should be pretty straightforward. You just wire the three pins of the new pot to the wires that go to an existing joystick channel. You just have to make sure to unwire (or switch) the center pin on the internal joystick channel so that it won’t interfere with your external sensor.

I suspect any resistive sensor that can be configured into a voltage divider can be made to drive a transmitter channel. If you have a sensor that only provides a single resistance output (like a typical CdS photocell, pressure pad, or thermister) then you will need to add a 2nd resister that is somewhere near the median value of the sensor. You wire this resistor to your sensor in a voltage divider configuration. Note that since one of your resistors is a fixed value, you won’t get a clean linear reading on this sensor - you’ll need to do some math on the readings to translate them into a useful value.

As for how to switch between the internal and an external controls, you’ll need one SPDT switch per analog channel. You could use an analog selector like the MAX4533 if you wanted to switch all the channels without a bulky 4PDT switch. You could even have this selector switch to the external controls whenever the external cable is plugged in.

The back buttons appear to be the standard “grounded when pressed” type microcontroller signals. To add external controls for those, just wire an external switch in parallel to a back button. The channel will operate when either the internal or external control is pressed.

Now, I know you know your way around a microcontroller, so another option for you would be to drive the radio board directly from a microcontroller. The transmitter board is pretty small (about 2" x 4") and only has a few connections: Power, Ground, Signal, Antenna, and one wire called “Mod” that I need to sort out (Modulator enable?).

The signal is a timed pulse train that is easy to generate from any MCU that can toggle a pin when a timer fires. I believe you could drive this thing from any standard MCU (or even from a VEX microcontroller) and have full control of all 6 channels. This would pretty much take the form of a “tether in” connector that would connect to your external MCU and would transmit the pulse train your MCU generates.

Lots of interesting opportunities here, though personally I’m waiting for the WiFi controllers to come out, since that should make it possible to do nearly all of this in software.

Cheers,

  • Dean

That was my guess too, but some experimentation says otherwise. All four buttons appear to be the standard “grounded while pressed” type microcontroller signals. I think they feed directly into an MCU that just assigns the channel a value of 0/127/255 depending on which button(s) are pressed.

Cheers,

  • Dean