Motor control method

By using an edge gateway to convert between Modbus and MQTT protocols, combined with buffer data synchronization and multi-level security protection, the problem of data interruption in motor control systems under electromagnetic interference is solved, improving the real-time performance and security of motor control.

CN121728129APending Publication Date: 2026-03-24ZHUHAI RUIDE ELECTRONIC TECH CO LTD
View PDF 0 Cites 0 Cited by

Patent Information

Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2025-11-26
Publication Date
2026-03-24

AI Technical Summary

Technical Problem

In complex electromagnetic interference environments in industrial settings, motor control systems based on the Modbus RTU protocol are prone to damage, leading to data interruptions or equipment failures. Furthermore, the configuration of motor control parameters is cumbersome, making dynamic synchronization difficult and affecting the flexibility and real-time performance of control.

Method used

By using an edge gateway to convert between Modbus and MQTT protocols, a communication bridge is built between the motor and the Mthings platform. Buffer data synchronization and a multi-level security protection system are used to enhance system reliability and security.

Benefits of technology

It improves communication efficiency, reliability, and security, breaks through the protocol barriers of traditional Modbus communication, and enhances the real-time performance and security of motor control, especially in cloud-based and remote monitoring scenarios of industrial IoT devices, demonstrating significant technological progress.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN121728129A_ABST
    Figure CN121728129A_ABST
Patent Text Reader

Abstract

The invention discloses a motor control method, and relates to the technical field of motor control. The method comprises the following steps: in response to an input operation of a user, generating a configuration instruction through an Mthings platform; sending the configuration instruction to an edge gateway according to an MQTT protocol; the configuration instruction is converted into a Modbus RTU message through an edge gateway, and the Modbus RTU message is sent to a motor driving board through an RS485 bus; a Modbus RTU message is received through a motor driving board, and the Modbus RTU message is stored in a receiving buffer area; analyzing the Modbus RTU message through a motor driving board to obtain analysis data, and performing parameter verification on the analysis data; and after the verification is passed, executing read operation or write operation on the motor through the motor driving board according to the analysis data. The method can simplify the configuration process of the motor and ensure the normal operation of the motor.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] This invention relates to the field of motor control technology, and in particular to a motor control method. Background Technology

[0002] Modbus RTU is a serial communication protocol used in industrial applications. It enables data exchange between master and slave devices via an RS-485 bus and is widely used due to its simple frame structure and CRC check mechanism.

[0003] In the field of intelligent motor control and condition monitoring, RS485 bus is commonly used to read motor operating data. However, complex electromagnetic interference (such as surge impacts and electrostatic coupling) and electrical transients in industrial environments can easily damage circuits, leading to data interruptions or equipment failures. Furthermore, the offline configuration process for motor control parameters (such as maximum power threshold setting, speed regulation, and control gear switching) is cumbersome, and motor operating data (including real-time power, speed, cumulative running time, and fault error messages) is difficult to dynamically synchronize to the monitoring terminal, thus limiting the flexibility and real-time performance of control. Summary of the Invention

[0004] This invention aims to at least solve one of the technical problems existing in the prior art. To this end, this invention proposes a motor control method that simplifies the motor configuration process and ensures the normal operation of the motor.

[0005] According to an embodiment of the present invention, a motor control method is applied to a motor control system, the motor control system including an Mthings platform, an edge gateway, and a motor drive board, wherein the Mthings platform is electrically connected to the motor drive board through the edge gateway, and the motor drive board is electrically connected to a motor, the method comprising: In response to user input, configuration instructions are generated through the Mthings platform; The configuration command is sent to the edge gateway according to the MQTT protocol; The configuration instructions are converted into Modbus RTU messages through the edge gateway, and the Modbus RTU messages are sent to the motor drive board via the RS485 bus. The motor drive board receives the Modbus RTU message and stores the Modbus RTU message in the receive buffer. The Modbus RTU message is parsed by the motor drive board to obtain parsed data, and the parameters of the parsed data are verified. Once the verification is successful, the motor is read or written to based on the parsed data via the motor drive board.

[0006] According to some embodiments of the present invention, the motor drive board is further provided with a timeout counter; the step of receiving the Modbus RTU message through the motor drive board and storing the Modbus RTU message in the receive buffer includes: The motor drive board receives Modbus RTU messages according to UART interrupts. For each byte of data received, the data is stored in the receive buffer and the timeout counter is reset. When the count value of the timeout counter reaches the preset value, the motor drive board is triggered to parse the Modbus RTU message.

[0007] According to some embodiments of the present invention, the Modbus RTU message includes an ID, a function code, a destination register address, a parameter value, and a checksum; the parameter check of the parsed data includes: Verify that the ID is the same as the target ID. If they are not the same, discard the Modbus RTU message. When the ID is the same as the target ID, calculate the CRC value of the ID, the function code, the target register address, and the parameter value; The CRC value is compared and verified with the check value.

[0008] According to some embodiments of the present invention, after the verification is passed, performing a read or write operation on the motor through the motor drive board based on the parsed data includes: Based on the function code, determine whether to perform a read operation or a write operation on the motor; When a read operation is performed on the motor, data is read from the corresponding target register according to the target register address; The data is written into the send buffer according to the response frame structure; The data is transmitted to the edge gateway via the RS-485 bus through the transmission buffer, and then transmitted to the Mthings platform through the edge gateway.

