4.3.5. Operation with encoders Application of encoders

Encoders are designed for creation of accurate and fast feedback according to the coordinate for all the electric motor types.The feedback is performed by the motor shaft position, by stage’s linear position, by the motorized table rotation angle or by any other parameter related to the shaft position and measured by using the two-channel quadrature encoder complying the requirements described in Specifications chapter for the appropriate controller type. Controller 8SMC5 supports differential encoders and simple (single-ended) encoders.


Auto-detect works only with 3.3V and 5V (with error 0.2V) encoders. What is quadrature encoder?

Encoder is a mechanical motion sensor. The quadrature encoder is designed for direct detection of the shaft position. The sensor transmits the relative shaft position by using two electric signals at CH A and CH B channels shifted relative to each other at 1/4 of period.


The signals at CH A and CH B outputs of quadrature encoder


An optical quadrature encoder mechanics

An optical quadrature encoder mechanics is shown at the figure above. There are two optocouplers used. The operational principle of an optocoupler is as following: a LED and a detector are arranged opposite to each other from different sides of a disc. The optocoupler opens when disc’s “window” coincides with the detector (the outgoing signal is logic zero). The outgoing signal is logic one if the detector is closed by opaque part of the disc.

Number of steps per revolution (CPR) is the main parameter of the quadrature encoder. The standard resolution values for encoder are from 24 to 1024 CPR. Each period of signal alteration is interpreted by 1, 2 or 4 codes which is corresponding to X1, X2 and X4 operating modes. This controller uses the most accurate X4 mode. The maximum frequency of each encoder’s signal depends on the applied encoder itself, since for 200 kHz in X4 mode the controller can read up to 800,000 encoder counts per second. Controller’s features

There are two operating modes with encoder available for the controller:

  • the encoder is used as the main position sensor (this is the main operating mode for DC motors and the optional one for stepper motors).
  • slippage, backlash or steps loss detection (the recommended mode for joint operations with stepper motors, in case the encoder is not used as a primary position sensor, see more). Driving encoder mode

This is the mode when all parameters of the engine including position and velocity are measured directly by the encoder and are denominated basing on counts of encoder. The position is displayed directly in the encoder counts, the speed is denominated in RPM (revolutions per minute). The speed is calculated by the controller basing on the speed alteration data as well as on the number of encoder pulses per one complete revolution of the motor shaft that are displayed in feedback configuration block at the Settings of kinematics (Stepper motor), (DC motor) folder. Note that in the case of DC motor the speed maintaining mode, the mode of movement to the predefined point as well as all their derivations use PID control algorithms and the appropriate settings are required. The driving encoder mode optimizes stepper motor control, this leads to noise reducing and facilitates a stable passage of the resonant speeds with no risk of steps loss when the coordinate flounders and the recurrent calibration is required.

The new algorithm is available with firmware 4.0.7+. Use XiLab 1.13.13+ and set Feedback to Encoder on the Device -> Stepper motor page. Note, that position is in encoder counts now. Encoder mediated mode

This mode of operation is optimally used in systems with large backlash to get to the desired coordinate in a few iterations, on average from 3 to 10. This mode is used for stepper motors.

For this mode, all motor parameters, including position and speed, are set and displayed directly by the encoder and have dimensions based on the encoder readings. However, in the controller the movement itself is carried out in steps.

Principle of operation: The coordinate values obtained from the external interface are converted into steps and the first iteration of the motion is performed,upon completion of which the position of the encoder is checked. Thereafter the deviation values for the new iteration are determined and a new entrance cycle is carried out. It occurs until the moment when it hits the specified coordinate with a given accuracy.

The new algorithm is available with firmware 4.3.+. Use XiLab 1.16.+ and set Feedback to Encoder mediated on the Device -> Stepper motor page. Encoder connection

The encoder is connected to the controller via D-SUB 15 pin connector, which is in all systems (controller board, one-axis and two-axis in box


The diagram of single-ended encoder connection using D-SUB 15 pin connector.


The diagram of differential encoder connection using D-SUB 15 pin connector.

See also the Example of a motor connection chapter.


Encoder inputs of the controller internally pulled up to logic one by using the 5.1kΩ resistors. Frequently encoder outputs are of “open collector” type equipped with internal pull-up resistor. During the data transmission they provide good characteristics while passing from higher logic level to lower. However, the pass from logic 0 to logic 1 is more graduate. It passes through the RC circuit formed by pull-up resistor and cable capacitance. This is the most important thing if the cable is long. If the internal pull-up is not sufficient, the pull-up resistor with r=1.5kΩ may be added for every +5V to each output in order to improve the transmission speed parameters; before doing that please check if the open collector of the encoder can transmit 5mA current. The resistors insertion diagram is shown above. The maximum operating speed for quadrature encoder may be increased by adding a push-pull driver with the outgoing current over 10mA to its output, providing quick 0 - 1 and 1 - 0 transmission edges. Operation with long cables

For correct encoder operations on cables longer than 5 meters, it is recommended to use an encoder with a differential output (RS485) to reduce the effect of electromagnetic interference. When using the RS485, all differential pairs must be terminated with a 120 Ohms resistor in the connector to the controller.

The cable must have an additional internal shield for digital signals (pins 5-15) connected to the DGND (pin 7) on the controller side and on the positioner side. The external shield must be connected to the metal case of the connector directly on the side of the positioner and to the metal case of the connector through a 47 nF capacitor on the side of the positioner. Automatic encoder type detection

The 8SMC5 controller can automatically detect the type of encoder if the corresponding option is enabled. This system is designed to work with standard CAT-5E cables up to 50 meters long and with a conductor resistance about 80 mOhm per meter. Automatic detection may not work well with cables longer than 50 meters or with non-standard cables with high resistance wires. In case of problems with automatic encoder type selection, encoder type can be selected manually in the feedback settings.