Arduino precise timing question

I have a robot that has to turn by an exact angle. After thinking for a long time I came to an ugly solution of getting two continuous rotation servos turn the two bearing wheels in opposite direction for a particular time. I timed something like twenty full rotations and made the robot calculate the time needed for turning n degrees. However, there is some time needed to connect the servos and for them to start turning, so after about 10-20-30 robot turns the mistake runs up quite high.
Does anyone have any ideas of how to calculate the 'speeding up' constant I have to add to every turn time? Quite anything is appreciated, I've been thinking for two months (but not quite intensively:)). 

sort by: active | newest | oldest
maewert5 years ago
They all provide good advise but I would suggest you consider how the errors accumulate. Your robot is 'dead reconing', i.e. determining its position based on changes in distance and direction. Even extremely small errors accumulate into large errors very quickly. To put a slotted disk on a shaft and read +/- 1 degree, the disk will need 360 slots which is not easy to do on small disks. If you want precision positioning after 30 turns you'll need probably 100 times this resolution. If you are using a gear train then you can place your slotted disk on the gear that turns the fastest. You still have to consider gear slop.
You may need to augment your approach with sensors that updates your position periodically and use dead reconing between the sensor position updates.
Best Wishes
No, you either need only 180 slots, or 2 rows of 90.
kelseymh5 years ago
Steve and Rick are right -- use a slotted disk with a photodiode/detector pair, and count the revolutions. That way, you don't have to know anything about the speed of rotation, varying speeds, or whatever. All you need to know is how many times the axle has turned.
rickharris5 years ago
For true precision you really need to use stepper motors and count the steps.

As a fudge you could put a slotted disc on the wheels and count the slots.

Even then this doesn't allow for wheel slip.

GPS is perhaps the only real solution and then perhaps not accurate enough.
gruffalo child (author)  rickharris5 years ago
I knew about steppers, but I didn't have them at the correct moment, and servos are quite expensive, so I don't want to discard them:). I was very worried about wheel slip, but actually never noticed it...
Use a slotted disk, and you're good to go.