Encoder is a kind of device which can be used for communication, transmission and storage by compiling and converting signals (such as bitstream) or data. Encoder converts angular displacement or linear displacement into electrical signal, the former is called code disk, and the latter is called code ruler. According to the readout mode, the encoder can be divided into contact type and non-contact type; according to the working principle, the encoder can be divided into incremental type and absolute type. The incremental encoder converts the displacement into periodic electrical signal, and then converts the electrical signal into counting pulse, and the number of pulses represents the displacement. Each position of the absolute encoder corresponds to a certain digital code, so its indication value is only related to the starting and ending positions of the measurement, but not to the intermediate process of the measurement.
Working principle of encoder:
Four groups of sine wave signals are combined into a, B, C and D with photoelectric transmitting and receiving devices. The phase difference of each sine wave is 90 degrees (360 degrees relative to a cycle). The C and D signals are reversed and superimposed on a and B phases to enhance the stable signal. In addition, a z-phase pulse is output per revolution to represent the zero reference position.
Because the phase difference between a and B is 90 degrees, the forward and reverse rotation of the encoder can be judged by comparing whether phase A is in front or phase B is in front. The zero reference bit of the encoder can be obtained by zero pulse. The encoder code disc is made of glass, metal and plastic. The glass code plate is a thin line deposited on the glass, which has good thermal stability and high precision. The metal code plate can be cut directly through or without lines, and is not fragile. However, due to the thickness of the metal, the accuracy is limited, and its thermal stability is one order of magnitude worse than that of glass. The plastic code plate is economical and its cost is low, However, the accuracy, thermal stability and service life are poor.
Resolution - the resolution is the number of through or dark lines provided by the encoder per 360 degrees of rotation, which is also known as the resolution, or the number of lines directly weighed, which is generally 5-10000 lines per revolution.

How to judge the quality of an encoder
The simplest way to judge whether the encoder is damaged is to connect it according to the correct wiring. If AB has no pulse output, it will be broken. As for the function, it mainly depends on the resolution, that is, the number of internal dark lines. The higher the resolution, the better. However, the price is relatively expensive. Moreover, the quality is good or bad. It is suggested not to buy too cheap counterfeit goods There are more Japanese products used in the Chinese market, and some Korean ones are also good. Several famous PLC, inverter or servo motor manufacturers have encoder products. As for the selection of which brand you prefer, you can download the sample and user manual on their official website. Of course, you can also directly ask the agent for it.
① Connect PLC to check whether the number of pulses or code value is correct;
② Connect oscilloscope to check waveform;
③ Use the multimeter voltage level to test whether the output is normal.
When the encoder is NPN output: measure the positive pole of the power supply and the signal output line. When the transistor is set to on, the output voltage is close to the supply voltage, and when the transistor is set to off, the output voltage is close to 0V.
When the encoder is PNP output: measure the negative pole of the power supply and the signal output line. When the transistor is set to on, the output voltage is close to the supply voltage, and when the transistor is set to off, the output voltage is close to 0V.

What is rotary encoder resolution?
Resolution is also known as digit, pulse number and several line system (which will be called in absolute encoder). For incremental encoder, it is the number of pulses output by the encoder when the shaft rotates one circle; for the absolute encoder, it is equivalent to dividing 360 ° of a circle into several parts. For example, if the resolution is 256p / R, it is equal to dividing 360 ° of a circle into 256, and each rotation is 1.4 °
Left and right output a code value. The unit of resolution is p / R.
How to judge the good or bad of speed encoder
1. When the encoder is still, the voltage of phase A and phase B can be measured to be about 15V or 0V.
When the encoder is turned slightly, the above two voltages can be obtained in turn. A -, B - can get 0 V or - 15 V voltage.
2. When the encoder rotates continuously, the output is the average value of voltage RMS, which may be only about 3-5v stable voltage value.
3. The multimeter can only be used for rough inspection. If the measurement result is too different from the above description, it can be preliminarily considered that the encoder has fault.
4. However, it is impossible to accurately check whether the encoder is completely normal with a multimeter.
Because the encoder outputs high-frequency pulse signal normally, it is recommended that you use an oscilloscope for measurement.
5. The method is: connect the output a phase or B phase signal of the encoder to the oscilloscope, and then rotate the encoder shaft. If the high-frequency 15V square wave pulse signal is observed on the oscilloscope at this time, the encoder is good.

In addition, use the multimeter voltage level to test whether the output is normal.
When encoder is NPN output: measure the positive pole of power supply and signal output line,
When the transistor is set to on, the output voltage is close to the supply voltage, and when the transistor is set to off, the output voltage is close to 0V. When encoder is PNP output: measure the negative pole of power supply and signal output line,
When the output voltage of transistor is close to 0V, the output voltage of transistor is set to off
Remove the encoder, turn the encoder by hand under the condition of constant power supply, and observe the data displayed on the screen to see if there is any change. If the data does not change, the encoder is broken. If there is any change, it proves that the encoder is good
Generally, the encoder should be monitored on line. If the encoder can be removed, it is best to turn the encoder by hand after power on. If the servo motor can move according to the change of encoder value, it is proved that it is good. If the encoder is turned by hand after power on, the value does not change or the change is irregular. But beware of speeding
What are the selection elements of rotary encoder?
① Incremental or absolute
② Appearance size: φ 20mm, φ 25mm, φ 40mm, φ 50mm, φ 55mm, φ 60mm, which shall be considered when installing encoder (can be reflected in naming rules)
③ Shaft diameter: 2mm, 4mm, 6mm, 8mm and 10mm, which are used for coupling with the opposite equipment
④ Resolution: also known as digit, pulse number and several wire system (it will be called in the absolute encoder). At present, the maximum incremental type is 6000p / R, and the absolute type is 1024p / R. ⑤ the shape of the shaft: the shaft extends out and can only be used with a coupler; the hollow shaft can be directly used on the other party's equipment without a coupler
⑥ Working voltage: DC DC 5-24 V (can be reflected in the naming rules) output form: NPN collector open circuit output, PNP collector open circuit output, complementary output, voltage output, linear drive output. The output form of encoder is determined according to what signal can be received by subsequent equipment input (can be reflected in naming rules
⑧ Output code: binary, BCD code, gray binary code (can be reflected in naming rules)
⑨ Output phase: A-phase, A-phase and B-phase, A-phase and B-phase and z-phase. The output phase needs several phases according to what functions the customer wants to achieve (can be reflected in the naming rules)
⑩ Maximum allowable rotation number: the maximum allowable rotation number of the selected encoder needs to be higher than that of the opposite equipment. At present, the maximum allowable rotation number of the incremental encoder is 12000r / min, and that of the absolute encoder is 6000r / min
⑪ Maximum response frequency: the highest response frequency selected should be greater than the action frequency of the opposite equipment. At present, the maximum response frequency of incremental type is 200kHz, and that of absolute type is 20kHz
⑫ Protection level: whether there is water, oil environment, dust environment, etc. at present, the highest protection structure is IP68
⑬ Accessories: mounting accessories for coupler, flange and servo device