Share this

Encoder working principle and application

2026-04-06 06:20:32 · · #1

An optical encoder is a sensor that converts the mechanical geometric displacement of an output shaft into pulses or digital signals through photoelectric conversion. It is currently the most widely used sensor. An optical encoder consists of a grating disk and a photoelectric detection device. The grating disk has several rectangular holes evenly spaced on a circular plate of a certain diameter. Because the optical encoder disk is coaxial with the motor, it rotates at the same speed as the motor. The detection device, composed of light-emitting diodes and other electronic components, detects and outputs several pulse signals. By calculating the number of pulses output per second, the current motor speed can be reflected. Furthermore, to determine the direction of rotation, the encoder disk can also provide two pulse signals with a 90° phase difference.

I. Based on the detection principle, encoders can be divided into optical, magnetic, inductive, and capacitive types. According to their scaling method and signal output form, they can be divided into incremental, absolute, and hybrid types.

(a) Incremental encoder

Incremental encoders directly utilize photoelectric conversion to output three sets of square wave pulses: A, B, and Z phases. The A and B pulses have a 90° phase difference, allowing for easy determination of the rotation direction, while the Z phase outputs one pulse per revolution for positioning at a reference point. Its advantages include simple principle and construction, an average mechanical lifespan exceeding tens of thousands of hours, strong anti-interference capability, high reliability, and suitability for long-distance transmission. Its disadvantage is that it cannot output the absolute position information of the shaft rotation.

(ii) Absolute encoder

An absolute encoder is a sensor that directly outputs digital values. Its circular code disk has several concentric tracks radially, each track consisting of alternating transparent and opaque sectors. The number of sectors in adjacent tracks is double. The number of tracks on the code disk corresponds to the number of bits in its binary code. A light source is located on one side of the code disk, and a photosensitive element corresponds to each track on the other side. When the code disk is in different positions, each photosensitive element converts the light source into a corresponding voltage level signal, forming a binary number. A key feature of this type of encoder is that it does not require a counter; a fixed digital code corresponding to the position can be read from any position of the shaft. Obviously, the more tracks, the higher the resolution. For an encoder with N-bit binary resolution, its code disk must have N tracks. Currently, 16-bit absolute encoders are available in China. Absolute encoders use natural binary or cyclic binary (Gray code) methods for photoelectric conversion. The difference between absolute encoders and incremental encoders lies in the translucent and opaque lines on the code disk. Absolute encoders can have multiple codes, and the absolute position is detected by reading the codes on the code disk. The code design can use binary code, cyclic code, binary complement code, etc. Its characteristics are:

1. The absolute value of the angle coordinates can be read directly;

2. No cumulative error;

3. Location information is not lost after power is cut off. However, resolution is determined by the number of bits in the binary representation, meaning precision depends on the number of bits; currently, there are various types, such as 10-bit and 14-bit.

(III) Hybrid Absolute Encoder

A hybrid absolute encoder outputs two sets of information: one set detects the magnetic pole position and provides absolute information; the other set is identical to the output of an incremental encoder. An optical encoder is an angle (angular velocity) detection device that converts the angle input to a shaft into corresponding electrical pulses or digital quantities using photoelectric conversion. It features small size, high precision, reliable operation, and a digital interface. It is widely used in CNC machine tools, rotary tables, servo drives, robots, radar, military target measurement, and other devices and equipment requiring angle detection.

II. Application Circuit of Photoelectric Encoder

(I) Application of EPC-755A photoelectric encoder

