Microsoft Teams Image

Position feedback relies on the proper protocol

Feb. 6, 2023
Encoder interface protocols provide a common connection between an encoder and a control system

The speeds at which we want our machines to run relies on the ability to accurately represent the current position of a device and use that information to command that device to move to a specific location at a specific time and coordinate that action with other devices similarly controlled. Position feedback is a key part of our control designs.

A sensing device that converts position/motion into an electrical signal is called an encoder. Regardless of linear or rotary motion, the representation of position follows the same principles.

A print head uses an encoder to accurately deposit material at specific point in space. That space could be a piece of paper or on the platen of a 3D printer. A linear displacement encoder might use a wheel to measure the travel of wire through a cutting machine. A robot uses an encoder on each axis of movement to accurately execute a task. While the type of encoder will vary, the principles are common to all types.

There are two types of encoder output, incremental and absolute. The output of an incremental encoder is a stream of pulses on one or more channels, whereas an absolute encoder output is a multi-bit word.

Encoder interface protocols provide a common connection between an encoder and a control system, as well as providing a means by which to interpret the output from the encoder and provide additional information, such as position and speed. Traditional interfaces include parallel and serial, while more modern protocols include fieldbus and Ethernet.

Let’s talk about resolution for a moment. The degree of accuracy of the feedback depends on the resolution of the encoder. Common resolutions might be 8, 16 and 24 bits. An 8-bit encoder would provide feedback, or count, of 127 increments. A 16-bit encoder has 65,635 increments, while a 24-bit encoder would provide positional divisions of 16,777,215. The degree of accuracy in the actual position will determine the bits of the desired feedback.

A parallel interface, as the name implies, involves a twisted pair—signal high and low—plus power and ground. There is one twisted pair for each bit of information. The number of bits equates to the accuracy of the desired output.

The benefit of a parallel interface is all bits are transmitted simultaneously but at the cost of additional wires and opportunities for something to go wrong. For example, a 16-bit encoder would have a wire count of 2x16 bits plus the power and ground for a total of 34 wires.

A serial interface is similar to a parallel with the main difference being that a serial interface uses only one twisted pair to send all data at once, instead of one pair per bit of resolution. Fewer wires, less opportunity for something to go wrong.

A serial interface connects one slave—encoder—to one master—programmable logic controller (PLC)/counter. The PLC holds a clock bit high until it requires an update and then flips the clock bit to solicit a reply. The reply comes in the form of a stream of clock pulses to represent the data from the encoder. As the description implies, this interface is synchronous.

Two common interfaces of this type are synchronous serial interface (SSI) and bi-directional serial synchronous interface (BiSSI). Unfortunately, since one master can only talk to one slave, this format does not lend itself to multi-axis machines.

Both the parallel interface and serial interface are referred to as point-to-point protocols because of the physical wiring between the encoder bit and the wiring point on the PLC or counter. While we are on the topic of point-to-point interfaces, who remembers the early days of position feedback when it took a whole 16-point input module and a chunk of PLC programming to create an interface to an encoder?

Each bit from the encoder represents one bit of the binary representation of the position. Counting in the usual binary would result in the following sequence:

0=0000

1=0001

2=0010

3=0011

4=0100

5=0101

6=0110

7=0111.

Note that at any one instance, more than one bit may change state, even though the decimal equivalent is only changing by one digit.

For example, decimal 3 is represented by binary 011, while decimal 4 is represented by binary 100. The decimal numbers are one digit apart, but all three binary bits change to go from 011 to 100. 

The issue with this method of counting is a broken wire or a lag in the update of the incoming bits could end up in a bit jump in the resultant count. Let’s consider an 8-bit binary number. Decimal 126 is represented by binary 01111110. What if binary bit 6 has a bad wire, changing the binary count to 01011110? The resultant decimal equivalent suddenly goes from 126 to 94. If you have a motor in motion to 150° and the feedback suddenly changes to a lower number, or a higher number, the motion controller would create an erratic response to try and adjust to that sudden change.

A modified method of counting binary bits, the reflected binary code (RBC), was created where two adjacent numbers differ by only 1 bit. Called the Gray code after its creator, Frank Gray, this method ensures that only one bit change at a time is interpreted by the PLC, or master.

Comparing to the normal binary count mentioned above, the RBC or Gray-code equivalent of counting from 0-7 would go as follows:

