Serial Protocol Options for CUI encoders

Depending on the application, a controller or variable-speed electric-motor drive may need to measure any combination of rotor speed, position, and direction. A rotary encoder is the go-to device for this purpose and can be either an incremental type that gives position relative to a reference point or an absolute encoder that expresses a unique code for each rotor position. Although both types operate along similar principles, the absolute encoder is able to determine the rotor position as soon as the system is switched on without being initialized and can keep track of the position in the event of unexpected power loss.

Position detection is commonly performed using either optical sensing – counting and comparing marks on a code wheel - or electrical sensing that detects varying capacitance as the code wheel turns. Choosing a capacitive encoder such as a CUI Devices AMT Series absolute encoder eliminates optical errors caused by dirt or grease on the code wheel, or incorrect or spurious lighting. CUI Devices’ patented capacitive technology ensures high reliability and low maintenance.

Encoder Communication Protocol Options

Another important aspect is to consider how the encoder connects to the host system and, in particular, the most suitable communication interface. Suppliers can offer parts with a wide variety of outputs ranging from simple TTL outputs to industrial Ethernet or proprietary standards. Familiar serial interface standards are among the most popular and widely used, including RS-485 (aka TIA/EIA-485), SPI (Serial Peripheral Interface) and SSI (Synchronous Serial Interface). Designers’ choices can be governed by the interface available at the host system, as well as factors such as protocol latency, maximum data rate, the connection distance between the encoder and host, and the required level of noise immunity.

Serial Peripheral Interface (SPI)

SPI supports two-way synchronous interactions coordinated by a clock signal. Synchronous communication simplifies interaction between the master and slave by eliminating any need to establish a common data rate or number of bits to be transmitted. Master-Out-Slave-In (MOSI) and Master-In-Slave-Out (MISO) data connections allow full-duplex communication. A large number of host controllers come with an SPI port already built in. This, combined with the ability to adjust the data rate, makes SPI an extremely user-friendly connection to implement with minimal additional network circuitry required.

The master requests data from a given slave by asserting the appropriate chip-select signal, and the slave can respond immediately. This enables an SPI encoder such as the CUI Devices AMT22 Series to provide position feedback to the host extremely quickly. The AMT22 gives the current position when accessed over the SPI connection and can be instructed to set the zero point or reset the encoder with extended commands. The maximum clock speed of 2 MHz allows data to be shifted to the input buffer to begin reading out within 1500 ns.

Drawing of a typical SPI configuration with shared clock signal, MOSI, and MISO and unique chip select line

SPI connections are single-ended and best suited to short connection distances under a meter. However, the ability to dynamically adjust the data rate allows the device to still perform over longer distances at slower speeds.

RS-485

If the encoder is to be positioned a long distance from the host, or if significant electrical noise is present in the operating environment, RS-485 differential signaling can provide greater immunity to errors or interference. RS-485 communication is asynchronous and hence requires no clock signal. A dedicated RS-485 transceiver is required and, depending on the distance, communication speed can be up to 10 Mbps or even higher.

Data is exchanged over a twisted pair cable, which must be correctly terminated using a resistance equivalent to the cable’s characteristic impedance, usually placed at each end of the cable. Multiple encoders can be attached to the RS-485 serial bus, ideally using the shortest possible connections between the cable and encoders.

Diagram of a typical RS-485 configuration with host and multiple encoders

CUI Devices’ AMT21 Series encoder, which is designed for connection to an RS-485 serial bus, is connected using four pins comprising power, ground, and the two differential connections. The default protocol is 8N1 (8 data bits, no parity, 1 stop bit), where the two lower bits define the command given to the encoder and the remaining bits contain the encoder address. This allows up to 64 encoders to share the bus. When the controller puts in an encoder address and command to read the position data (or number of turns, for a multi-turn encoder) on the bus, the target encoder responds within three microseconds. There are also two extended commands for setting the zero position and resetting the encoder.

Synchronous Serial Interface (SSI)

SSI is typically a synchronous simplex one-way master-slave communication protocol that uses differential signaling and has no chip-select signal. This enables a simple and low-cost connection to the encoder, with dynamic speed adjustment, all while benefiting from the high noise resistance of a differential connection.

CUI Devices’ AMT23 series absolute encoder implements a variation of SSI that can save one wire by featuring single-ended communication and using a chip-select connection to let the host activate individual encoders on the bus. Unlike SPI, the host does not send commands. The encoder responds purely by putting position data on the bus, simplifying the interface between the host and encoders. CUI Devices’ SSI interface is compatible with off-the-shelf SSI controllers that feature chip-select. Typical connection lengths and noise performance are similar to SPI.

Drawing of a typical 3-wire SSI configuration with shared clock and data lines and a unique chip select line

Conclusion

CUI Devices’ absolute encoders offer equipment designers flexible options to choose the right encoder for their applications and simplify interconnection to the host system. The differential RS-485 interface is a powerful choice when long connection distances or high noise immunity are required, while at the same time enabling high-speed communication. SPI, on the other hand, is easy to implement, with fewer network requirements, and is supported natively on a large number of off-the-shelf general-purpose microcontrollers. Lastly, SSI’s synchronous communication and reduced wiring also make it a simple, low cost option for encoders with the added benefit of noise immunity due to its differential signaling.

Reference:
https://www.cuidevices.com/blog/integrating-absolute-encoders-an-overview-of-spi-rs-485-and-ssi-protocols#serial-peripheral-interface-spi-

See Also: I²C vs SPI protocols