Rotary Motion sensor

I’m looking to make a rotary motion sensor unit to determine the velocity of a test subject. The companies that make/sell these are more expensive than I want to buy. This is an example of one: https://www.vernier.com/product/rotary-motion-sensor/
Any ideas on how to build something like this?