0=0000

1=0001

2=0011

3=0010

4=0110

5=0111

6=0101

7=0100.

As can be seen, in this sequence, only 1 bit is changing for each incremental count. Any sequence that doesn’t follow this method would be interpreted as extraneous and ignored by the master.

The PLC code, mentioned above, was required to convert the Gray code back into decimal for use in the application.

The fieldbus interface addresses the inherent issues described in the parallel and serial interfaces. A fieldbus enables a master to communicate with multiple devices—slaves—at the same time. Since they reside on the same bus, once a device is active on the bus, it can be seen by any other device on the bus.

Common examples of fieldbus protocols are ones based on controller area network (CAN) and derivatives such as DeviceNet. Interbus, designed by Phoenix Contact, and Profibus, by Siemens, are two other popular protocols. These have been around since the 1980s.

A popular network protocol, Ethernet, follows on the evolution of the fieldbus protocols with higher speeds. With the advent of Ethernet for automation, devices are able to connect across network protocols to provide even greater connectivity and interconnectivity.

One of the main differences between a fieldbus and other protocols is fieldbus is deterministic. When data collisions happen, and they will with this type of network, the transmission will be delayed.

The answer to this is advanced network protocols like Profinet, EtherNet/IP and EtherCAT.

Profinet is an industrial Ethernet solution, developed by Profibus and PI. It has been around since the early 2000s. It is the evolution of the popular Profibus protocol. It sits on the application layer of the International Organization for Standardization (ISO) open systems interconnection (OSI) model. As such, it tends to be faster than Ethernet. While not restricted to a particular platform, Profinet is most often used in a Siemens-based control system.

EtherNet/IP is an industrial Ethernet solution supported by and used extensively in Rockwell Automation hardware platforms.

EtherCAT is an industrial Ethernet solution and can be found in the powerful Beckhoff hardware platform. EtherNet/IP and EtherCAT sit on the physical and data link layers of the ISO/OSI model. They differ from each other in that each EtherNet/IP device has a unique address, while EtherCAT nodes are determined by the wiring path from the master.

Both use the inexpensive Cat. 5e media. However, EtherNet/IP uses an asynchronous method of communications, meaning that any device can transmit at any time in any order. EtherCAT, on the other hand, uses a single telegram from the master to all of the slaves, in order of the wiring using a technique called processing on the fly. As the telegram passes through each node, the node reads the data intended for it and attaches outgoing data. Each node does this in succession and then the packet returns to the master.

The processing is achieved by the use of specialized application-specific integrated circuit (ASIC) chips in each slave device. One telegram carrying all the data for every node on the network moving in a single direction in a determined cycle means that this is a synchronous method of communication. The node numbers are assigned upon power-up of the network.

Encoders are at the heart of any current control system, so some thought given to choosing the best interface protocol is worth the effort. Profibus and EtherCAT protocols tend to be a better choice where faster performance is critical, but EtherNet/IP devices tend to be more available due to the popularity of the protocol in both plant floor and office networks. Physical media—cables, switches—are similar between the various industrial Ethernet protocols so the choice of protocol is really about what mates up best with the selected PLC or programmable automation controller (PAC) in the control system.

About the Author

Rick Rice | Contributing Editor

Rick Rice is a controls engineer at Crest Foods, a dry-foods manufacturing and packaging company in Ashton, Illinois. With more than 30 years’ experience in the field of automation, Rice has designed and programmed everything from automotive assembly, robots, palletizing and depalletizing equipment, conveyors and forming machines for the plastics industry but most of his career has focused on OEM in the packaging machinery industry with a focus on R&D for custom applications. 

Sponsored Recommendations

eBook: Efficient Operations: Propelling the Food Automation Market

For industrialized food production sectors, the megatrends of sustainable practices, digitalization and demand for skilled employees are underpinned by rising adaptability of ...

2024 State of Technology: Report: Sensors, Vision & Machine Safety

Manufacturing rarely takes place in a vacuum. Workers must be protected from equipment. And equipment must be protected. Sensing technology, vision systems and safety components...

Enclosure Cooling Primer

Learn more about enclosure cooling in this helpful primer.

Ultra-fast, ultra-accurate linear indexing

NSK integrates advanced automation and drive technologies to deliver high capacity, high speed, ultra-precise indexing and positioning in a compact, flexible linear actuator: ...