Speed of a dc motor

If it's an incremental optical encoder on the motor then essentially all you need to do is count the pulses from it over a known time period. It's been done many time before.

Steve