[0009] According to some embodiments of the present invention, after the step of determining whether to perform a read operation or a write operation on the motor based on the function code, the method further includes: When a write operation is performed on the motor, the parameter value is written to a temporary buffer; The parameter value is determined to be either a regular parameter or a core parameter; When the parameter value is a regular parameter, after the regular parameter is verified, the parameter value in the temporary buffer is synchronized to the main register, and the control logic of the motor is updated. When the parameter value is a core parameter, permission verification is performed. After confirming that the user has modification permission, the parameter value in the temporary buffer is synchronized to the dedicated register. After the motor drive board is powered off, the parameter value is written from the dedicated register to the main register. After the write operation is completed, a response frame is generated by the motor driver board and then transmitted back to the Mthings platform via the edge gateway.

[0010] According to some embodiments of the present invention, the motor drive board includes: Main control module; A three-phase drive module is electrically connected to the main control module, and the main control module is used to drive the motor through the three-phase drive module. The isolation module is electrically connected to the main control module via an optocoupler; The speed regulation voltage acquisition module is electrically connected to the isolation module. The speed regulation voltage acquisition module is used to acquire the speed regulation voltage of the motor and send it to the isolation module. A potentiometer adjustment module is electrically connected to the isolation module. The potentiometer adjustment module is used to collect the potential adjustment signal of the motor and send it to the isolation module. The isolation module sends the speed regulation voltage and the potential adjustment signal to the main control module. A current acquisition module is electrically connected to the main control module. The current acquisition module is used to acquire the average current of the motor and send it to the main control module. A communication module is electrically connected to both the isolation module and the edge gateway, and the communication module is used to communicate with both the isolation module and the edge gateway. The power supply module is electrically connected to the main control module, the three-phase drive module, the isolation module, the speed regulation voltage acquisition module, the potentiometer adjustment module, the current acquisition module, and the communication module. The power supply module provides operating power to the main control module, the three-phase drive module, the isolation module, the speed regulation voltage acquisition module, the potentiometer adjustment module, the current acquisition module, and the communication module. The power supply module also includes a voltage acquisition unit, which is used to acquire the voltage of the motor and send it to the main control module.

[0011] According to some embodiments of the present invention, the communication module includes: The communication chip has its signal terminal electrically connected to the isolation module via a first current-limiting resistor, its bus terminal connected to the edge gateway via a second current-limiting resistor, its receiver output terminal connected in parallel with a first capacitor, and its power supply terminal connected in parallel with a second capacitor.

[0012] According to some embodiments of the present invention, the potentiometer adjustment module includes: A potentiometer, one end of which is electrically connected to the power module, and the other end of which is grounded. The sliding terminal of the potentiometer is electrically connected to one end of a first resistor, and the other end of the first resistor is electrically connected to the isolation module. The other end of the first resistor is also grounded through a third capacitor.

[0013] According to some embodiments of the present invention, the current acquisition module includes: The second resistor, one end of which is electrically connected to the three-phase drive module; A third resistor, one end of which is electrically connected to the power module, and the other end of which is electrically connected to one end of the second resistor; A fourth capacitor, one end of which is electrically connected to the other end of the third resistor, and the other end of the fourth capacitor is grounded; An operational amplifier is provided, wherein the inverting input terminal of the operational amplifier is electrically connected to the other end of the second resistor through a fourth resistor, the non-inverting input terminal of the operational amplifier is connected to a reference voltage, the output terminal of the operational amplifier is connected to the inverting input terminal of the operational amplifier through a fifth resistor, and the output terminal of the operational amplifier is also electrically connected to the main control module through a filter circuit.

[0014] According to some embodiments of the present invention, a temperature detection module is further included. The temperature detection module is electrically connected to the main control module and the three-phase drive module respectively. The temperature detection module is used to collect the temperature of the motor and send it to the main control module.

[0015] The motor control method according to embodiments of the present invention has at least the following beneficial effects: It achieves Modbus protocol to MQTT protocol conversion through an edge gateway, establishing a communication bridge between the motor and the Mthings platform; it enhances system reliability, ease of use, and security by utilizing buffer data synchronization and a multi-level security protection system, solving problems such as low efficiency, poor real-time performance, and insufficient security in traditional solutions. This method, through systematic innovation in edge gateway protocol conversion, intelligent access control, dynamic data processing, and multi-level security protection, breaks through the bottlenecks of traditional Modbus communication in terms of protocol barriers, real-time performance, and security. Especially in industrial IoT device cloud computing and remote monitoring scenarios, it achieves a comprehensive improvement in communication efficiency, reliability, and security, demonstrating significant technological progress and practical value compared to existing technologies.

[0016] Additional aspects and advantages of the invention will be set forth in part in the description which follows, and in part will be obvious from the description, or may be learned by practice of the invention. Attached Figure Description

[0017] The above and / or additional aspects and advantages of the present invention will become apparent and readily understood from the description of the embodiments taken in conjunction with the following drawings, in which: Figure 1 This is a schematic diagram of the motor control system according to an embodiment of the present invention; Figure 2 This is a flowchart illustrating the steps of the motor control method according to an embodiment of the present invention; Figure 3 The circuit diagrams of the main control module and the three-phase drive module in this embodiment of the invention are shown below. Figure 4 This is a circuit diagram of the current acquisition module and temperature detection module according to an embodiment of the present invention; Figure 5 The circuit diagrams for the isolation module, speed regulation voltage acquisition module, and potentiometer adjustment module in this embodiment of the invention are shown below. Figure 6 This is a circuit schematic diagram of the error reporting interface module and the communication module according to an embodiment of the present invention; Figure 7 This is a circuit schematic diagram of the power supply module according to an embodiment of the present invention. Detailed Implementation

[0018] The embodiments of the present invention are described in detail below. Examples of these embodiments are shown in the accompanying drawings, wherein the same or similar reference numerals denote the same or similar elements or elements having the same or similar functions throughout. The embodiments described below with reference to the accompanying drawings are exemplary and are only used to explain this application, and should not be construed as limiting this application. The step numbers in the following embodiments are set only for ease of explanation, and there is no limitation on the order between the steps. The execution order of each step in the embodiments can be adaptively adjusted according to the understanding of those skilled in the art.

