Share this

Remote closed-loop control of stepper motors based on inter-PLC communication

2026-04-06 07:21:11 · · #1
Abstract: This paper introduces a remote closed-loop control scheme for stepper motors based on inter-PLC communication. It mainly describes the system structure, master and slave station programming, and stepper motor drive implementation. This scheme is simple, practical, and suitable for applications where operation and control are separated. Keywords: Inter-PLC communication, stepper motor, remote control, closed-loop control 1 Introduction Stepper motors, as position control elements, are widely used in industry. In applications requiring continuous control and precise positioning, such as agricultural robots, agricultural product quality inspection conveyor belts, and automatic greenhouse irrigation, stepper motor position control systems remain an ideal solution. However, in agricultural applications, the work site and control are mostly separated. Only by separating operation and control can the amount of manual labor be greatly reduced, enabling factory-style agricultural operations. This paper introduces a remote closed-loop control scheme for stepper motors based on inter-PLC communication, which is particularly suitable for agricultural applications where operation and control are separated, and the system configuration cost is also low. 2. System Hardware Composition The entire system mainly consists of two FX series PLCs, two PLC communication modules (FX0N-485ADP), a stepper motor (4S39Y-06520), a stepper motor driver (Kinco 2M420), and an encoder (Neimikong OSS-01-2HC). One FX series PLC acts as the master station, and the other as the slave station. Communication between the two PLCs is achieved using the two FX0N-485ADP communication modules, connected by a four-core cable. The master station primarily controls the system, transmitting control signals to the slave station via the communication module. The slave station receives control from the master station and drives the stepper motor. The encoder detects the number of pulses generated by the stepper motor's movement and sends them to the high-speed counting input of the PLC. The slave PLC uses a transistor output type, employing pulse output and direction signal output methods. Let Y0 be the pulse output point and Y1 be the direction signal output point. The overall system principle is shown in Figure 1. [align=center]Figure 1 System Schematic[/align] 3 System Software The master station and slave station are programmed separately. The master station program receives the output pulse frequency and output pulse number settings from the master station's DIP switch, receives start, stop, and forward/reverse control signals from the control buttons and transmits them to the slave station. The slave station receives signals from the master station and controls the stepper motor to move, start, stop, and reverse according to requirements. The pulse signal output by the encoder is counted by the PLC's high-speed counter and compared with the output pulse number set by the master station. The output pulse number is then corrected through calculation. 3.1 PLC Station Settings In this system, the master station PLC uses the FX0N series, and the slave station PLC uses the FX1S series. Therefore, the communication between the two stations is an N:N network communication. The special data registers and related flags for N:N network communication are defined as follows: The PLC station number is set by writing values ​​0-7 into special data register D8176. For the master station, (D8176) = 0; for slave stations, the set values ​​are 1-7, and (D8176) = 1. The total number of slave stations (only the master station needs to set) is determined by writing values ​​1-7 into special data register D8177, corresponding to 1-7 slave stations respectively. If there is only one slave station, (D8177) = 1. The refresh range is set (slave stations do not need to be set) by writing values ​​0-2 into special data register D8178 to determine the communication mode. (D8178) = 0 indicates mode 0. Therefore, the communication refresh soft element range for station 0 is D0-D3, and for station 1, it is D10-D13. The retry count (not required for slave stations) is set by writing a value from 0 to 10 into special data register D8179. (D8179) = 3. When the master station attempts to communicate with the slave station 3 times or more, a communication error occurs. For communication timeout, a value from 5 to 255 is written into special data register D8180. This value multiplied by 10ms is the duration of the communication timeout. The auxiliary relay for setting communication parameters in the FX0N and FX1S series is M8038. The auxiliary relay causing communication errors in the master station is M504, and the auxiliary relays causing communication errors in the slave station are M505 to M511, corresponding to slave stations 1 to 7 respectively. The auxiliary relay that is ON when communicating with other stations is M503. These auxiliary relays cannot be used for other purposes in the user program. 3.2 Master Station Program: The master station program needs to set the master station communication parameters according to the system. The control signals from the PLC master station input unit are read into the master station's internal data register. The control signals that need to communicate with the slave station are placed in the communication refresh soft element area for the slave station to read. The master station program is shown in Figure 2. 3.3 Slave Station Program The slave station program receives information from the master station's refresh range soft element and converts it into corresponding control signals. The stepper motor's pulse train and direction signal are output to the stepper motor driver 2M420 to drive the stepper motor. When Y1 is 0, the stepper motor rotates forward; when Y1 is 1, the stepper motor rotates in reverse. The number of steps the stepper motor rotates is executed according to the slave station's setting. The slave station program is shown in Figure 3. [align=center] Figure 2 Master Station Ladder Diagram Program Figure 3 Slave Station Ladder Diagram Program[/align] 3.4 Position Closed-Loop Control The incremental encoder OSS-01-2CH provides two-phase 90° differential feedback pulse signals, which are input to the PLC's high-speed signal input terminals X000 and X001. The high-speed counter C255 accumulates the input pulses, and the drive pulse count is corrected based on the difference between the input count pulses and the set pulse count. The position control output uses the DRVI instruction. Related components D8145 define the base speed during DRVI instruction execution, D8146 defines the maximum speed, and D8148 defines the acceleration/deceleration time. DRVI instructions: D14 specifies the output pulse frequency, D16 specifies the number of pulses, outputting from Y0. Y1 is ON for forward rotation and OFF for reverse rotation. D16 stores the refreshable pulse count and the corrected pulse count. 4. Stepper Motor Drive Implementation The stepper motor is driven by Kinco's 2M420 stepper driver. This series of drivers uses advanced American technology to produce microstepping, high-current, high-performance drivers. Due to the use of new VLSI integrated circuits, this driver features high power, small size, stable performance, and low cost. The driver has eight DIP switches that allow setting the driver's operating mode and parameters. It employs a bipolar constant current drive method. Setting DIP6-DIP8 allows the output phase current to be set from 0.3A to 2.5A to accommodate different models of hybrid stepper motors. Due to the use of a dedicated drive control chip, setting DIP1-DIP4 allows for output pulse subdivision, up to 256/200 subdivisions. 5. Conclusion The author's innovations include: closed-loop control of the stepper motor, which allows for more precise positioning control and avoids errors caused by data communication, drive control, and transmission. Furthermore, using two PLC units connected via a communication module to form an N:N network enables data communication and remote control, suitable for applications where operation and control are separated. This solution, after debugging, can fully meet the control precision requirements and is applicable to greenhouse irrigation sprinklers, agricultural product characteristic detection conveyor belts, agricultural harvesting robots, and other applications. The system is flexible in configuration, low in cost, and highly reliable. If a communication or touch screen is set up at the main station to connect to a PC, the host computer can monitor and manage the network control system. References: 1. FX COMMUNICATION (RS232C, RS485) USER'S MANUAL 2. Yu Hanqi, Guo Jian (eds.). Programmable Logic Controller Principles and Applications, Beijing: China Electric Power Press, 2004 3. Wang Denggui, Yang Zhongping, Hu Zhenming, et al. Control Method and Implementation of Four-Phase Stepper Motor Based on PLC [J]. Microcomputer Information, 2006, 12: 35-37 4. Kong Lingshan, Xiong Jian. Bipolar Stepper Motor Microstepping Driver [J]. Optoelectronic Engineering, 1997 (12): 39-43 5. Wang Fei, Kong Qingzhong. Application of PLC in Stepper Motor Control Driver [J]. Mechanical Engineering and Automation, 2006 (4): 59-60
Read next

CATDOLL Ava Hybrid Silicone Head

The hybrid silicone head is crafted using a soft silicone base combined with a reinforced scalp section, allowing durab...

Articles 2026-02-22