A shaft encoder is a sensor.
It is attached to something like a wheel which goes around and around. Or the shaft of a motor which is, say, turning a solar panel to face towards the sun. Or the shaft the cups of an anemometer turn.
The sensor creates an electrical signal which can be read by, say, an Arduino, or Pi.
Some shaft encoders are really simple... just a normally-open switch. Each time the shaft rotates to a particular point, the switch closes. Reed switches or Hall effect switches are often used.
One pulse per revolution. And you can't tell which way the shaft is turning. Pretty crude.
From there, various enhancements are available. Most immediately obvious are the enhancements which improve resolution... more than one pulse per revolution.
There are also ways to make the sensor tell you which way the shaft is turning. The simplest require two signals from the sensor.
But all of the above don't really tell you where whatever is rotating has got to. They are relative position sensors. "Relative to where we were before, the shaft has turned xx degrees."
This is all we need for some jobs, but it isn't enough for all jobs.
Another sort of shaft encoder would suit the mechanism of a weather vane, a sensor for the wind direction.
This would have to tell you the absolute amount of rotation from some reference direction, e.g. north.
Such shaft encoders typically require more than one wire to carry the signal, if it is to be a digital signal. Of course, many years ago, such things were done, essentially, by attaching the vane to a potentiometer. The analog voltage was an indication of wind direction.
A middle ground, suitable for some projects, is to have the shaft turn to a "home" position when the device is started up, and then simple "how far" and "which direction" outputs can be integrated, to give you knowledge of where the shaft has got to, since start up.
Page tested for compliance with INDUSTRY (not MS-only) standards, using the free, publicly accessible validator at validator.w3.org
....... P a g e . . . E n d s .....