Posts for July 2019

Encoders 011 - Incremental Encoders - Quadrature & Index

This post continues our discussion of incremental encoders which began in our Encoders 009 post.

One Output - Channel A

In that post, we started with a simple encoder which had a single window in the shape of a slot. We gradually increased the resolution by adding more lines and windows to the encoder’s disk. By the end of the post we showed a typical encoder signal, a square wave output. Let’s call it Channel A. The output went high (+5V) when the encoder’s sensor received light from an LED; and it went low (0V) when a line blocked light from the LED.

Drawing 001: Single Output

The Channel A output waveform looks like this.

Drawing 002: Single Output Waveform

But there’s more to the story. That single output might be fine if you only want to measure distance and speed in one direction, like in a cut-to-length machine.

In many applications, however, motion occurs in two directions: clockwise and counterclockwise, or forward and backward. With a single output channel, you can tell that something in the system is moving-but you can’t tell in which direction the motion is occurring.

A single output has another problem: every cycle looks the same… a line followed by a window… then a line followed by a window… then another line followed by a window… You can’t tell which segment of the disk is aligned with the sensor. You could count cycles from a known starting position-but if the power is turned off and then restored, you’ll lose position information.

These two problems can be solved by adding more output signals.

  • Quadrature Outputs - enable us to determine direction of motion.
  • Index Output - helps us locate a unique position on the encoder disk.

We’ll discuss quadrature first.

Two Outputs: Channel A and Channel B - Quadrature

Let’s begin by adding another LED and photo sensor. (In the drawing, we’ll extend the lines on the encoder disk so that everything fits.)

Drawing 003: Two Outputs - Not Quadrature

Now we have a second output-Channel B. The output from the two signals might look like this.

Drawing 004: Two Outputs - Not Quad - Waveform

We’re making progress, but we can’t determine direction yet. The two signals both rise and fall at the same time. We need a way to change that.

Here’s where the magic happens.

Let’s move the LED and sensor for Channel A over a bit; we’ll shift them a distance of 25% of a full cycle. (That’s one fourth, or one “quadrant” of a cycle-which is where the name “quadrature” comes from.)

Drawing 005: Two Outputs - Quadrature

Now the two output channels look like this.

Drawing 006: Two Outputs - Quadrature - Waveform

As the disk rotates in the clockwise direction, Channel A goes high when its sensor receives light. Then a quarter of a cycle later, Channel B goes high.

As the disk rotates in the counterclockwise direction, after Channel B goes high, one quarter of a cycle later, Channel A will go high.

We can now tell the direction of motion! The commonly used terminology to describe direction is “A leads B for clockwise shaft rotation, B leads A for counterclockwise shaft rotation.”

You also need to know from which end of the shaft we’re viewing the motion. A shaft moving clockwise when viewed from one end would appear to move counterclockwise from the other end! Because each encoder and motor manufacturer may use a different vantage point, ensure that your system follows that same perspective.

Quadrature’s Bonus - Extra Pulses per Revolution (PPR)

We’ve defined resolution as the number of Cycles Per Revolution (CPR) of the encoder disk. Although the number of lines printed on the disk is fixed, with quadrature you can get up to 4 times as many output pulses as the number of lines or windows.

Drawing 007: Resolution Multiplication

This is known as resolution multiplication and can be accomplished with an encoder to counter interface chip such as an LS7183N. As an example, consider an encoder with 100 lines and 100 windows on its disk-a resolution of 100 CPR:

  • x 1 - if we count the rising edge of each Channel A pulse as the disk rotates, we’ll get 100 pulses per revolution (100 PPR). This is the same number as the resolution of 100 CPR, like you would expect if you multiply by 1.
  • x 2 - if we count each rising edge and each falling edge of Channel A, we’ll get 2 pulses per cycle, which adds up to 200 pulses per revolution (200 PPR).
  • x 4 - if we count each rising edge and falling edge of both Channel A and Channel B, we’ll get 4 pulses per cycle, for a total of 400 pulses per revolution (400 PPR).

This technique of resolution multiplication can effectively double or quadruple the resolution of the encoder.

We’ve used quadrature to solve the direction of rotation problem, with an added bonus of enhanced resolution. Now, if we could just figure out where we are within that rotation…

A Third Output - the Index Channel

Let’s go back to the drawing board one last time, and add a solid ring with only one window. We’ll also add another LED and light sensor to detect that window.

Drawing 008: Three Outputs - Index

This thin window occupies its own track on the disk. The window is called an Index, and its output is a third channel called the Index Channel. (It’s sometimes called the registration marker or Z channel-where Z might stand for “zero position” aka the home location.)

Here’s what the outputs look like.

Drawing 009: Three Outputs - Index Waveform

As the encoder disk rotates, the Index Channel will change its output to high in precisely one position. It is common for a system to use this known position to perform a homing move upon powering up, or after an unexpected power cycle. You can also use the index to count rotations of a disk for an application with multiple turns.

That completes our introduction to incremental encoders. In a future blog post, Encoders 013, we’ll discuss absolute encoders, look at their output waveforms, and make some comparisons with incremental encoders.

It is my goal to make this blog as informative, engaging and as accurate as possible. If you ever have some additional or contrary information, please contact me directly and I will be glad to make any appropriate corrections in a future post. Previous Post

Sources:

Written by Steve Mathis
Director of Customer Relations & Marketing

"My goal at US Digital is to work with the excellent teams here to contribute to the success of our customers by eliminating pain points and making it easy for them to do business with us."