The EPC-755A photoelectric encoder boasts excellent performance, exhibiting strong anti-interference capabilities in angle and displacement measurements, and providing a stable and reliable output pulse signal. This pulse signal, after counting, yields the measured digital signal. Therefore, in developing a car driving simulator, we selected the EPC-755A photoelectric encoder as the sensor for measuring the steering wheel rotation angle. Its output circuit uses an open-collector type, with an output resolution of 360 pulses/revolution. Considering that the car steering wheel rotates bidirectionally (clockwise and counter-clockwise), phase detection of the encoder's output signal is necessary for counting. When the photoelectric encoder rotates clockwise, the output waveform of channel A leads the output waveform of channel B by 90°. The D flip-flop outputs Q (waveform W1) at a high level and Q (waveform W2) at a low level. The upper NAND gate is open, allowing the counting pulse to pass through (waveform W3) and be sent to the pulse input terminal CU of the bidirectional counter 74LS193 for addition counting. At this time, the lower NAND gate is closed, and its output is high (waveform W4). When the photoelectric encoder rotates counterclockwise, the output waveform of channel A is delayed by 90° compared to the output waveform of channel B. The output Q (waveform W1) of the D flip-flop is low and Q (waveform W2) is high. The upper NAND gate is closed, and its output is high (waveform W3). At this time, the lower NAND gate is open, and the counting pulse passes through (waveform W4) and is sent to the down pulse input terminal CD of the bidirectional counter 74LS193 for subtraction counting. When the car steering wheel rotates clockwise and counterclockwise, its maximum rotation angle is two and a half turns. An encoder with a resolution of 360 pulses/revolution is selected, and its maximum output pulse count is 900. The actual counting circuit used consists of three 74LS193 chips. During system power-on initialization, the chip is first reset (CLR signal), and then its initial value is set to 800H, which is 2048 (LD signal). Thus, when the steering wheel rotates clockwise, the output range of the counting circuit is 2048 to 2948, and when the steering wheel rotates counterclockwise, the output range of the counting circuit is 2048 to 1148. The data outputs D0 to D11 of the counting circuit are sent to the data processing circuit.

In actual use, the steering wheel is frequently turned clockwise and counterclockwise. Due to quantization errors, after working for a long time, the output of the counting circuit when the steering wheel returns to center may not be 2048, but rather deviate by a few digits. To solve this problem, we added a steering wheel centering detection circuit. After the system is working, when the simulator is in a non-operational state, the data processing circuit detects the centering detection circuit. If the steering wheel is in the centering state and the data output of the counting circuit is not 2048, the counting circuit can be reset and the initial value can be reset.

(II) Application of photoelectric encoders in gravity measuring instruments

A rotary photoelectric encoder is used, with its shaft connected to the compensation knob shaft in the gravity measuring instrument. The angular displacement of the compensation knob in the gravity measuring instrument is converted into an electrical signal. Rotary photoelectric encoders come in two types: absolute encoders and incremental encoders. Incremental encoders are sensors that output pulses; their code disks are much simpler and have higher resolution than those of absolute encoders. Generally, only three tracks are needed. These tracks no longer have the same significance as those in an absolute encoder; they generate counting pulses. The outer and middle tracks of the code disk have an equal number of evenly distributed transparent and opaque sector areas (gratings), but the two sectors are offset by half a zone. When the code disk rotates, its output signal consists of A-phase and B-phase pulse signals with a 90° phase difference, plus a pulse signal generated by the third track, which has only one transparent slit (serving as the reference position of the code disk, providing an initial zero-position signal to the counting system). The direction of rotation can be determined from the phase relationship (leading or lagging) of the A and B output signals. When the code disk rotates forward, the pulse waveform of channel A leads channel B by π/2, while in reverse rotation, the pulse of channel A lags channel B by π/2. This is a practical circuit where the lower edge of the shaped wave of channel A triggers a positive pulse generated by a monostable multivibrator, which is then ANDed with the shaped wave of channel B. When the code disk rotates forward, only the positive pulse is output; conversely, only the reverse pulse is output. Therefore, the incremental encoder determines the rotation direction and relative angular displacement of the code disk based on the output pulse source and pulse count. Typically, if the encoder has N (code channels) output signals with a phase difference of π/N, the countable pulses are 2N times the number of gratings; in this case, N=2. A drawback of the circuit is that it can sometimes produce false pulses, causing errors. This occurs when one signal is in a "high" or "low" level state, while another signal is fluctuating between "high" and "low." In this case, although the code disk does not move, it will produce a unidirectional output pulse. For example, this can happen when the code disk jitters or when manually aligned (as seen below in gravimeter measurements). This is a quadruple frequency subdivision circuit that prevents erroneous pulses and improves resolution. It employs D-type flip-flops with memory function and a clock generation circuit. Two D flip-flops are connected in series for each channel. During the clock pulse interval, the two Q terminals (e.g., pins 2 and 7 of the 74LS175 corresponding to channel B) maintain the input state of the previous two clock cycles. If they are the same, it indicates no change during the clock interval; otherwise, the direction of change can be determined based on their relationship, thus generating a 'positive' or 'reverse' output pulse. When a channel's oscillation alternates between 'high' and 'low', it will alternately generate 'positive' and 'reverse' pulses. This can be eliminated by summing the algebraic values ​​of the two counters (this will also be relevant to the instrument readings below). Therefore, the clock generator frequency should be greater than the maximum possible value of the oscillation frequency. Figure 4 also shows that four counting pulses are obtained within the original pulse signal cycle. For example, an encoder with an original pulse count of 1000 per revolution can generate 4000 pulses at quadruple frequency, with a resolution of 0.09°. In fact, current sensor products of this type encapsulate the amplification and shaping circuits of the output signal of the photosensitive element together with the sensing element. Therefore, as long as a subdivision and counting circuit is added, an angular displacement measurement system can be formed (74159 is a 4-16 decoder).