[0019] In the description of this invention, it should be understood that the orientation descriptions, such as up, down, front, back, left, right, etc., are based on the orientation or positional relationship shown in the accompanying drawings. They are only for the convenience of describing this invention and simplifying the description, and do not indicate or imply that the device or element referred to must have a specific orientation, or be constructed and operated in a specific orientation. Therefore, they should not be construed as limiting this invention.

[0020] The terms "first," "second," "third," and "fourth," etc., used in the specification, claims, and accompanying drawings of this invention are used to distinguish different objects, not to describe a specific order. Furthermore, the terms "comprising" and "having," and any variations thereof, are intended to cover non-exclusive inclusion. For example, a process, method, system, product, or apparatus that includes a series of steps or units is not limited to the listed steps or units, but may optionally include steps or units not listed, or may optionally include other steps or units inherent to these processes, methods, products, or apparatuses.

[0021] In this invention, the reference to "embodiment" means that a specific feature, structure, or characteristic described in connection with an embodiment may be included in at least one embodiment of the invention. The appearance of this phrase in various places throughout the specification does not necessarily refer to the same embodiment, nor is it a mutually exclusive, independent, or alternative embodiment. It will be explicitly and implicitly understood by those skilled in the art that the embodiments described herein can be combined with other embodiments.

[0022] Modbus RTU is a serial communication protocol used in industrial applications. It enables data exchange between master and slave devices via an RS-485 bus and is widely used due to its simple frame structure and CRC check mechanism.

[0023] In the field of intelligent motor control and condition monitoring, RS485 bus is commonly used to read motor operating data. However, complex electromagnetic interference (such as surge impacts and electrostatic coupling) and electrical transients in industrial environments can easily damage circuits, leading to data interruptions or equipment failures. Furthermore, the offline configuration process for motor control parameters (such as maximum power threshold setting, speed regulation, and control gear switching) is cumbersome, and motor operating data (including real-time power, speed, cumulative running time, and fault error messages) is difficult to dynamically synchronize to the monitoring terminal, thus limiting the flexibility and real-time performance of control.

[0024] To address this, this invention provides a motor control method that uses an edge gateway to convert between Modbus and MQTT protocols, establishing a communication bridge between the motor and the Mthings platform. By utilizing buffer data synchronization and a multi-level security protection system, the method enhances system reliability, usability, and security, solving problems such as low efficiency, poor real-time performance, and insufficient security in traditional solutions. This method, through systematic innovation in edge gateway protocol conversion, intelligent access control, dynamic data processing, and multi-level security protection, overcomes the bottlenecks of traditional Modbus communication in terms of protocol barriers, real-time performance, and security. Especially in industrial IoT device cloud computing and remote monitoring scenarios, it achieves a comprehensive improvement in communication efficiency, reliability, and security, demonstrating significant technological advancement and practical value compared to existing technologies.

[0025] The motor control method of the present invention will now be described in detail with reference to the accompanying drawings.

[0026] This invention provides a motor control method, which is applied to a motor control system, such as... Figure 1 As shown, the motor control system includes the Mthings platform, an edge gateway, and a motor driver board. The Mthings platform is electrically connected to the motor driver board via the edge gateway, and the motor driver board is electrically connected to the motor. The motor control method includes: Step S100: In response to the user's input, generate configuration instructions through the Mthings platform; Step S200: Send the configuration command to the edge gateway according to the MQTT protocol; Step S300: Convert the configuration command into a Modbus RTU message through the edge gateway, and send the Modbus RTU message to the motor drive board through the RS485 bus; Step S400: Receive Modbus RTU messages through the motor drive board and store the Modbus RTU messages in the receive buffer; Step S500: The Modbus RTU message is parsed through the motor drive board to obtain the parsed data, and the parameters of the parsed data are verified. Step S600: After the verification is successful, the motor is read or written to based on the parsed data via the motor drive board.

[0027] Specifically, when a user wants to obtain motor operating data (such as real-time power, speed, cumulative running time, and fault error information), or wants to configure motor parameters (such as setting maximum power threshold, speed adjustment, and control gear switching), they input the corresponding operation on the Mthings platform. The Mthings platform then generates configuration commands based on the user's input. Since the Mthings platform uses the MQTT protocol for communication, while the motor drive board uses the Modbus RTU protocol, they cannot communicate directly. Therefore, an edge gateway is set up between the Mthings platform and the motor drive board to convert between the Modbus and MQTT protocols, building a communication bridge from the device layer to the platform layer. After receiving the configuration command, the edge gateway performs protocol conversion, transforming the configuration command into a Modbus RTU message. A Modbus RTU message contains an 8-byte data frame, as shown in the example below: 01 06 9d 08 52 44 1a F7.

[0028]

[0029] Table 1 Bit 0 represents the ID, bit 1 represents the function code, bits 2 and 3 represent the target register address, bits 4 and 5 represent the parameter values ​​(the parameter value for read operations is the requested quantity, and the parameter value for write operations is the data to be written), and bits 6 and 7 are check values ​​used for CRC verification.

[0030] The encoding rules for the function codes of the ModeBus communication protocol are shown in Table 2:

[0031] Table 2 After receiving the Modbus RTU message, the motor drive board stores the Modbus RTU message in the receive buffer. Then, it parses and verifies the Modbus RTU message, and performs read and write operations on the motor after the verification is successful.

