Design and Application of AC Servo Motor Position Drive Monitoring and Detection System
2026-04-06 03:22:48··#1
Servo motors are widely used in various industrial transmission devices. Monitoring and detecting the operating parameters of servo motors is an essential part of the control system, especially in systems where multiple motors work together. This article takes a three-axis AC servo drive system as an example to illustrate how to design a host computer monitoring software for the servo drive system using VC++, and how to exchange data with the AC servo driver through a serial communication port. 1 System Basic Composition AC servo motor drivers are widely used in industrial position transmission devices due to their ease of use and reliable performance. New AC servo motor drivers on the market all have a serial communication interface conforming to the RS485 protocol. The computer can use this interface circuit to achieve serial communication with the driver, sending corresponding position and speed commands to the driver to control the operation of the servo motor, and providing timely feedback of the motor's operating data for computer analysis. This method has good stability, high precision, long transmission distance, bidirectional exchange of control information, and simple circuitry, making it a promising technology. A serial control network consisting of a computer and multiple AC servo motor drivers is shown in Figure 1. In the network, the computer is the host, and each driver is a slave. Each motor driver has a rotary switch. Figure 1 shows ID1, ID2, and ID3. Each switch typically has 16 positions from 01H to 0FH, used to uniquely identify the driver code. The computer broadcasts control commands; because the identification code is unique, only one driver can effectively receive the computer's command at a time. Conversely, when each driver feeds back information to the computer, the identification code is unique, so the computer will not misjudge. The working principle of the three-dimensional motion system is as follows: Under computer control, the servo motor driver drives the three-dimensional worktable to move along the X, Y, and Z axes via a lead screw, fixing the workpiece on the X and Y axes and the engraving tool (laser) on the Z axis. This forms a spatial trajectory curve, thus engraving the designed model. 2. Human-Machine Interface Design of the System's Host Computer In the software programming process, the design of the human-machine interface (HMI) is very important. It directly communicates with the operator. A user-friendly HMI requires realistically reproducing the state of the control equipment and accurately collecting the required parameter data. This is mainly achieved through the combination of VC++ controls and source code. The entire HMI (Human Machine Interface) includes a main screen, parameter setting screen, historical curve screen, status test screen, and alarm screen, which can be switched between. Different HMIs can also be edited according to user habits. The main screen primarily includes controls for three-axis linkage image engraving, parameter setting, historical curve, status test, alarm, image repeat engraving, image engraving pause, image engraving stop, program process exit, and real-time image engraving display curves in the client area. The main screen serves as the monitoring system window; essentially all the data the operator needs is concentrated here. Its user-friendliness and functional completeness directly impact the success of the HMI. The parameter setting screen centralizes all parameters that need modification, including lead settings, running speed, engraving range, decomposition step size, minimum point distance, coordinate origin, position control PID parameters, forward and reverse backlash error compensation, step sequence, step time, ball screw pitch length error compensation, and light output delay. This screen has many functions and is relatively complex to operate. To restrict operator access, a modal password dialog box is set up, primarily to ensure process confidentiality and prevent unnecessary misoperation. The password can be changed after entering the correct password. To facilitate operators in recording raw data, the images etched each day are stored in the database for that day. To view the etched records for a specific day, simply open that day's database to plot the historical curves for that day. [IMG=Figure 1 Structure Diagram of 3D AC Servo Drive Serial Port Network Monitoring and Detection System]/uploadpic/THESIS/2007/11/2007111609003578911J.jpg[/IMG] Figure 1 Structure Diagram of 3D AC Servo Drive Serial Port Network Monitoring and Detection System [IMG=Table 1 Overview of Communication Functions]/uploadpic/THESIS/2007/11/20071116090325955347.jpg[/IMG] Table 1 Overview of Communication Functions The alarm screen displays alarm information from the electromechanical equipment. In case of an abnormality, the alarm screen displays alarm text and indicator light information, and simultaneously, the speaker connected to the host computer emits sound or transmits the alarm information to the alarm bell. This reminds the operator to take timely measures to handle the fault. The status test screen can display the motion status of the three motion axes, allowing observation of whether the three motion axes have returned to the coordinate origin and the forward and reverse motion status of a single axis. This screen allows monitoring of whether the X, Y, and Z axis position switches are functioning correctly and whether the rotation direction of each axis matches the specifications, ensuring that the motor operates according to the correct instructions during image engraving and achieves the required spatial trajectory. 3. Communication Design Between the Host Computer and Servo Driver Currently, industrial servo drivers are typically equipped with RS485 communication interfaces. By developing corresponding drivers using this interface, information exchange between the host computer and the servo driver can be achieved. 3.1 RS485 Serial Communication Industrial RS485 communication uses a 2-wire twisted-pair transmission method, i.e., data D+ and data D-. This differential data transmission method effectively eliminates the influence of interference. Furthermore, RS485 communication is a 1:N mode, where one master computer (host computer) can cascade up to 16 slave computers (servo drives). 3.2 RS485 Communication Rules A selection/query method is used, with the slave computer often in a waiting state for the master computer to select or query. When the servo drive is in standby mode, if the slave device with the correct number receives the request frame from the host, it will process the request frame and return a positive delivery frame if it is deemed a normal reception signal; otherwise, it will return a negative delivery frame. 3.3 Communication Function: The communication between the host computer and the servo drive mainly performs the functions shown in Table 1. 3.4 Communication Connection: Host computer side: RS232/RS485 conversion interface. Slave computer side: RS485 communication port. A non-conductive twisted-pair shielded cable is used to connect the host computer and the slave device, with a terminating resistor added to the end slave device. 3.5 Communication Software Development: ① Initialize the serial communication port. Before communicating through the computer's serial port, the communication method between the two parties must be agreed upon based on the relevant communication parameters of the monitoring equipment, including baud rate settings, parity checks, and stop bit settings. Determine the data transmission frame format, determine the UART operation mode, and write operations to the line control register and MODEM register one by one. ② Query the transmission process. The CPU only needs to detect that the UART transmitter holding register is empty to output a character to the UART. The sender first outputs that RTS and DTR are valid, then checks the MODEM register. Only when the CTS and DSR inputs from DEC are valid will the CPU output a transmit character to the UART. ③ Query reception process. The CPU only needs to detect that the UART receiver is ready to receive data to read a character from the receiver data register. The receiver first outputs that the terminal is ready (DTR=1), then checks the MODEM status register. Only when DSR=1 will the CPU receive a character. The following program is a VC++ program that reads a specified amount of data in a Win98 environment: ... COMMTIMEOUTS timeOver; memset (&timeOver, 0, sizeof (timeOver)); DWORD timeMultiplier, timeConstant; timeOver.ReadTotalTimeoutMultiplier = timeMultiplier; timeOver.ReadTotalTimeoutConstant = timeConstant; SetCommTimeouts (hComport, &timeOver); ... ReadFile (hComport, inbuffer, nWantRead, &nRealRead, NULL) ... The COMMTIMEOUTS structure is used to set the timeout, specifying the waiting time for read/write functions. In the ReadFile() function, hComport is the handle of the serial port to be read; inBuffer is the size of the input buffer; nWantRead is the number of bytes the function attempts to read each time ReadFile() is called; nRealRead is the number of bytes actually read; the last parameter value NULL indicates that ReadFile() will use synchronous file read/write mode. Through this code, a thread in the application periodically queries the serial port's receive buffer. If there is data in the buffer, it reads the data; if there is no data in the buffer, the thread continues execution. 3.6 Communication Experiment: The host computer and servo driver are connected via RS485. The unit definitions of 01H to 0FH in the servo driver are set. The application is started, and the communication port parameters are entered in the property settings window. The experiment verifies as follows: Frequency Setting: The frequency is set in the input box. By comparing the reading on the servo driver's display panel, the correctness of the input is proven. Frequency Reading: The servo driver is set to keyboard operation mode. The frequency is selected using the up and down keys. The frequency displayed in the reading box of the window matches the setting, proving that the reading is correct. 4 Conclusion: This example has been successfully applied to the servo control system of a 3D laser engraving machine. It has high control accuracy, convenient operation, high reliability, and a good performance-price ratio. This design can be used as a reference for the testing of 3D control systems driven by different AC servo motor positions. (Proceedings of the 2nd Servo and Motion Control Forum, Proceedings of the 3rd Servo and Motion Control Forum)