If you pull Vitruvs' wagon, the wheel, as you could imagine, rotates. A finger is mounted on one wheel. This finger rotates a gear (grey) on each turn. This gear should have 400 cleats. One of those cleats is extended. This extension rotates another gear (blue), which lies horizontal.
This horizontal gear is only rotated once per mile, because the big wheel rotates slowly.
There are about 25 holes in the horizontal gear. In it are small stones. When the wheel turns, one stone will fall into a pot.
If you want to count the miles you went on one day, you just have to count how many stones are in that pot. The number of stones equals the miles you went.