Planning to make a pen-like device which has a roller rolling on a surface and measured its linear distance travelled
If you're still working on this, this sounds like the perfect case to use the optical sensor in a mouse.  You can take apart a mouse you have laying around or buy the sensor separately.  Here's a link to one such sensor though there are many more out there: https://www.sparkfun.com/products/12907  Key specs are running at 5V and 400 cm per inch resolution.