[0032] Specifically, step S400 above: receiving Modbus RTU messages through the motor drive board and storing the Modbus RTU messages in the receive buffer, specifically includes the following two steps: The motor driver board receives Modbus RTU messages based on UART interrupts. For each byte of data received, it stores the data in the receive buffer and resets the timeout counter. When the timeout counter reaches the preset value, timeout processing is triggered, and the motor drive board is triggered to parse the Modbus RTU message.

[0033] It should be noted that the motor drive board receives data sent from the edge gateway via UART interrupt. For each byte received, the data is stored in the receive buffer and the timeout counter is reset. If no new data is received within a preset time (such as 5ms), timeout processing is triggered, and protocol parsing is triggered to perform the parsing operation of Modbus RTU message.

[0034] As shown in Table 1 above, the Modbus RTU message includes ID, function code, destination register address, parameter value, and checksum. Step S500 above involves parameter verification of the parsed data, including the following three steps: Verify that the ID is the same as the target ID. If they are not the same, discard the Modbus RTU message. When the ID is the same as the target ID, calculate the CRC value of the ID, function code, target register address and parameter value; The CRC value is compared with the check value for verification.

[0035] Specifically, after parsing the Modbus RTU message and obtaining the parsed data, parameter verification is performed on the parsed data. First, it is verified whether the first bit (bit 0) of the data frame is the target ID corresponding to the motor. If it is not the target ID, the frame is discarded. If the verification is successful, the read / write logic is determined according to the function code in bit 1 (0x03 / 0x06 / 0x10, etc.). At the same time, the CRC value of the first N bytes of the data frame (depending on the function code, bits 0-5 in this example) is calculated and compared with the checksum at the end of the frame (bits 6 and 7). If the verification fails, the frame is discarded; if the verification is successful, the operation on the motor is performed according to the corresponding read / write logic.

[0036] In some embodiments of this application, after verification, based on the parsed data, a read or write operation is performed on the motor via the motor driver board, including: Based on the function code, determine whether to perform a read or write operation on the motor; When performing a read operation on the motor, data is read from the corresponding target register according to the target register address; Write the data into the send buffer according to the response frame structure; Data is sent to the edge gateway via the RS-485 bus through the send buffer, and then sent to the Mthings platform through the edge gateway.

[0037] Specifically, based on the function code in bit 1, the operation to be performed on the motor is determined as either a read or write operation. When the function code is 0x03, a read operation is performed; when the function code is 0x06, a write operation is performed. Assuming the function code is 0x03, a read operation is performed. First, bit operations are performed on bits 2 and 3 to obtain the starting address of the target register. Then, bits 4 and 5 are used to obtain the requested quantity. After obtaining the address and the requested quantity, an address range check is performed to ensure it is within the defined range of regular registers. If the range is exceeded, an exception is returned; otherwise, the read operation is successful. Then, a CRC check is performed: the CRC value of the first 6 bytes (ID + function code + address + quantity) is calculated and compared with bits 6 and 7 in the request frame. If the check fails, the frame is discarded; if the check succeeds, the data from the target register at the corresponding address is read and written to the transmit buffer according to the response frame structure: (ID + 0x03 + number of bytes + data + CRC).

[0038] In some embodiments of this application, after verification, based on the parsed data, a read or write operation is performed on the motor via the motor driver board, further comprising: When a write operation is performed on the motor, the parameter value is written to a temporary buffer; Determine whether the parameter value is a standard parameter or a core parameter; When the parameter value is a regular parameter, after the regular parameter verification passes, the parameter value in the temporary buffer is synchronized to the main register, and the motor control logic is updated. When the parameter value is a core parameter, permission verification is performed. After confirming that the user has the right to modify it, the parameter value in the temporary buffer is synchronized to the dedicated register. After the motor drive board is powered off, the parameter value is written from the dedicated register to the main register. After the write operation is completed, a response frame is generated by the motor driver board and then sent back to the Mthings platform via the edge gateway.

[0039] Specifically, when the function code is 0x06, a write operation is performed. The target register address is obtained from bits 2 and 3, and it is checked whether the address is within the defined range. Then, the parameter value (i.e., the write value) is obtained based on bits 4 and 5. The parameter value in the data frame is first written to a temporary buffer, and then a CRC check is performed. The CRC value of the first 6 bytes (ID + function code + address + parameter value) is calculated and compared with the CRC check value of bits 6 and 7. After successful verification, a response frame is constructed, and the value in the temporary buffer is synchronized to the main register.

[0040] It should be noted that the buffers and registers configured in this application are as follows: Modbus_Buf4: The main register, used to store real-time motor operating parameters and status. Parameters in the temporary buffer (with the _Buffer suffix) are only synchronized here after passing validity checks. When the MThings platform reads via function code 0x03, it directly retrieves the value from this register and encapsulates it into a response frame.

[0041] Modbus_Buf4_MAJOR: A dedicated register used to store core motor parameters (motor rated power, protection thresholds, etc.). Only verified users are allowed to modify these parameters, and the parameters are synchronized to this register after being verified for validity, effectively preventing the core parameters from being modified.

[0042] _Buffer suffix buffer (temporary buffer): Serves as an isolation verification area for writing parameters. When receiving parameters to be configured, it ensures that parameters that fail verification will not directly affect the operation of the motor.

[0043] Through a two-layer design of temporary buffer verification and synchronous main register, illegal parameters are intercepted in parameter configuration and real-time data is accurately output in data reading.

[0044] Uart.RevBud: The receive buffer, which continuously stores the byte stream of received Modbus frames, ensuring that a complete frame of data is preserved. During frame parsing, the complete frame data is extracted from Uart.RevBud, and ID verification, function code parsing, CRC check, etc., are performed.