III. Problem Analysis and Improvement Measures in Application

(I) Problem Analysis in Application

The transmitting and receiving devices of the photoelectric detection equipment are installed at the production site, and many defects have been exposed during use. These defects are caused by both internal and external factors, and are mainly manifested in the following aspects:

1. Displacement or offset of the transmitting or receiving device due to mechanical vibration or other reasons can prevent the receiving device from reliably receiving optical signals and thus from generating electrical signals. For example, in a steel rolling speed control system, the photoelectric encoder is directly bolted to the motor housing. The encoder shaft is connected to the motor shaft via a stiff spring. Since the motor's load is an impact load, vibration of the motor shaft and housing occurs when the rolling mill passes through the steel. Measurements show that the photoelectric encoder vibrates at a speed of 2.6 mm/s during this process. Such vibration can damage the encoder's internal functions, causing false pulses, leading to instability or malfunctions in the control system, and ultimately, accidents.

2. Because photoelectric detection devices are installed at the production site, they are susceptible to unreliable operation due to environmental factors. For example, high temperature and humidity at the installation location can alter or damage the characteristics of the internal electronic components. In the continuous casting machine's ingot feeding tracking system, the photoelectric detection device's proximity to the billet and high ambient temperature can cause it to send false signals or malfunction, potentially leading to production accidents or personal injury.

3. Various electromagnetic interference sources in the production site can interfere with the photoelectric detection device, causing distortion of the output waveform and leading to system malfunction or production accidents. For example, the photoelectric detection device is installed on the production equipment itself, and its signal is transmitted to the control system via cable over a distance typically between 20m and 100m. Although multi-core shielded cables are generally used, the resistance of the cable conductors and the capacitance between the conductors, coupled with the fact that they are laid together with other cables, make them highly susceptible to various electromagnetic interferences. This causes waveform distortion, resulting in a deviation between the signal fed back to the speed control system and the actual value, thus reducing the system's accuracy.

(II) Improvement Measures

1. Change the installation method of the photoelectric encoder. Instead of mounting the photoelectric encoder on the motor housing, a fixed bracket is made on the motor base to independently mount the photoelectric encoder. The center of the photoelectric encoder shaft and the center of the motor shaft must be at the same horizontal level. The two shafts are connected with soft rubber or nylon hoses to reduce the mechanical impact of the motor's impact load on the photoelectric encoder. After adopting this method, the vibration velocity was reduced to 1.2 mm/s according to the vibration meter test.

2. Appropriately select the output signal transmission medium for the photoelectric detection device, and replace ordinary shielded cables with twisted-pair shielded cables. Twisted-pair shielded cables have two important technical characteristics: firstly, they offer strong protection against electromagnetic interference because the interference currents generated by the spatial electromagnetic field on the line can cancel each other out. Secondly, the spacing between the twisted wires is very small, resulting in approximately equal distances between the two wires and the interfering line, and the distributed capacitance of the two wires to the shielding mesh is also roughly the same. This significantly enhances the suppression of common-mode interference.

