“In digital systems, it is often necessary to transform a certain information (input) into a certain code (output). Arrange binary codes according to certain rules, such as 8421 codes, Gray codes, etc., so that each group of codes has a specific meaning (representing a certain number or control signal) is called a code. The logic circuit with encoding function is called encoder. The encoder has several inputs, and only one input signal is converted into a binary code at a certain time. If an encoder has N input terminals and n output terminals, the relationship between the output terminal and the input terminal should satisfy the relationship N≤2n.For example, 8-wire-3 wire encoder and 10-wire-4 wire encoder have 8 outputs respectively.
Definition and function of encoder
In digital systems, it is often necessary to transform a certain information (input) into a certain code (output). Arrange binary codes according to certain rules, such as 8421 codes, Gray codes, etc., so that each group of codes has a specific meaning (representing a certain number or control signal) is called a code. The logic circuit with encoding function is called encoder. The encoder has several inputs, and only one input signal is converted into a binary code at a certain time. If an encoder has N input terminals and n output terminals, the relationship between the output terminal and the input terminal should satisfy the relationship N≤2n. For example, 8-wire-3-wire encoder and 10-wire-4-wire encoder have 8-input, 3-bit binary code output and 10-input, 4-bit binary code output respectively.
▲ 4-wire-2-wire encoder
The working principle of the encoder with 4 inputs and 2 binary outputs is analyzed below.
Draw the logic diagram according to the logic expression as shown in Figure 1.
The logic circuit can realize the functions shown in Table 1, that is, when one of the inputs of I0～I3 is 1, the output Y1Y0 is the corresponding code. For example, when I1 is 1, Y1Y0 is 01. There is one more issue here for the reader’s attention. When I0 is 1, I1～I3 are all 0 and I0～I3 are all 0, Y1Y0 are all 00, and these two situations must be distinguished in practice. This problem is left to be solved later. Of course, the encoder can also be designed to be active low.
▲ Keyboard input 8421BCD code encoder
The keyboard input logic circuit of the computer is composed of an encoder. Figure 2 is an 8421 code encoder composed of ten buttons and gate circuits. Its functions are shown in Table 2. Among them, S0～S9 represent ten buttons, that is, input keys corresponding to decimal numbers 0-9, and their corresponding output codes It happens to be 8421BCD codes, and they are also used as logic variables. ABCD is the output code (A is the highest bit), and GS is the control enable flag.
Analyzing the function table and logic circuit, we can see that: ①The encoder is input low-level valid; ②When any key of S0～S9 is pressed, that is, when one of the input signals is at valid level, GS =1, it means there is signal input, and only when S0～S9 are all high level, GS=0, it means there is no signal input, the output code 0000 at this time is invalid code. This solves the problem of how to distinguish between the two cases where the output is all 0.
▲ Priority encoder
Although the above-mentioned mechanical key coding circuit is relatively simple, when two or more keys are pressed at the same time, its output will be confusing. In digital systems, especially in computer systems, several work objects are often controlled. For example, a microcomputer host needs to control printers, disk drives, and input keyboards. When a component needs to perform an operation, it must first send a signal to the host (called a service request), and then send a permit operation signal (called a service response) after the host recognizes it. There will be several components that send out a service request at the same time. Possibly, but only one of the components can be signaled to allow operation at the same time. Therefore, it is necessary to prescribe the order in which these control objects are allowed to operate, that is, the priority level. The logic component that recognizes the priority level of this type of request signal and encodes it is called a priority encoder. The function table of 4-wire-2 wire priority encoder is shown in Table 3.
The working principle and types of encoders
An encoder is a device that compiles and converts a signal (such as a bit stream) or data into a signal form that can be used for communication, transmission, and storage. The encoder converts angular displacement or linear displacement into electrical signals. The former is called a code wheel and the latter is called a code ruler. Encoders can be divided into two types: contact type and non-contact type according to the reading mode; encoders can be divided into two types: incremental type and absolute type according to the working principle. The incremental encoder converts the displacement into a periodic electric signal, and then converts this electric signal into a counting pulse, and the number of pulses is used to indicate the magnitude of the displacement. Each position of the absolute encoder corresponds to a certain digital code, so its indication is only related to the start and end positions of the measurement, and has nothing to do with the middle process of the measurement.
According to the detection principle, encoders can be divided into optical, magnetic, inductive and capacitive. According to its scale method and signal output form, it can be divided into three types: incremental, absolute and mixed.
Incremental encoder: Incremental encoder directly uses the principle of photoelectric conversion to output three sets of square wave pulses A, B and Z; the phase difference of the two sets of pulses A and B is 90 degrees, so that the direction of rotation can be easily judged. The Z phase is one pulse per revolution, used for reference point positioning. Its advantages are simple structure, average mechanical life of more than tens of thousands of hours, strong anti-interference ability, high reliability, and suitable for long-distance transmission. The disadvantage is that the absolute position information of the shaft rotation cannot be output.
Absolute encoder: Absolute encoder is a sensor that directly outputs numbers. There are several concentric code discs along the radial direction on its circular code disc. Each track is composed of light-transmissive and opaque sectors. The sector trees of adjacent code channels are in double relationship. The number of code channels on the code disc is the number of binary digits. On one side of the code disc is the light source, and the other side has a photosensitive element corresponding to each code channel. When the code wheel is in different positions, each photosensitive element converts a corresponding level signal according to whether it receives light or not to form a binary number. The characteristic of this kind of encoder is that it does not need a counter, and a fixed digital code corresponding to the position can be read out at any position of the shaft. Obviously, the code channel must be N code channels. At present, there are 16-bit absolute encoder products in China.
Hybrid absolute encoder: Hybrid absolute encoder, which outputs two sets of information, one set of information is used to detect the magnetic pole position, with absolute information function; the other set is exactly the same as the output information of the incremental encoder.
Application of photoelectric encoder
The photoelectric encoder expresses the position information of the motor rotor connected to the photoelectric encoder by reading the pattern or code information on the photoelectric encoder disc. The photoelectric encoder is currently the most used sensor.
The general photoelectric encoder is mainly composed of a grating disc and a photoelectric detection device. In the servo system, since the photoelectric code disc is coaxial with the motor, when the motor rotates, the grating disc rotates at the same speed as the motor, and a detection device composed of light-emitting diodes and other Electronic components detects and outputs several pulse signals. The current motor speed can be reflected by calculating the number of output pulses of the photoelectric encoder per second. In addition, in order to determine the direction of rotation, the code wheel can also provide two-channel optical code output with a phase difference of 90°, and determine the rotation of the motor according to the state change of the dual-channel optical code.
According to the working principle of the photoelectric encoder, the photoelectric encoder can be divided into an absolute photoelectric encoder and an incremental photoelectric encoder. Below, briefly explain the difference between an incremental encoder and an absolute encoder.
1. Angle measurement
In the car driving simulator, the photoelectric encoder is selected as the sensor for the measurement of the steering wheel rotation angle. The gravity measuring instrument uses a photoelectric encoder to connect its rotating shaft to the compensation knob shaft of the gravity measuring instrument. The torsion angle meter uses the encoder to measure the torsion angle change, such as torsion experiment machine, fishing rod torsion fishing performance test, etc. The pendulum impact test machine uses an encoder to calculate the swing angle change during impact.
2. Length measurement
The meter counter uses the circumference of the roller to measure the length and distance of an object. The cable displacement sensor uses the circumference of the winding wheel to measure the length of the object. Direct coupling measurement, coupling with the main shaft of the power unit that drives linear displacement, and measuring by the number of output pulses. In the medium detection, the linear displacement information is transmitted in the straight rack, the sprocket of the rotating chain, the synchronous belt wheel, etc.
3. Speed measurement
Linear velocity, measure the linear velocity and angular velocity of the production line through the connection with the instrument, and measure the velocity of the motor, shaft, etc. through the encoder
4. Position measurement
On the machine tool, the coordinate position of each coordinate point of the machine is memorized. For automatic control such as a drilling machine, it is controlled to perform a specified action at each position.Such as elevators, hoists, etc.
5. Synchronous control
Synchronize the transmission links through angular velocity or linear velocity to achieve tension control
Incremental encoder (rotary type)
Rotary encoder is a device used to measure speed. It is divided into single-channel output and dual-channel output. The technical parameters mainly include the number of pulses per revolution (dozens to thousands of them), and the power supply voltage. Single output means that the output of the rotary encoder is a set of pulses, while the dual output rotary encoder outputs two sets of pulses with a phase difference of 90 degrees. The two sets of pulses can not only measure the speed, but also determine the direction of rotation.
1. Working principle: A photoelectric code disc with an axis in the center, on which there are circular and dark engraved lines, is read by photoelectric transmitting and receiving devices, and four groups of sine wave signals are combined into A, B, C, D. , Each sine wave has a phase difference of 90 degrees (relative to a cycle of 360 degrees), the C and D signals are reversed and superimposed on the 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.
Since the phases A and B differ by 90 degrees, the encoder’s forward and reverse rotation can be judged by comparing the phase A or the B phase. The zero reference position of the encoder can be obtained through the zero pulse.
The materials of the encoder code disc are glass, metal, plastic. The glass code disc is deposited on the glass with very thin score lines, which has good thermal stability and high precision. The metal code disc is directly engraved with through and impassable lines and is not fragile. However, because metal has a certain thickness, accuracy is limited, and its thermal stability is one order of magnitude worse than that of glass. Plastic code discs are economical, and their cost is low, but accuracy, thermal stability, and life are worse. .
Resolution-The number of open or dark engraved lines provided by the encoder per 360 degrees of rotation is called resolution, also known as resolution division, or directly called the number of lines, generally 5 to 10,000 lines per revolution.
2. Signal output: The signal output has sine wave (current or voltage), square wave (TTL, HTL), open collector (PNP, NPN), push-pull multiple forms, of which TTL is a long-line differential drive (symmetrical A, A -;B,B-;Z,Z-), HTL is also called push-pull and push-pull output. The signal receiving device interface of the encoder should correspond to the encoder.
Signal connection-The pulse signal of the encoder is generally connected to the counter, PLC, and computer. The modules connected between the PLC and the computer are divided into low-speed modules and high-speed modules, and the switching frequency is low or high.
Such as single-phase connection, used for single-direction counting and single-direction speed measurement.
The AB two-phase connection is used for forward and reverse counting, judgment of forward and reverse and speed measurement.
A, B, Z three-phase connection, used for position measurement with reference position correction.
A, A-, B, B-, Z, Z- connections, due to the connection with symmetrical negative signals, the electromagnetic field contributed by the current to the cable is 0, the attenuation is the smallest, the anti-interference is the best, and it can be transmitted over a longer distance.
For TTL encoders with symmetrical negative signal output, the signal transmission distance can reach 150 meters.
For HTL encoders with symmetrical negative signal output, the signal transmission distance can reach 300 meters.
3. Problems with incremental encoders: incremental encoders have zero cumulative errors and poor anti-interference. The receiving equipment needs to be powered off and memorized when it is shut down, and the change or reference position should be set when starting up. For these problems, such as the use of absolute type The encoder can be solved.
General applications of incremental encoders:
Speed measurement, measurement of rotation direction, measurement of movement angle, distance (relative).
Absolute encoder (rotary type)
There are many optical channel engraved lines on the optical code disc of absolute encoder, and each engraved line is divided into 2 lines, 4 lines, 8 lines and 16 lines in sequence. . . . . . Arrangement, in this way, at each position of the encoder, by reading the open and dark of each engraved line, a set of unique binary codes from the zero power of 2 to the n-1 power of 2 (Gray Code), which is called an n-bit absolute encoder. Such an encoder is determined by the mechanical position of the photoelectric code disc, and it is not affected by power outages and interference.
Each position determined by the mechanical position of the absolute encoder is unique. It does not need to be memorized, does not need to find a reference point, and does not need to be counted all the time. When it needs to know the position, when to read its position. In this way, the anti-interference characteristics of the encoder and the reliability of the data are greatly improved.
From single-turn absolute encoder to multi-turn absolute encoder
Rotate a single-turn absolute encoder to measure each engraved line of the photoelectric code disk during rotation to obtain a unique code. When the rotation exceeds 360 degrees, the code returns to the original point, which does not comply with the principle of absolute code uniqueness. The encoding can only be used for measurement within 360 degrees of rotation, which is called a single-turn absolute encoder.
If you want to measure rotation beyond 360 degrees, you must use a multi-turn absolute encoder.
The encoder manufacturer uses the principle of clock gear mechanism. When the center code wheel rotates, another set of code discs (or multiple sets of gears, multiple sets of code discs) are driven by gears, and the number of turns is added to the single-turn encoding. Encoding, in order to expand the measuring range of the encoder, such an absolute encoder is called a multi-turn absolute encoder, it is also determined by the mechanical position of the code, each position code is unique and does not repeat, without the need to remember.
Another advantage of the multi-turn encoder is that due to the large measurement range, the actual use tends to be richer, so it is unnecessary to find the change point during installation. It is enough to use a certain intermediate position as the starting point, which greatly simplifies the difficulty of installation and debugging.