This is probably not news to many of you, but here is my random tip of the day:
**Use a potentiometer to configure your bot so you don’t have to run back to the programmer to tweak your constants.
I just finished helping a team build a line tracker bot, and rather than settle on a specific threshold for light-vs-dark, we plugged in a potentiometer and used that to set the threshold.
That worked so well (326 was our magic number) that we decided to use one to set the top speed too.
Once you have your bot performing just the way you want, you can read the values back using the On-Line Window and then hard-code them into your program. Or, you can just leave the pots on the final bot for on-the-fly adjustments.
It is briefly described in the pdf included with the Vex Sensor Test at the bottom of this page.
It is pretty easy, though: Start with a linear-taper potentiometer in the 10K to 100K range like this one.
The potentiometer has three terminals. The center terminal (wiper) gets the white wire (analog signal). The outer two terminals are wired to the red (VCC) and black (GND) wires. Generally black goes on the left and red goes on the right, but it doesn’t really matter.
As you turn the potentiometer clockwise, the analog values will either go up or down, depending on which way around you wired the red and black wires. If you want it to go the other way, just swap the red and black wires.
If you notice that the values change a lot near one end of the potentiometer’s travel, and the numbers change very little at the other end, then you probably have an audio-taper potentiometer. It will still work, but the numbers don’t change linearly with the rotation angle.
I wonder if we could get enough auto modes out of one pot… we might need two. Anyone know how many settings you can pack on to a potentiometer without the danger of running the wrong code because the settings are to close to each other?
You get over 1000 values from the A/D conversion, but vibration and thermal drift will probably make it only possible to distinguish between every 4th value or so. That’ll leave about 250 possible settings. Of course, you aren’t going to dial in anything that fine unless you’ve got a feedback mechanism like an LCD display to know what number you are on.
You could probably make an 11-way selector by mounting this kind of knob on the potentiometer:
Just read the analog value for each position and make a table. When checking the setting at run-time, just figure out which table value is closest to the one being read from the analog port, and there is your setting.
If you really wanted to push it, you could probably read the “half-way” points between each setting, getting 21 possible settings.
Oh, and you may have to create a unique table for each pot; i suspect there will be enough variance between pots to cause misreads if you try to discriminate too fine of an angle.
You don’t have to leave the knob on the robot during a competition. The knob mounted on the shaft becomes a “tool” that you use to adjust the robot. You (carefully) pull the axle out of the potentiometer. Or, you leave the axle in and just remove the knob. Since the axle has 4 flat sides, it’ll self-align when you tighten it’s set screw.
Hmmm - I wonder if a Vex Gear with a screw through one or more of its holes would make a useful knob that I didn’t have to remove before the start of each match? And how might I use gears to give me a high resolution confirmation that the angle I set my knob to is aligned correctly within one of the angular zones my program expects to detect it in?