An optical encoder is a sensor that converts the mechanical geometric displacement of an output shaft into pulses or digital signals through photoelectric conversion. It is currently the most widely used sensor. An optical encoder consists of a grating disk and a photoelectric detection device. The grating disk has several rectangular holes evenly spaced on a circular plate of a certain diameter. Because the optical encoder disk is coaxial with the motor, it rotates at the same speed as the motor. The detection device, composed of light-emitting diodes and other electronic components, detects and outputs several pulse signals. By calculating the number of pulses output per second, the current motor speed can be reflected. Furthermore, to determine the direction of rotation, the encoder disk can also provide two pulse signals with a 90° phase difference.

Based on their detection principles, encoders can be classified into optical, magnetic, inductive, and capacitive types. Based on their calibration methods and signal output formats, they can be classified into incremental, absolute, and hybrid types.

(a) Incremental encoder

Incremental encoders directly utilize photoelectric conversion to output three sets of square wave pulses: A, B, and Z phases. The A and B pulses have a 90° phase difference, allowing for easy determination of the rotation direction, while the Z phase outputs one pulse per revolution for positioning at a reference point. Its advantages include simple principle and construction, an average mechanical lifespan exceeding tens of thousands of hours, strong anti-interference capability, high reliability, and suitability for long-distance transmission. Its disadvantage is that it cannot output the absolute position information of the shaft rotation.

(ii) Absolute encoder

An absolute encoder is a sensor that directly outputs digital values. Its circular code disk has several concentric tracks radially, each track consisting of alternating transparent and opaque sectors. The number of sectors in adjacent tracks is double. The number of tracks on the code disk corresponds to the number of bits in its binary code. A light source is located on one side of the code disk, and a photosensitive element corresponds to each track on the other side. When the code disk is in different positions, each photosensitive element converts the light source into a corresponding voltage level signal, forming a binary number. A key feature of this type of encoder is that it does not require a counter; a fixed digital code corresponding to the position can be read from any position of the shaft. Obviously, the more tracks, the higher the resolution. For an encoder with N-bit binary resolution, its code disk must have N tracks. Currently, 16-bit absolute encoders are available in China. Absolute encoders use natural binary or cyclic binary (Gray code) methods for photoelectric conversion. The difference between absolute encoders and incremental encoders lies in the translucent and opaque lines on the code disk. Absolute encoders can have multiple codes, and the absolute position is detected by reading the codes on the code disk. The code design can use binary code, cyclic code, binary complement code, etc. Its characteristics are:

1. The absolute value of the angle coordinates can be read directly;

2. No cumulative error;

3. Location information is not lost after power is cut off. However, resolution is determined by the number of bits in the binary representation, meaning precision depends on the number of bits; currently, there are various types, such as 10-bit and 14-bit.

(III) Hybrid Absolute Encoder

A hybrid absolute encoder outputs two sets of information: one set detects the magnetic pole position and provides absolute information; the other set is identical to the output of an incremental encoder. An optical encoder is an angle (angular velocity) detection device that converts the angle input to a shaft into corresponding electrical pulses or digital quantities using photoelectric conversion. It features small size, high precision, reliable operation, and a digital interface. It is widely used in CNC machine tools, rotary tables, servo drives, robots, radar, military target measurement, and other devices and equipment requiring angle detection.

II. Application Circuit of Photoelectric Encoder

(I) Application of EPC-755A photoelectric encoder

