With the improvement of the automation level of industrial production, the application of various sensors is also increasing. The rotary encoder acts as a sensor for speed and displacement feedback. It is mainly used in CNC machine tools, high closed-loop speed control systems, servo motors, asynchronous motors, stepping motors, elevator traction machines, elevator door machines, etc. It can ensure the high and stable operation of machinery, thereby improving production efficiency and ensuring safe operation.
This article aims at the application of the rotary encoder in the industrial field, based on the LPCI768 hardware platform, designs a rotary encoder acquisition module. The module has the characteristics of high analysis, shaping, and decoding circuits. It can analyze and decode 2 encoder input signals at the same time. The processed rotating signal is collected and digitally filtered by a high-performance processor. The rotary encoder also calculates the angular velocity of the 2 encoder signals at the same time. The module sends the collected rotational position value and angular velocity value to the DPU (distributed processing unit) through the CAN bus for industrial field use.
1. Rotary Encoder
Rotary encoder is a sensor that measures the movement of rotating parts. It is a sensor that converts the mechanical displacement of rotation into an electrical signal and processes the signal to detect position, speed, etc. Encoding is the process of converting the information of the rotation angle into an electrical signal readable by the single-chip microcomputer. Contact type, photoelectric type and electromagnetic type are the three types of rotary encoders. According to the form of the output signal, it can be divided into two types: incremental and absolute. Among them, the incremental encoder is a commonly used encoder in the industry.
The incremental encoder includes code disc, light-emitting element, receiving element, and signal processing part. When the shaft rotates, it drives the code wheel to rotate. In this way, light is transmitted through the engraved line, and light is not transmitted through the compartment. The transmitted light is received by the receiving element and input to the signal processing part to generate a pulse signal output. The output signal generally includes two phases A and B (phase difference 90°). Some encoders will also output a zero pulse Z per revolution as a mechanical reference zero. If the spindle rotates in a clockwise direction, the A channel signal precedes the B channel signal. When the spindle rotates counterclockwise, the A channel signal is behind the B channel. In this way, we can judge whether the spindle is rotating forward or backward.
2. CAN Bus
Controller Area Network is one of the widely used field buses in the world. It is a serial communication network that can effectively support distributed control and real-time control and belongs to the category of Field Bus. With the continuous improvement and development of the CAN bus, it has now been adopted as an international standard by the International Standards Organization.
CAN bus is a multi-master serial communication bus. Its basic design specification requires a higher bit rate and high anti-interference, and it can detect any errors generated. When its signal transmission distance reaches 10 km, it can still provide a data transmission rate of up to 5kb/s.
For more relevant information about rotary encoder is here!