What is Gray Code?
Table of Contents
ToggleWith 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
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
Exercise - Design a 3-bit Gray Code Counter
Your task is to develop a circuit for a 3-bit Gray code. To do this, you carry out the following steps:
- Create a truth table
- Simplify the Disjunctive normal form DNF with the help of Karnaugh-maps
- Draw the circuit for the Gray code counter
1. Truth table of the gray-Code counter

Truth table of a 3-bit Gray Code Counter
2. Karnaugh-maps

Karnaugh-maps of a 3 bit Gray code counter
3. Circuit for the Gray code counter

Design of a 3 bit Gray code counter