The EPC-755A photoelectric encoder boasts excellent performance, exhibiting strong anti-interference capabilities in angle and displacement measurements, and providing a stable and reliable output pulse signal. This pulse signal, after counting, yields the measured digital signal. Therefore, in developing a car driving simulator, we selected the EPC-755A photoelectric encoder as the sensor for measuring the steering wheel rotation angle. Its output circuit uses an open-collector type, with an output resolution of 360 pulses/revolution. Considering that the car steering wheel rotates bidirectionally (clockwise and counter-clockwise), phase detection of the encoder's output signal is necessary for counting. When the photoelectric encoder rotates clockwise, the output waveform of channel A leads the output waveform of channel B by 90°. The D flip-flop outputs Q (waveform W1) at a high level and Q (waveform W2) at a low level. The upper NAND gate is open, allowing the counting pulse to pass through (waveform W3) and be sent to the pulse input terminal CU of the bidirectional counter 74LS193 for addition counting. At this time, the lower NAND gate is closed, and its output is high (waveform W4). When the photoelectric encoder rotates counterclockwise, the output waveform of channel A is delayed by 90° compared to the output waveform of channel B. The output Q (waveform W1) of the D flip-flop is low and Q (waveform W2) is high. The upper NAND gate is closed, and its output is high (waveform W3). At this time, the lower NAND gate is open, and the counting pulse passes through (waveform W4) and is sent to the down pulse input terminal CD of the bidirectional counter 74LS193 for subtraction counting. When the car steering wheel rotates clockwise and counterclockwise, its maximum rotation angle is two and a half turns. An encoder with a resolution of 360 pulses/revolution is selected, and its maximum output pulse count is 900. The actual counting circuit used consists of three 74LS193 chips. During system power-on initialization, the chip is first reset (CLR signal), and then its initial value is set to 800H, which is 2048 (LD signal). Thus, when the steering wheel rotates clockwise, the output range of the counting circuit is 2048 to 2948, and when the steering wheel rotates counterclockwise, the output range of the counting circuit is 2048 to 1148. The data outputs D0 to D11 of the counting circuit are sent to the data processing circuit.

In actual use, the steering wheel is frequently turned clockwise and counterclockwise. Due to quantization errors, after working for a long time, the output of the counting circuit when the steering wheel returns to center may not be 2048, but rather deviate by a few digits. To solve this problem, we added a steering wheel centering detection circuit. After the system is working, when the simulator is in a non-operational state, the data processing circuit detects the centering detection circuit. If the steering wheel is in the centering state and the data output of the counting circuit is not 2048, the counting circuit can be reset and the initial value can be reset.

(II) Application of photoelectric encoders in gravity measuring instruments

A rotary photoelectric encoder is used, with its shaft connected to the compensation knob shaft in the gravity measuring instrument. The angular displacement of the compensation knob in the gravity measuring instrument is converted into an electrical signal. Rotary photoelectric encoders come in two types: absolute encoders and incremental encoders. Incremental encoders are sensors that output pulses; their code disks are much simpler and have higher resolution than those of absolute encoders. Generally, only three tracks are needed. These tracks no longer have the same significance as those in an absolute encoder; they generate counting pulses. The outer and middle tracks of the code disk have an equal number of evenly distributed transparent and opaque sector areas (gratings), but the two sectors are offset by half a zone. When the code disk rotates, its output signal consists of A-phase and B-phase pulse signals with a 90° phase difference, plus a pulse signal generated by the third track, which has only one transparent slit (serving as the reference position of the code disk, providing an initial zero-position signal to the counting system). The direction of rotation can be determined from the phase relationship (leading or lagging) of the A and B output signals. When the code disk rotates forward, the pulse waveform of channel A leads channel B by π/2, while in reverse rotation, the pulse of channel A lags channel B by π/2. This is a practical circuit where the lower edge of the shaped wave of channel A triggers a positive pulse generated by a monostable multivibrator, which is then ANDed with the shaped wave of channel B. When the code disk rotates forward, only the positive pulse is output; conversely, only the reverse pulse is output. Therefore, the incremental encoder determines the rotation direction and relative angular displacement of the code disk based on the output pulse source and pulse count. Typically, if the encoder has N (code channels) output signals with a phase difference of π/N, the countable pulses are 2N times the number of gratings; in this case, N=2. A drawback of the circuit is that it can sometimes produce false pulses, causing errors. This occurs when one signal is in a "high" or "low" level state, while another signal is fluctuating between "high" and "low." In this case, although the code disk does not move, it will produce a unidirectional output pulse. For example, this can happen when the code disk jitters or when manually aligned (as seen below in gravimeter measurements). This is a quadruple frequency subdivision circuit that prevents erroneous pulses and improves resolution. It employs D-type flip-flops with memory function and a clock generation circuit. Two D flip-flops are connected in series for each channel. During the clock pulse interval, the two Q terminals (e.g., pins 2 and 7 of the 74LS175 corresponding to channel B) maintain the input state of the previous two clock cycles. If they are the same, it indicates no change during the clock interval; otherwise, the direction of change can be determined based on their relationship, thus generating a 'positive' or 'reverse' output pulse. When a channel's oscillation alternates between 'high' and 'low', it will alternately generate 'positive' and 'reverse' pulses. This can be eliminated by summing the algebraic values ​​of the two counters (this will also be relevant to the instrument readings below). Therefore, the clock generator frequency should be greater than the maximum possible value of the oscillation frequency. Figure 4 also shows that four counting pulses are obtained within the original pulse signal cycle. For example, an encoder with an original pulse count of 1000 per revolution can generate 4000 pulses at quadruple frequency, with a resolution of 0.09°. In fact, current sensor products of this type encapsulate the amplification and shaping circuits of the output signal of the photosensitive element together with the sensing element. Therefore, as long as a subdivision and counting circuit is added, an angular displacement measurement system can be formed (74159 is a 4-16 decoder).