[0045] Uart.SendBuf: The send buffer temporarily stores the sent response data. The hardware reads bytes from this buffer and sends them to the MThings platform via the RS-485 bus, ensuring the complete transmission of the response frame. It plays a crucial role in frame integrity storage and response frame construction during data transmission and reception, providing complete data for protocol parsing.

[0046] When configuring the motor, the MThings platform first generates configuration instructions based on user-input parameters (maximum power limit, speed limit, motor selection, gear, etc.), including the target register address, parameter values, and operation type (0x06, etc.). The edge gateway maps the configuration instructions to Modbus protocol format, verifies the function code, and generates a Modbus RTU frame structure containing the ID, function code, register address, and parameter values. Simultaneously, it handles byte order conversion (big / little endian adaptation), corrects incorrectly formatted configuration instructions, or returns error codes to prevent invalid instructions from consuming communication resources. The edge gateway converts the MQTT format instructions into Modbus RTU frames and sends them to the motor driver board via the RS-485 bus. The motor driver board receives the Modbus RTU frames via UART interrupts, parses out the function code, target register address, and parameter values, and stores them in a temporary buffer. It calls a parameter verification function to check if the parameter values ​​are within a reasonable range (speed < 5000 RPM, power < 800W, etc.). If the verification passes, it determines whether the parameter value is a regular parameter or a core parameter. For standard parameters (gear control mode, gear value, start / stop command, etc.), they are immediately synchronized to the main register after verification, triggering an update to the motor control logic. For core parameters (maximum power limit, speed limit, etc.), they are written to a dedicated register and then to the main register after the motor drive board is powered off, preventing frequent parameter fluctuations from affecting motor stability. Modification of core parameters requires authorization verification. After the MThings platform sends a verification command, it successfully receives a verification pass response from the motor, preventing unauthorized operations. Configuration feedback: The motor drive board generates a response frame (containing the configuration result) and sends it back to the MThings platform via the edge gateway, where the platform updates the parameter configuration status. Through dual-layer buffer verification, a two-level control system for parameter configuration review and activation is implemented. Parameters are also divided into standard and core parameters to prevent unauthorized modifications, forming a motor safety isolation mechanism.

[0047] Motor operation data synchronization: The MThings platform initiates batch read commands via Modbus function code 0x03 at preset intervals, polling the specified register address to trigger the motor operation data synchronization process. Real-time data collected by the sensors is written to a temporary buffer, preprocessed (filtering, range verification), and then synchronized to the Modbus_Buf4 register. A moving average algorithm is used to suppress transient noise, ensuring smooth and stable data. If the collected data exceeds the set range, it is marked as abnormal, and the last valid value is retained to avoid invalid data synchronization. After receiving the read command, the motor driver board extracts the latest valid data from the register, encapsulates a response frame according to the Modbus protocol, and feeds it back to the platform via the RS-485 bus, realizing a platform-pull-device-push synchronization mode. After receiving the data, the platform returns an acknowledgment message (data reception successful). Upon receiving this message, the motor driver board clears the transmission buffer, completing one synchronization cycle. If no acknowledgment is received within a timeout period, it automatically retransmits to avoid data loss. Modifying motor parameters through the MThings platform greatly improves the efficiency of motor drive parameter configuration and also enables dynamic synchronization of motor operation data to the detection terminal.

[0048] The circuit of the motor drive board is as follows Figures 3 to 7As shown, it includes: a main control module 100, a three-phase drive module 200, an isolation module 300, a speed regulation voltage acquisition module 400, a potentiometer adjustment module 500, a current acquisition module 600, a communication module 800, and a power supply module. The three-phase drive module 200 is electrically connected to the main control module 100, and the main control module 100 drives the motor through the three-phase drive module 200. The isolation module 300 is electrically connected to the main control module 100 via an optocoupler. The speed regulation voltage acquisition module 400 is electrically connected to the isolation module 300, and is used to acquire the motor's speed regulation voltage and send it to the isolation module 300. The potentiometer adjustment module 500 is electrically connected to the isolation module 300, and is used to acquire the motor's potential adjustment signal and send it to the isolation module 300. The isolation module 300 sends the speed regulation voltage and potential adjustment signal to the main control module 100, enabling the main control module 100 to receive the speed regulation signal. The system monitors and adjusts the motor's real-time power according to the speed control signal; the current acquisition module 600 is electrically connected to the main control module 100, and is used to acquire the average current of the motor and send it to the main control module 100; the communication module 800 is electrically connected to the isolation module 300, and is used to communicate with the isolation module 300 and the edge gateway; the power supply module is electrically connected to the main control module 100, the three-phase drive module 200, the isolation module 300, the speed control voltage acquisition module 400, the potentiometer adjustment module 500, the current acquisition module 600 and the communication module 800, and is used to provide working power to the main control module 100, the three-phase drive module 200, the isolation module 300, the speed control voltage acquisition module 400, the potentiometer adjustment module 500 and the current acquisition module 600. The power supply module also includes a voltage acquisition unit 710, which is used to acquire the motor voltage and send it to the main control module 100.

[0049] Specifically, the specific circuit of the main control module 100 is as follows: Figure 3 As shown in this example, the main control module includes a microcontroller U2, which can be of the SC32F5432RE or similar model. The main control module is used to control the working status of other modules.

