Using encoders to control accuracy

Hello, I'm pretty new to arduino and have a small problem my professor has me working on. We're building a robot that can test the PH of our acid buckets. However, we need it to stop pretty accurately. The problem comes from the fact that we're using continuous rotation servo's. We've ordered some encoders from Sparkfun.com. Now we're inexperienced with arduino and its code and are unsure about where to find the right code/libraries to use to make the servos more accurate with the encoders. Does anyone have any ideas where we could find something like that? Thank you for any help or advice.

What ones are you ordering as the resolution and interface varies between encoder makes and this makes a difference on how you read them. A bit more info on the project will also help. You say your using servos but what do they do?

I suspect that a continuous rotation servo is the wrong or poor final control element for your application if accuracy and precision is required. A stepper motor is probably a better choice.

Whoop! Sorry, guess I forgot to post the link to the product. We're using the wheel encoder kit from sparkfun.com ( https://www.sparkfun.com/products/12629 ) as they were the ones recommended to us by several different sites. The final product should be able to move, ,he locomotion is controlled by two continuous rotation servos, across a table we have already made. There are holes on either side of the center line where the buckets will be sitting underneath. The robot should be able to stop on between two holes, one on the left and one on the right. Two additional standard servos will be positioned so that they are above the holes and be able to lower a vernier ph sensor down into the buckets one at a time and record the ph using the "home" they plug into.

We didn't use stepper motors as we had thought that the servos would have been accurate enough not realizing that the potentiometer in servos are removed to make them continuous rotation, if I've read reliable information. But the option is still out there.

There are holes on either side of the center line where the buckets will be sitting underneath. The robot should be able to stop on between two holes, one on the left and one on the right. Two additional standard servos will be positioned so that they are above the holes and be able to lower a vernier ph sensor down into the buckets one at a time and record the ph using the "home" they plug into.

Not what you wanted to hear but the problem with your approach is if things becomes out of sync (wheel spin or general slippage over time) it all goes to pot. Maybe a better idea would be to use something like a line following sensor that sits under the robot to detect a dark/light mark painted on the center track where it needs to stop for the side ph holes.

It doesn't seem to me that your project requires the very fine accuracy that encoders (or stepper motors) are intended for.

Can you describe the project in terms of the distances that need to be moved and the acceptable variation in position accuracy. A diagram or photo of the device would help.

Have you considered sail winch servos which turn through about 3 revolutions and have position control? As their name suggests they are designed for controlling sails on model boats.

Another thought is to have a single position detector (optical or mechanical) which tells the Arduino when the device is in the correct location. I have used that successully with a continuous rotation servo.

Either of the latter two would be much easier to implement from the programming point of view compared to an encoder or a stepper motor, and would be mechanically simpler also (though I don't know if you have space or suitable conditions for installing detectors).

...R

more ways to do this:
put a slide potmeter on the side of the table, and have some camblocks to set the potmeter when the bucket is in position, ythe height of a block shows the position.
Make some sort of gray coding on the table, and turn the table until the code is correct. or use a encoder type (only 2 switches are needed. (was my first project with two microswitches)

Well, I just got new info from my professor. He just wants it to be able to stop at certain degree, and continue on in a straight line. As we’re going to be using them on another robot to use out in the field to find fossils. I’m not trying to be snippy, but is there any way of having them monitor speed on two motors and have them correct themselves to go in a straight line as well as get it to stop at a specific degree? Thanks for the info as well. It’s helping me learn quite a bit.

I'm not trying to be snippy, but is there any way of having them monitor speed on two motors and have them correct themselves to go in a straight line as well as get it to stop at a specific degree?

I still say that continuous rotation servos are poor choice when you wish to control identical speed for both the two different servos and also be able to stop at a specific position. You may be able to hack something together but it's going to be difficult as such servos are non-linear Vs speed commands and the overhead of reading the encoders will take their toll on your patience I suspect.

Toganora: Well, I just got new info from my professor. He just wants it to be able to stop at certain degree, and continue on in a straight line. As we're going to be using them on another robot to use out in the field to find fossils. I'm not trying to be snippy, but is there any way of having them monitor speed on two motors and have them correct themselves to go in a straight line as well as get it to stop at a specific degree? Thanks for the info as well. It's helping me learn quite a bit.

What has this got to do with moving a device between several pots to test acidity?

If you want something to move in a straight line just use one motor to drive the two wheels and use a third steering wheel for fine corrections. Technology that has been well proven for a few centuries. Why invest in complexity?

...R