III. Problem Analysis and Improvement Measures in Application

(I) Problem Analysis in Application

The transmitting and receiving devices of the photoelectric detection equipment are installed at the production site, and many defects have been exposed during use. These defects are caused by both internal and external factors, and are mainly manifested in the following aspects:

1. Displacement or offset of the transmitting or receiving device due to mechanical vibration or other reasons can prevent the receiving device from reliably receiving optical signals and thus from generating electrical signals. For example, in a steel rolling speed control system, the photoelectric encoder is directly bolted to the motor housing. The encoder shaft is connected to the motor shaft via a stiff spring. Since the motor's load is an impact load, vibration of the motor shaft and housing occurs when the rolling mill passes through the steel. Measurements show that the photoelectric encoder vibrates at a speed of 2.6 mm/s during this process. Such vibration can damage the encoder's internal functions, causing false pulses, leading to instability or malfunctions in the control system, and ultimately, accidents.

2. Because photoelectric detection devices are installed at the production site, they are susceptible to unreliable operation due to environmental factors. For example, high temperature and humidity at the installation location can alter or damage the characteristics of the internal electronic components. In the continuous casting machine's ingot feeding tracking system, the photoelectric detection device's proximity to the billet and high ambient temperature can cause it to send false signals or malfunction, potentially leading to production accidents or personal injury.

3. Various electromagnetic interference sources in the production site can interfere with the photoelectric detection device, causing distortion of the output waveform and leading to system malfunction or production accidents. For example, the photoelectric detection device is installed on the production equipment itself, and its signal is transmitted to the control system via cable over a distance typically between 20m and 100m. Although multi-core shielded cables are generally used, the resistance of the cable conductors and the capacitance between the conductors, coupled with the fact that they are laid together with other cables, make them highly susceptible to various electromagnetic interferences. This causes waveform distortion, resulting in a deviation between the signal fed back to the speed control system and the actual value, thus reducing the system's accuracy.

(II) Improvement Measures

1. Change the installation method of the photoelectric encoder. Instead of mounting the photoelectric encoder on the motor housing, a fixed bracket is made on the motor base to independently mount the photoelectric encoder. The center of the photoelectric encoder shaft and the center of the motor shaft must be at the same horizontal level. The two shafts are connected with soft rubber or nylon hoses to reduce the mechanical impact of the motor's impact load on the photoelectric encoder. After adopting this method, the vibration velocity was reduced to 1.2 mm/s according to the vibration meter test.

2. Appropriately select the output signal transmission medium for the photoelectric detection device, and replace ordinary shielded cables with twisted-pair shielded cables. Twisted-pair shielded cables have two important technical characteristics: firstly, they offer strong protection against electromagnetic interference because the interference currents generated by the spatial electromagnetic field on the line can cancel each other out. Secondly, the spacing between the twisted wires is very small, resulting in approximately equal distances between the two wires and the interfering line, and the distributed capacitance of the two wires to the shielding mesh is also roughly the same. This significantly enhances the suppression of common-mode interference.

Read next

CATDOLL Dodo 109CM TPE

Height: 109cm Weight: 15.6kg Shoulder Width: 26cm Bust/Waist/Hip: 52/50/57cm Oral Depth: 3-5cm Vaginal Depth: 3-13cm An...

Articles 2026-02-22