[0050] The specific circuit of the three-phase drive module 200 is as follows: Figure 3As shown, in this example, the three-phase drive module 200 includes a drive chip U1, which can be of the SDM202G60 model. The main control module is connected to the three-phase drive module 200 through UH, UL, VH, VL, WH, and WL signals. The UH signal is connected to the drive chip U1 through resistor R2 and capacitor C3. The UL signal is connected to the drive chip U1 through resistor R3 and capacitor C6. The VH signal is connected to the drive chip U1 through resistor R4 and capacitor C8. The VL signal is connected to the drive chip U1 through resistor R6 and capacitor C9. The WH signal is connected to the drive chip U1 through resistor R8 and capacitor C11. The WL signal is connected to the drive chip U1 through resistor R10 and capacitor C14. The three-phase drive signal sent by the main control module 100 is filtered and then sent to the drive chip U1, enabling the three-phase drive module 200 to drive the motor.

[0051] like Figure 4 As shown, in some embodiments of this application, the current acquisition module 600 includes: a second resistor R14, a third resistor R11, a fourth capacitor C15, and an operational amplifier U3. One end of the second resistor R14 is electrically connected to the three-phase drive module 200; one end of the third resistor R11 is electrically connected to the power supply module (15V voltage); and the other end of the third resistor R11 is electrically connected to one end of the second resistor R14. One end of the second capacitor C15 is electrically connected to the other end of the third resistor R11, and the other end of the fourth capacitor C15 is grounded. The inverting input terminal of the operational amplifier U3 is electrically connected to the other end of the second resistor R14 via the fourth resistor R29; the non-inverting input terminal of the operational amplifier U3 is connected to a reference voltage; the output terminal of the operational amplifier U3 is connected to the inverting input terminal of the operational amplifier U3 via the fifth resistor R19; and the output terminal of the operational amplifier U3 is also electrically connected to the main control module 100 via a filter circuit. Specifically, as shown... Figure 4 As shown, the reference voltage is obtained by dividing the 5V voltage through resistors R26 and R28, and then input to the non-inverting input of operational amplifier U3. The filter circuit, consisting of resistor R23 and capacitor C21, is used to filter the output signal of operational amplifier U3. After obtaining the measured current (R_Ref) from the three-phase drive module 200, the measured current is sampled by the fourth resistor R29 to generate a voltage drop V. sample =I load ×2.7kΩ, this voltage is input to the inverting input of operational amplifier U3 through an implicit trace; simultaneously, a voltage divider network consisting of resistors R26 and R28 generates a 0.5V reference voltage from the 5V power supply, which is input to the non-inverting input of operational amplifier U3. Operational amplifier U3 forms an inverting proportional amplifier circuit through the fifth resistor R19, outputting a signal with a gain of 10: Vout(U3) = 10×(0.5) The signal (Vsample) is filtered for noise by a filter circuit consisting of resistor R23 and capacitor. The final output "average current" signal (DC component) is directly connected to the ADC acquisition pin of the main control module 100, enabling the main control module 100 to acquire the average current of the motor. Through the current acquisition module 600, the main control module 100 can acquire the average current of the motor in real time.

[0052] like Figure 4 As shown, in some embodiments of this application, the motor control method further includes a temperature detection module 900. The temperature detection module 900 is electrically connected to the main control module 100 and the three-phase drive module 200, respectively. The temperature detection module 900 is used to collect the motor temperature and send it to the main control module 100. Specifically, the temperature detection module includes a resistor R16, a capacitor C16, and a thermistor R17. One end of the resistor R16 is connected to a 5V voltage, and the other end of the resistor R16 is connected to one end of the thermistor R17, with the other end of the thermistor R17 grounded. One end of the capacitor C16 is connected to the other end of the resistor R16, with the other end of the capacitor C16 grounded. The resistance of the thermistor R17 changes with temperature, causing a change in the voltage between the resistor R16 and the thermistor R17. The main control module 100 can detect the temperature change of the motor by detecting the signal from the temperature detection module 900. By detecting the temperature through the temperature detection module 900, the motor temperature is prevented from becoming too high, ensuring the safe operation of the system.

[0053] The circuit diagram of isolation module 300 is as follows: Figure 5 As shown, in this example, the isolation module 300 includes an isolation chip U5, an optocoupler OPT1, and an optocoupler OPT2. The isolation chip U5 communicates with the main control module 100 through optocouplers OPT1 and OPT2 to achieve signal isolation. The isolation chip U5 sends a signal U1T to optocoupler OPT1, which in turn sends an RX signal to the main control module 100. The main control module sends a signal TX to optocoupler OPT2, which in turn sends a U1R signal to the isolation module 300. The isolation module achieves signal isolation through optocouplers OPT1 and OPT2.

[0054] The circuit diagram of the speed regulation voltage acquisition module 400 is as follows: Figure 5As shown, in this example, the speed control voltage acquisition module includes resistors R35, R38, R39, R41, R43, capacitors C27 and C29. One end of resistor R35 is connected to a 5V-2V voltage, and the other end of resistor R35 is connected to one end of resistor R41. The other end of resistor R41 is grounded. One end of resistor R39 is connected to the connection point between resistors R35 and R41, and the other end of resistor R39 is connected to the isolation chip U5 via VSP_PWM. One end of capacitor C27 is connected to the other end of resistor R39, and the other end of capacitor C27 is grounded. One end of resistor R38 is connected to the connection point between resistors R35 and R41, and the other end of resistor R38 is connected to one end of capacitor C29. The other end of capacitor C29 is grounded. One end of resistor R43 is connected to the other end of resistor R38, and the other end of resistor R43 is grounded. The speed control voltage acquisition module 400 is used to acquire the speed control voltage of the motor and feed it back to the isolation module 300.

