Andrew- Ive been playing with optical mouse technology for that very reason. It was useless at 20mph, but certainly for ants it would do fine. A small wheel with an odometer seems to be the best option.