Which sensor for turning?


I wouldl like to have my robot turun a specific amount of degrees. I tried using the encoders of my crawler. But the slip seems to be too high. The angle at which the robot arrives varied too much. I tries using the magnetic compass of the android phone which I use as bluetooth internet bridge. But the DC motors confuse the compass too much.

I now wonder which sensor to use for mesuring the turning angle.

My wish list (where possible): - no serial communication - not too expensive - interrupt pins are in use by the encoders

What is the experience on this?

Thanks Robert

I don't think it would be possible to turn exactly 3 degree even you have the best sensor on the market, as there is a triction between a flour and wheels, which is impossible to control. Have you think about "visual" navigation? It could be simple as "solar tracker", and you just set a lamp where robot has to arrive to.

Yaw gyro for short-term, low-pass-filtered compass to correct for drift (yes you can't place the compass anywhere near the motors - on top of a stick?) Compass is sensitive to nearby ferrous metal objects, so outdoors it will perform better.

A fun, but possibly mad and doomed to failure approach would be to mount a distance sensor on a servo and have the robot scan for some notable feature in the environment, either something closer or further than the general environment which could be used as a marker, then have the robot rotate until the marker is detected Y degrees away from its original point.

An even more fun extension of this would be to try a few different senses, so if the robot cannot find a suitable physical object to act as a marker, fall back on light or darkness as a marker.

Lots of limitations - it depends on the marker not moving during the rotation, but is a pretty good approximation of how nature does things.

Above all this is a fun and challenging approach - encoders just aren't that interesting.

Just a suggestion

Duane B


Thanks for all the replies. I was afraid that it would not be as easy as "use sensor x". DuaneB, your suggestion is interesting as I have servo mounted range sensors on the robot already. But it indeed varies in the environment if it works or not.

The "lamp approach" indeed would work but is too static for my purpose. I have a robot roaming indoor and outdoor.

Has someone realized a working solution with a compass or a gyro?


Out of interest why do you want to turn a specific amount anyway ? surely its better just to turn whatever amount is required until the path is suitably clear ?

Duane B


What I do is to submit a picture of ultrasonic and IR data to a webpage. You can then click on the picture. the robot goes straight to the point you clicked at. (turn than go forward) But the turn part is way to unaccurate when using the encoders. For forward distans and driving straight it works great.


Sounds like you already have your answer somewhere between the lines of your last reply ;-)

Duane B

Yea. When I use your sugestion of utilizing the distance sensors. As you stated that's not going to be easy :-) especially indoors with short and similar distances.

Didn't think that getting the correct direction / turn angle would be such an issue in the robotics field :-) Well, as usual it is most likely solvable with putting enough money in. But where would then the fun be in? (and where would the money come from? :-) )