[0055] The circuit diagram of potentiometer adjustment module 500 is as follows: Figure 5 As shown, in this example, the potentiometer adjustment module 500 includes a potentiometer RP1. One end of the potentiometer RP1 is electrically connected to the power supply module (5V-2V), and the other end of the potentiometer RP1 is grounded. The sliding terminal of the potentiometer RP1 is electrically connected to one end of the first resistor R42, and the other end of the first resistor R42 is electrically connected to the isolation module 300. The other end of the first resistor R42 is also grounded through the third capacitor C28. The potentiometer adjustment module 500 can change the power of the motor by adjusting the potentiometer RP1. Simultaneously, the potentiometer adjustment module is also used to send a potential adjustment signal to the isolation chip U5. After receiving the speed regulation voltage and the potential adjustment signal, the isolation chip U5 calculates the motor speed regulation signal and sends it to the main control module 100, so that the main control module 100 changes the motor speed according to the speed regulation signal, thereby adjusting the motor power.

[0056] The circuit diagram of the communication module 800 is as follows: Figure 6As shown, the communication module 800 includes a communication chip U4, which can be a BL3085 / ST485 or similar model. The signal terminal of the communication chip U4 is electrically connected to the isolation module 300 through a first current-limiting resistor (R33, R36, R37). The bus terminal of the communication chip U4 is connected to the edge gateway through a second current-limiting resistor (R31, R40). A first capacitor C24 is also connected in parallel to the receiver output terminal (RO terminal) of the communication chip U4, and a second capacitor C25 is connected in parallel to the power supply terminal (pin 8) of the communication chip U4. Specifically, the communication module 800 employs reserved double-layer protection, which can withstand industrial-grade surges and electrostatic discharge (such as lightning strikes and ESD) by reserving TVS diodes (TVS3 and TVS4) at the A and B bus terminals. Meanwhile, the communication module 800 features end-to-end current limiting. A 100Ω resistor is connected in series at the signal terminals (RX0, TX0, DE0), and a 10Ω resistor is connected in series at the bus terminals (A / B). This end-to-end current limiting from signal input to the communication chip U4 and then to the bus output protects the hardware. Furthermore, tiered filtering is employed for interference suppression. A second capacitor C2 is connected in parallel at the VCC terminal of the ST485 to filter out high-frequency power supply noise. A first capacitor C24 is connected in parallel at the RX0 signal terminal to reduce ground noise coupling. A 10Ω resistor is connected in series at the A and B bus terminals to reduce the impact of bus surges on the chip.

[0057] like Figure 6 As shown, in some embodiments of this application, the motor control method further includes an error reporting interface module 1000, which is electrically connected to the isolation module 300. The error reporting interface module 1000 is used to shut down the corresponding part of the system when an error occurs, ensuring system safety. In this example, the error reporting interface module 1000 includes several error reporting interface units. Each error reporting interface unit includes a transistor (Q1 / Q2 / Q3 / Q4 / Q5 / Q6), the base of which is electrically connected to the isolation module 300 through a sixth resistor (R48 / R49 / R50 / R57 / R58 / R59), the collector of which is electrically connected to the power supply module through a seventh resistor (R44 / R45 / R46 / R52 / R53 / R54), the emitter of which is grounded, and the collector of which is connected to interface P4, and then connected to a corresponding component through P4. When an interface reports an error, the corresponding error reporting interface unit is set high.

[0058] The circuit diagram of the power module is as follows: Figure 7As shown, the power module connects to an external AC power source via L1 and N1, and rectifies and filters the AC power through a filter and rectifier circuit. It then converts the AC power to obtain voltages VM, 15V, 12V, 5V, and 5V-2, providing the required operating voltages for other modules. The power module also includes a voltage acquisition unit 710, which comprises resistors R68, R75, and R77, and a capacitor C51. One end of resistor R68 is connected to the voltage VM, and the other end of resistor R68 is connected to one end of resistor R75. The other end of resistor R75 is connected to one end of resistor R77, and the other end of resistor R77 is grounded. One end of capacitor C51 is connected to one end of resistor R77, and the other end of capacitor C51 is grounded. A voltage acquisition unit is formed by connecting resistors R68 and R75 (680k+680k) in series to divide the voltage, followed by resistor R77 (15K) and capacitor C251 in parallel. This unit acquires the bus voltage VV and sends it to the main control module 100. The main control module can calculate the motor power based on P (power) = U (bus voltage) * I (average current).

[0059] According to the motor control method of this application embodiment, the Modbus protocol and MQTT protocol conversion is realized through an edge gateway, building a communication bridge from the device layer to the platform layer; interrupt reading and data preprocessing mechanisms are used to improve the real-time performance and accuracy of running data reading; a dual-buffer data synchronization and multi-level security protection system are introduced to enhance system reliability, ease of use and security, solving the problems of low efficiency, poor real-time performance and insufficient security of traditional solutions. This method, through systematic innovation in edge gateway protocol conversion, intelligent access control, dynamic data processing and multi-level security protection, breaks through the bottlenecks of traditional Modbus communication in terms of protocol barriers, real-time performance and security. Especially in industrial IoT device cloud and remote monitoring scenarios, it achieves a comprehensive improvement in communication efficiency, reliability and security, and has significant technological progress and practical value compared with existing technologies. The motor drive board, by setting up a communication module 800, can interact with the edge gateway to achieve flexibility and real-time performance in motor control. This communication module 800 can avoid electromagnetic interference (including surge impact and electrostatic coupling) in the industrial field.

[0060] The embodiments of the present invention have been described in detail above with reference to the accompanying drawings. However, the present invention is not limited to the above embodiments. Within the scope of knowledge possessed by those skilled in the art, various changes can be made without departing from the spirit of the present invention.

Claims

