Let's Make Robots!

How to determine how far has my bot turned?

Hi All

I wonder how you determine how far your robot has turned? I have a newly built catarpillar and find it turns a different amount depending on the surface (and of course obstacles).

How do you pro's determine how much your robot has turned?

I guess one could use some form of becons and triangulation or an onboard compass but are there any other methods you guys & gals use?


Comment viewing options

Select your preferred way to display the comments and click "Save settings" to activate your changes.

I mount my compass on a mast as high as possile.


I use them for robot soccer and the max height is 35 cm which is fine.

I made a compass bot which works great (as long as the cable doesnt wrap too many times around :) ).   it always points north.

the chip is accurate within 6 degrees.   most compass chips expect to flat and level, so on a rocking catepillar, you might have some challenges getting good readings.   my compass chip rotates within 3 - 4 inches of the main continuous rotation servo without intereference.   the only intereference suffered is from the greater outside world, or large metal objects like bridges or tunnels.

I used a weighted average to smooth out the noise in the signal.   give more weight to the previous reading and less weight to each new reading.

Hi People

I have found a cheap magnometer here http://www.technobotsonline.com/hmc5883-triple-axis-magnetometer.html

I wonder how this would be affected by the magnetic fields created by running motors/servos close by. Does anyone have any thoughts on that?


A magnometer or compass is probably the best way to manage turning if I know where the center of my gap is based on my servo and IR sensor readings...


You would want to keep the device as far from motors and power wires as possible. EMI falls off pretty quickly with distance. You could do some tests to see how much the deivice was effected while you ran the motors.

Some robots put a device like that on a mast to get it away from interference.

On my lego robots I use a Hitechnic Compass sensor and it works great.

Hey Screwdriver

How did you mount your compass? On a mast? If so, how high?


Considering that the tracks can slip encoders won't work. If your moving on a smooth floor then you can use 2x PS2 optical mouse sensors. Put one sensor at the front and one at the back. The PS2 serial mouse library makes it easy.

When the robot is going forward or backward you will get an accurate measurement of both speed and distance. When you turn, one mouse will travel left while the other travels right. If the robot slides sideways then this can also be measured.

For rough terrain you will need to add or change the lense being used to focus at a greater distance. I've had limited success using a cheap magnifying glass.


That is good advice! I´ll give it a try on my bot Deacon!

i have an optical sensor i salvaged from a dead mouse, that does not have a part number on it.
is there any way of finding out what the pinout is?

(i have a good DMM and a DSO nano if that helps)

come to think of it, i also have a still working identical mouse.

accelerometers and/or gyros?