Pololu Robotics & Electronics
My account Comments or questions? About Pololu Contact Ordering information Distributors

Pololu Forum

Measuring distance traveled on wheeled vehicle

Hello all.
I am building a wheeled RC controlled inspection camera.
One problem I need to solve is how to measure distance traveled in a straight line (counting meters forward and subtracting meters in reverse)?
The second problem is how do I get this measurement in meters on a monitor?
I have a push camera system which does this quite easily. I am finding it much more difficult on a RC vehicle.
Any suggestions would be much appreciated.



If you are using encoders, you can count the transitions to determine how far the motor has turned. You can divide the number of ticks you have counted by the CPR (counts per revolution) of your encoder. Also, keep in mind that many motors have the encoder attached directly to the motor shaft, so if your motor has a gearbox, you will also need to factor in the gear ratio. In that case, the number of ticks that make 1 revolution of the output shaft would be equal to the CPR of your encoder multiplied by the gear ratio. Since that gives you how many revolutions your motor’s output shaft has turned, you can then determine the distance your robot has traveled by multiplying by the circumference of your wheels.

For example, if you want your robot to travel 10m, using an 80mm diameter wheel, a 30:1 gearmotor, and a 12 CPR quadrature encoder, your equation to determine how many ticks it would take should look like this:

Distance traveled = (ticks ÷ (CPR × gear ratio)) × circumference of wheel


10m = 10000mm = (ticks ÷ (12 × 30)) × 80 × π

There are many ways to go about displaying this type of information. If you can post more details about your system and the components you are using, I might have some suggestions.


Thanks for your reply, I appreciate your input.
To operate the motors I am using the Pololu simple motor controller board.18V7.
I have a mini Maestro servo controller to operate the P&T.
Video is over a 900 mhz transmitter/receiver and my controller for the whole system is a Taranis X9D plus.
Video will be viewed on my laptop for recording and overlay.
I was looking at an OSD PCB to display the meter count but the ones I looked at were all pre-programmed with
a lot of display data that I don’t want.
Hopefully this explains a bit more for you.



While the Simple Motor Controller cannot accept encoder signals directly, you might consider adding a separate microcontroller (such as an Arduino) to read the encoders and keep track of how far your camera vehicle has traveled. It is not clear if you just want the distance information displayed or feed it back into the system (e.g. have the motor cut off once it reaches a certain distance). If you just want to display it, as I mentioned, there are many ways to go about this. For example, the microcontroller could print the distance to an LCD or be paired with a wireless device to send the data back to your laptop to be displayed. If you wanted to use the distance information to feedback into your system, you might consider configuring the SMC for a limit switch and having the microcontroller send a signal to trigger the switch when a certain distance is reached.

Alternatively, you could use the separate microcontroller to process your RC signals and the encoder signals and set up your own control algorithm to do some kind of closed-loop position control and send TTL serial signals to the Simple Motor Controller to drive the motor.


All I am looking for is a meter counter from point A to point B, distance increase as a go forward and reverse if I have to go backwards. On my laptop I would like to see a reading of XXmeters traveled. A reset would be required to start another measurement section. If pipe section one is twenty meters and pipe section two is 30 meters I would like to be able to show a meter count to 20 meters, reset and start at zero befor starting the 30 meter section. Ideally on the video screen. If not an LCD readout in the truck would suffice. I don’t need kill switches or the vehicle to automatically stop at any point. All movement will be manually driven.


We do not carry any ready made modules for reading the encoder signals and displaying some distance value, and I do not have any specific recommendations for one. However, as I mentioned in my previous post, you could probably make something like that with a separate microcontroller like an Arduino. If you pair it with an additional wireless device, you should be able to program it to send the information back to your PC to be displayed and have the zeroing feature like you described.


Iam searching for a technique or a methd to calculate the distance travelled by the robot wheels, i used the ig32 motor with encoder, the encoder gives the output in CPR and we have gear ratio as well. But we are lagging in how to get ticks value without using the distance parameter because i want to calculate the distance travelled by the wheels to know its position from the reference point.
Could you please help me out in finding the ticks, if there are any suggestions , let me know.


You can use the counts from your encoder and the gear ratio of your gearbox to determine how much the output shaft of your motor has turned. Then you can use the circumference of your wheel to determine how far the robot’s wheel traveled per rotation.

For example, let’s say you are using a 64 CPR encoder with a 100:1 gearmotor and a 4in diameter wheel. You can calculate that your encoder will give you 6400 counts per revolution of the output shaft by multiplying the CPR by the gear ratio. Then, you can calculate the circumference of your wheel using the diameter, which is 2π×4 or 8π (~25.1327) for this example. This means your robot will travel ~25.1327 inches for every 6400 counts of your encoder. In other words, for every count of your encoder, your robot’s wheel travels ~0.0039 inches.