1. A motor control method, characterized in that, The method is applied to a motor control system, which includes an Mthings platform, an edge gateway, and a motor driver board. The Mthings platform is electrically connected to the motor driver board via the edge gateway, and the motor driver board is electrically connected to a motor. In response to user input, configuration instructions are generated through the Mthings platform; The configuration command is sent to the edge gateway according to the MQTT protocol; The configuration instructions are converted into Modbus RTU messages through the edge gateway, and the Modbus RTU messages are sent to the motor drive board via the RS485 bus. The motor drive board receives the Modbus RTU message and stores the Modbus RTU message in the receive buffer. The Modbus RTU message is parsed by the motor drive board to obtain parsed data, and the parameters of the parsed data are verified. Once the verification is successful, the motor is read or written to based on the parsed data via the motor drive board.

2. The motor control method according to claim 1, characterized in that, The motor drive board is also equipped with a timeout counter; the step of receiving the Modbus RTU message through the motor drive board and storing the Modbus RTU message in the receive buffer includes: The motor drive board receives Modbus RTU messages according to UART interrupts. For each byte of data received, the data is stored in the receive buffer and the timeout counter is reset. When the timeout counter reaches a preset value, the motor drive board is triggered to parse the Modbus RTU message.

3. The motor control method according to claim 1, characterized in that, The Modbus RTU message includes an ID, function code, destination register address, parameter value, and checksum; the parameter check of the parsed data includes: Verify that the ID is the same as the target ID. If they are not the same, discard the Modbus RTU message. When the ID is the same as the target ID, calculate the CRC value of the ID, the function code, the target register address, and the parameter value; The CRC value is compared and verified with the check value.

4. The motor control method according to claim 3, characterized in that, Upon successful verification, the process of performing a read or write operation on the motor via the motor driver board based on the parsed data includes: Based on the function code, determine whether to perform a read operation or a write operation on the motor; When a read operation is performed on the motor, data is read from the corresponding target register according to the target register address; The data is written into the send buffer according to the response frame structure; The data is transmitted to the edge gateway via the RS-485 bus through the transmission buffer, and then transmitted to the Mthings platform through the edge gateway.

5. The motor control method according to claim 4, characterized in that, After determining whether to perform a read or write operation on the motor based on the function code, the method further includes: When a write operation is performed on the motor, the parameter value is written to a temporary buffer; The parameter value is determined to be either a regular parameter or a core parameter; When the parameter value is a regular parameter, after the regular parameter is verified, the parameter value in the temporary buffer is synchronized to the main register, and the control logic of the motor is updated. When the parameter value is a core parameter, permission verification is performed. After confirming that the user has modification permission, the parameter value in the temporary buffer is synchronized to the dedicated register. After the motor drive board is powered off, the parameter value is written from the dedicated register to the main register. After the write operation is completed, a response frame is generated by the motor driver board and then transmitted back to the Mthings platform via the edge gateway.

6. The motor control method according to claim 1, characterized in that, The motor drive board includes: Main control module; A three-phase drive module is electrically connected to the main control module, and the main control module is used to drive the motor through the three-phase drive module. The isolation module is electrically connected to the main control module via an optocoupler; The speed regulation voltage acquisition module is electrically connected to the isolation module. The speed regulation voltage acquisition module is used to acquire the speed regulation voltage of the motor and send it to the isolation module. A potentiometer adjustment module is electrically connected to the isolation module. The potentiometer adjustment module is used to collect the potential adjustment signal of the motor and send it to the isolation module. The isolation module sends the speed regulation voltage and the potential adjustment signal to the main control module. A current acquisition module is electrically connected to the main control module. The current acquisition module is used to acquire the average current of the motor and send it to the main control module. A communication module is electrically connected to both the isolation module and the edge gateway, and the communication module is used to communicate with both the isolation module and the edge gateway. The power supply module is electrically connected to the main control module, the three-phase drive module, the isolation module, the speed regulation voltage acquisition module, the potentiometer adjustment module, the current acquisition module, and the communication module. The power supply module provides operating power to the main control module, the three-phase drive module, the isolation module, the speed regulation voltage acquisition module, the potentiometer adjustment module, the current acquisition module, and the communication module. The power supply module also includes a voltage acquisition unit, which is used to acquire the voltage of the motor and send it to the main control module.

7. The motor control method according to claim 6, characterized in that, The communication module includes: The communication chip has its signal terminal electrically connected to the isolation module via a first current-limiting resistor, its bus terminal connected to the edge gateway via a second current-limiting resistor, its receiver output terminal connected in parallel with a first capacitor, and its power supply terminal connected in parallel with a second capacitor.

8. The motor control method according to claim 6, characterized in that, The potentiometer adjustment module includes: A potentiometer, one end of which is electrically connected to the power module, and the other end of which is grounded. The sliding terminal of the potentiometer is electrically connected to one end of a first resistor, and the other end of the first resistor is electrically connected to the isolation module. The other end of the first resistor is also grounded through a third capacitor.

9. The motor control method according to claim 6, characterized in that, The current acquisition module includes: The second resistor, one end of which is electrically connected to the three-phase drive module; A third resistor, one end of which is electrically connected to the power module, and the other end of which is electrically connected to one end of the second resistor; A fourth capacitor, one end of which is electrically connected to the other end of the third resistor, and the other end of the fourth capacitor is grounded; An operational amplifier is provided, wherein the inverting input terminal of the operational amplifier is electrically connected to the other end of the second resistor through a fourth resistor, the non-inverting input terminal of the operational amplifier is connected to a reference voltage, the output terminal of the operational amplifier is connected to the inverting input terminal of the operational amplifier through a fifth resistor, and the output terminal of the operational amplifier is also electrically connected to the main control module through a filter circuit.

10. The motor control method according to claim 6, characterized in that, It also includes a temperature detection module, which is electrically connected to the main control module and the three-phase drive module respectively. The temperature detection module is used to collect the temperature of the motor and send it to the main control module.