[Nophead's_Extruder_Tweaks#Shaft encoder|Nophead's_Extruder_Tweaks#Shaft encoder] has some description and links about a rotary encoder.