Our team has enough depth in terms of mentors and students that we’d like to add some sensors to our robot. Since we’ve literally never added a single sensor to any of our robots, I was wondering if we could solicit some advice.
Our specific application: We have an arm that wants to rotate back and forth through a 90-degree turn. The arm is connected to a window motor. What manner of sensor should we use? I’m assuming some type of rotary encoder?
For an arm application, I think potentiometers are a better choice then a typical rotary encoder.
They are easier to interface and debug (3 wires to a analog port that you can test with a multi-meter, vs 4 wires to 2 digital inputs that you need to test with an oscilloscope)
They provide absolute angle (typical rotary encoders only give relative position, which is a problem if you start with the arm in an different location)
They are significantly cheaper ($4 at radioshack or $10-15 for a high quality pot from digikey, vs $40 or more for a rotary encoder)
They are available locally
In my experience, they are much more robust then encoders
The main disadvantages of potentiometers are that they are noisy and have less resolution then encoders have never been an issue for us when used on an arm.
Whatever sensor you chose to use, put some thought into how you will test your system. Think about what happens if your sensor is not set up correctly or the software does not read the sensor correctly. Will the mechanical system get damaged?
For example, you may want to disconnect the motor from the arm, command the arm to move one way, move the arm manually and verify that the software stops the motor with the arm at the correct angle.
Be sure to allow for the momentum of the mechanical system and the reaction time of the system so that you are not trying to sense the position just as the arm is hitting a hard stop. If you do that, the motor may try to drive the arm past the hard stop.
If you then go to the manufacturer’s spec sheet for those, you can see all of the options they offer, and work backwards from the manufacturer’s part number if there’s a different configuration you want.
The part that Joe linked to is a good quality part and should work just fine for you. It would normally be found in high quality industrial or military grade equipment unlike the consumer grade parts found at Radio Shack.
You want to use something in the range of 2kOhm to 20kOhm. The industrial equipment I design (similar to the CRio) is frequently connected to 10kOhm potentiometers. In most robotics applications, you will want to use a “linear” potentiometer with a 1/4 diameter shaft.
The shafts are typically made from aluminum and are easy to cut if too long. Just clamp the end of the shaft in a bench vice and cut it with a hacksaw. Mount it by drilling a hole that fits the threaded part of the body. Mark the location of the anti-rotation device that sticks out from the body. Drill a second hole that is large just enough to accomodate the anti-rotation device. Make sure you use the washers and lock washers under the nut.
The coupling to your arm does not need to be very substantial since it should take very little force to turn the potentiometer shaft. We used a piece of surgical tubing forced over the shaft then pushed into the shaft (1/2 inch OD tube, 3/8 inch ID) of the dumper my son built.
Make sure that the potentiometer still has travel beyond the two ends of the 90 travel that you want. Lastly, do not use the potentiometer as the “hard stop” that prevents the arm from travelling beyond a certain point or you will break the potentiometer.