An
encoder is a
sensor on, say a
motor (also known as a
shaft encoder) that
allows the
position and/or
velocity to be sensed. A form of
feedback.
An encoder is essential if you want to control a motor. In the control theory sense.
They work in a variety of different ways, some sensing
tiny magnets spinning by with Hall Effect sensors, some detecting slots in a disc as they pass through a break-beam sensor (an infrared emitter and detector on opposite sides of a channel), some just simple, cheap, and inaccurate potentiometers.
But how do you tell direction? Well that's beyond the scope of this course, but you'd need something like a quadrature encoder.