Why an Encoder Counts Two Ways

A stream of pulses can say that a shaft moved without saying which way it went. Two offset signals turn the order of their changes into a direction.

An industrial rotary incremental encoder mounted around a shaft
In this story 5 sections

Through the middle of the device in Lambtron’s photograph is a metal shaft. The body surrounding it is small enough to mistake for a mounting bracket. A plug at one end and the relationship of the shaft to the housing are useful clues. The assembly in the file's description is a rotary incremental encoder. It will not normally show the number of turns by swinging a pointer around a dial. It sends electrical information that a controller can use to keep a count for as long as the movement is observed.

The need for two signals is easier to see if you first imagine trying to get along with only one. Suppose a disc with evenly spaced marks moves past a sensor and the sensor produces a pulse for each mark. You can record eight pulses and know it passed eight repeated intervals. If someone turned the disc in the other direction at the same speed, the record could look just the same. An interval counter on its own can make the movement visible while losing the sense of which way it went. A second observation, taken a little out of step with the first, lets the pulses carry more information without making each mark different.

Put the second observation off to one side

In a simplified optical example a repeated pattern alternately lets light through and blocks it. A sensor at one position detects this repetition as the disc turns. A similar detection channel offset by part of one interval also sees the repetition, but the changes do not occur at the same moment. An encoder can arrange two outputs, usually called A and B, at about a quarter of one signal period apart. The offset has to be understood with respect to the repeated pattern. A quarter of one pulse cycle is not a quarter of a whole turn of the shaft. There can be many cycles in a single turn.

Now watch which signal changes first. A mark traveling in one direction reaches the equivalent points for the two observations in a particular order. Traveling the opposite way reverses that order. A controller can add to its count in one case and subtract in the other. The observation isn't a measurement of how many degrees are left before every other possible mark or of where the sensor was when the machine started. It is an answer to a smaller and often more useful question: relative to where the mechanism was a moment ago, which way did it move?

There are ways to produce offset signals without a visible disc or a beam of light. The logic about which change came first remains useful. The photographed encoder has its sensing parts inside a housing and doesn't show how they are arranged. Treat the optical example as a device for understanding the timing, not as a claim that its particular internal parts or output resolution can be recovered from the photograph.

Four combinations tell two different stories in time

Imagine writing the two current states side by side with one digit for A and one for B. A digital example might start with 00, move through 01, then 11, then 10, then return to 00. If the same series is traversed backward from 00, the next state is 10, then 11, then 01, then 00. All four pairs occur in both versions. What distinguishes them is the order of arrival. Each intended step in this example changes just one of the digits. The example deliberately does not assign a real manufacturer's clockwise convention to either series. That convention depends on the assignment of A and B and which end of a shaft the user is considering.

Follow the details of one step from 00 to 01. B changed while A remained low. A separate change from 11 to 10 also concerns B, but the relation to A is now different. The controller can keep the previous pair and use it along with the new pair to decide the count direction. If it observes 00 followed directly by 11, both positions have changed and the simple interpretation needs care. In ideal quadrature there was an intermediate state. The record might have missed it or been affected by an unwanted transition. There isn't enough information in those two observed pairs alone to settle which valid intermediate state occurred.

The number of steps captured can also depend on the counting convention. Detect one designated edge per cycle and one increment is available for that cycle. Detect both changes of both signals and four steps may be counted over the same cycle. This is why two specifications written in unfamiliar terms need a check before their numbers can be compared. Confirm whether they describe cycles made by the encoder, transitions counted by a reader or positions represented through some other method. The shaft did not turn four times farther just because the observation uses four edges.

A count has to start somewhere

Imagine a system powered on after its shaft came to rest at an unknown angle. The encoder may present a valid pair of states immediately. It repeats that pair at many angles around one turn. From the combination alone the system cannot generally infer where it is in the full rotation. As motion begins it can add or subtract increments from an arbitrary beginning. It knows about displacement from the count's chosen starting point. It may need a separate event to give the count a reference in the physical world.

OMRON’s guide describes an additional origin or index signal that can be provided once in a revolution. This can mark a particular stage of a turn after the system observes it. A machine can also use a separate known reference position when its task requires one. More than one whole turn makes a different problem. An index that recurs once in each rotation does not, on its own, tell which turn was performed when the system was not recording it. A controller has to preserve a valid count or regain position by an appropriate procedure for the equipment.

An absolute encoder addresses the starting question differently. Within the range its design represents, it provides information distinguishing positions, rather than asking the reader to reconstruct them only from a sequence of increments. That need not be the best choice for every apparatus. A device that needs speed or relative motion may have little use for a complete position record. A device that must distinguish one position after power returns has a different requirement. The important difference lies in the question each signal was built to answer.

A clean count is not a perfect position measurement

A disk can have small repeated intervals and mounting can still matter. If there is play between a shaft and the object whose movement the controller cares about, the shaft can go through a little motion before the object follows. More recorded counts may describe the shaft in finer steps without removing that difference. The encoder in the photograph sits in relation to a shaft; the photograph alone does not show the next connection toward the object being measured. This is a practical distinction between numerical resolution and the accuracy of a measurement of the whole mechanism.

A lost transition can also leave a relative count off by a small amount during otherwise ordinary motion. The effect later may be larger than the moment it happened, because later valid transitions are still added to the same record. A system interested in long runs may check its count against a suitable physical reference. A system interested in speed over a short interval may care much more about how consistently it sees changes in a small window. Before deciding whether there is a fault, work out which signal changes should drive the count and which part of the machinery is actually producing them.

Speed can be estimated from the number of changes observed over a known interval, or from the time separating suitable changes. These are not identical observations. Counting a handful of steps in a very short window makes the estimate sensitive to whether one step fell at the start or end. Waiting longer supplies more steps to count but can obscure a brief change of speed. At slow speeds the time to the next edge can be a more informative measurement, while still leaving a delay before new movement becomes visible. The encoder supplies events; the reader chooses what observation to make of the events.

Stop on the next edge

Bring the thought experiment down to a single move. A shaft turns far enough for a transition, reverses and returns across the same boundary. An unsigned count of events might increase twice. A valid directional reading of those steps can add once and subtract once, leaving the net position unchanged. Both records have a use. One tells how much activity took place across that boundary and the other preserves the direction needed to keep a position.

From outside, the small housing is an undramatic way for a shaft to carry that distinction into a controller. The remarkable part is how little extra information it can take. Two signals with the same repeating pattern, separated by a carefully chosen offset, supply an order that will reverse when the shaft does. A count becomes a direction-sensitive observation because someone arranged for one event to happen just before the other.

Further reading