What’s gray code?

Print anything with Printful



Gray code is a cyclic binary code that allows for the expansion of standard binary code. It was developed by Frank Gray to control electromechanical switches and is now used in digital communications and other applications due to its single-bit modification property. It eliminates false position information and was first patented by Bell Labs in the 1950s.

Gray code is a type of cyclic binary code first patented in 1947, but did not receive the Gray code name until the early 1950s, in subsequent patent applications. In particular, the code is a mirrored binary code, which means that the last numbers in the string can be the same as the starting numbers, but in reverse order, thus allowing the utility of standard or natural binary code to be developed and expanded. Frank Gray, the Bell Labs researcher after whom the code is named, developed this particular binary number system to help control electromechanical switches. Today, Gray code is used in a variety of environments, especially in digital communications where analog signals need to be converted to digital media.

During the early stages of code development, the main focus was on making electromechanical switches work more effectively. Mechanical switches that use natural binary code can be difficult to read in terms of their position. Several switches can change positions simultaneously, with complicated transition positions. Depending on the transition phase, a switch might read in one position when it is actually in a transition state, while traveling to another position. Multiplied by multiple switches, an incorrect reading of the switch position can cause system-wide errors and false information.

Alternatively, only one switch changes position at a time when using Gray code, which eliminates the possibility of false or misleading position information, as only one bit changes at a time. As development of the code continued for several decades after Gray’s initial introduction, additional applications have come to light. For example, rotary and optical encoders use Gray code because each sequence or change of position differs by only one bit. Similarly, error correction for digital communication, genetic algorithms, and some types of maps use Gray code, partly because of the single-bit modification property associated with the code.

A similar reflected binary code was used in the late 1800s in telegraphy. Even earlier, mathematicians used the reflected binary code to solve complex mathematical questions or puzzles similar to the Tower of Hanoi and ancient Chinese ring puzzles. While used, such binaries were not standardized, patented, or otherwise found to be in proprietary use until Gray’s work in the late 1940s and early 1950s. Bell Labs, using a vacuum tube instrument invented by Frank Gray, patented the first device in which analog signals were converted into reflected binary code. In the 1953 patent application for the device, known as a pulse code communication tube or PCM tube, Bell Labs officially referred to the Gray code for the first time.




Protect your devices with Threat Protection by NordVPN


Skip to content