Small potentiometer range to give full 0-5V?

Ok, how about using a rotory shaft encoder and just counting pulses.