I would like to mechanically measure the distance a kids electric ATV traveled. The ATV will not be used with kids but as a mobile robot instead. It has a common rear axle for both rear wheels which I think could be a good place to put an odometer on (since the chance both wheels will slip should be minimal). Regarding suspension it has a single shock for rear axle.
My plan is to put a bigger gear on the axle itself and then add a smaller gear to it on which some kind of sensor would measure number of its rotations. One rotation of the axle may be something like 20 rotations of the small gear. What kind of sensor can I use for sensing rotation?
Another way of making an odometer may be some kind of optical solution (disc with holes and an optical sensor) but this seems to be rather complicated and also the the direction of travel could not be easily estimated (unless the motor is running in some direction).
I just found a term called Wheel Speed Sensor which looks interesting and seems to employ primarily non-contact sensing (which is definitely better than mechanical gears). Rather then optical solution I like the Hall effect sensor solution which may be simple and mechanically robust. But still, my question is open on how to implement this...
I would like to use the odometer for both speed estimation and distance estimation. I need to read the sensor from C/C++ on a Linux box.
EDIT: The thing I am looking for is probably correctly called a rotary encoder or a wheel encoder.
The ATV may look like one of these: