Today we had a demonstration of a speed wagon running on the OO DCC layout. The wagon can be run on either DC or DCC. It will measure the speed of the train and give a value in either miles per hour or kilometres per hour.
The scale can also be selected to be either OO or HO, if you wish you can change the function to measure the distance travelled rather than the current speed.
It works by having a small magnet that is attached to one of the axles and a sensor that records each pass of the magnet, there is an onboard processor which converts the number of revolutions into the speed or distance.