Encoder question

Use a reflectance sensor to easily discriminate between the black and white portion of the shaft.

There are various other types that work over a range of distances, but they are much slower to respond than the one linked above.