What is Gray Code?

With Gray Code, only one bit changes its state from one position to another. This is known as a “minimum-change code.” This reduces possibility of errors and glitches in digital systems. The Gray code is often used in automation technology, e.g. for absolute encoders.

Why not using a binary code for absolute encoders?

Using a binary code can lead to certain data errors as shown in the following figure:

Data errors using a binary code

Data errors using a binary code

As can be seen under the magnifying glass, 3 bits should change simultaneously. Due to tolerances, in this case the code 101 is read out for a brief moment until the correct code 000 is finally read.

Gray Coding to read position

The gray code is mostly used in automation for linear and rotary position encoders (absolute encoders). We show how it works:

Gray code table - Gray coding to read position

Gray code table - Gray coding to read position