A low-voltage small motor rotating speed monitoring method based on UART communication

By combining UART communication and triple proportional-integral closed-loop control with field-oriented control, the safety and reliability issues of low-voltage small motors under abnormal operating conditions are solved, enabling precise control and real-time monitoring of motor speed, and improving system stability and fault handling capabilities.

CN122178781BActive Publication Date: 2026-07-24CHINA DRIVE MOTORS (SHENZHEN) CO LTD
View PDF 2 Cites 0 Cited by

Patent Information

Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
CHINA DRIVE MOTORS (SHENZHEN) CO LTD
Filing Date
2026-05-11
Publication Date
2026-07-24

Smart Images

  • Figure CN122178781B_ABST
    Figure CN122178781B_ABST
Patent Text Reader

Abstract

The application relates to the technical field of motor control and serial communication, and provides a low-voltage small motor rotating speed monitoring method based on UART communication. The method comprises the following steps: sending a communication handshake data frame to a motor control board through a serial port to establish a stable serial port communication connection; generating a motor rotating speed setting instruction according to the equipment operation requirement and sending the motor rotating speed setting instruction to the motor control board through the serial port; receiving the data frame by the motor control board, obtaining an instruction code and a target rotating speed parameter through analysis and writing the instruction code and the target rotating speed parameter into a control register; according to the target rotating speed value, executing three proportional integral closed loop control algorithms of constant rotating speed, current limiting and power limiting, adopting a magnetic field oriented control mode to accurately control phase current and rotor angle of the motor, adjusting motor driving signals to realize the target rotating speed; encapsulating running data into feedback data frames by the motor control board, analyzing the feedback data, displaying the motor running state, sending new control instructions according to the feedback information, and realizing real-time control and monitoring.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] This application relates to the field of motor control and serial communication technology, and in particular to a method for monitoring the speed of a low-voltage small motor based on UART communication. Background Technology

[0002] Low-voltage, low-power motors are widely used in smart homes, consumer electronics, small industrial equipment, and automation devices. Their speed control accuracy and operational reliability directly affect the performance of terminal equipment. Currently, universal asynchronous transceiver serial communication has become a common communication method between low-voltage motors and host computers due to its low hardware cost, simple wiring, and strong anti-interference capability.

[0003] Existing low-voltage small motor speed control methods based on universal asynchronous transceivers generally suffer from simple control logic, mostly employing only a single closed-loop speed control and lacking integrated dual protection mechanisms for current and power. When abnormal operating conditions such as motor stall or sudden load changes occur, accidents such as overcurrent and overpower burnout of the motor are very likely to occur, resulting in poor system safety. Summary of the Invention

[0004] This application provides a method for monitoring the speed of low-voltage small motors based on UART communication, aiming to solve the problems existing in the current method for controlling the speed of low-voltage small motors based on universal asynchronous transceivers.

[0005] In a first aspect, embodiments of this application provide a method for monitoring the speed of a low-voltage small motor based on UART communication, the method comprising: Initialize and configure the serial communication parameters of the general asynchronous transceiver to complete the communication interface initialization; send a communication handshake data frame to the motor control board through the serial port, and the motor control board receives and returns an acknowledgment response data frame to establish a stable serial communication connection. Based on the equipment's operational requirements, a motor speed setting command is generated and sent to the motor control board via a serial port. The motor control board receives the data frame via the serial port, performs frame header and tail detection and data integrity verification in sequence, parses the command code and target speed parameters, and writes them into the control register. Based on the target speed, three proportional-integral closed-loop control algorithms—constant speed, current-limiting, and power-limiting—are executed. A field-oriented control method is used to precisely control the motor's phase current and rotor angle, adjusting the motor drive signal to achieve the target speed. During motor operation, the rotor angle, shaft current, and speed are acquired in real-time through the field-oriented control algorithm. Simultaneously, bus current and voltage are collected, and input power is calculated. The motor control board encapsulates the operating data into feedback data frames, parses the feedback data, displays the motor's operating status, and sends new control commands based on the feedback information, achieving real-time control and monitoring.

[0006] In some embodiments, the initialization configuration of the serial communication parameters of the universal asynchronous transceiver (UART) to complete the initialization of the communication interface includes: uniformly configuring the serial communication parameters of the controller and the motor control board respectively. The configuration content includes the communication transmission rate, data bit length, number of stop bits, and data verification method. After the configuration is completed, the serial communication interfaces of the controller and the motor control board are started respectively.

[0007] In some embodiments, the step of sending a communication handshake data frame to the motor control board via a serial port, and the motor control board receiving and returning an acknowledgment response data frame to establish a stable serial communication connection includes: sending a communication handshake data frame to the motor control board at a preset time interval; if no acknowledgment response data frame is received within a preset timeout period, resending the handshake data frame; and triggering a communication error prompt when the number of consecutive resends reaches a preset threshold and no response is received.

[0008] In some embodiments, generating a motor speed setting command according to the device's operating requirements and sending it to the motor control board via a serial port includes: combining the target speed value with a preset command identifier and data verification information in a fixed order to form a complete speed setting command data frame, and sending the data frame to the motor control board according to the configured serial communication parameters.

[0009] In some embodiments, the motor control board receives data frames via a serial port, sequentially performs frame header and tail detection, data integrity verification, and parses the instruction code and target speed parameters and writes them into the control register. This includes: the motor control board first detects the start and end identifiers of the received data; if the identifiers match, it performs integrity verification on the intermediate data; if the verification passes, it parses the control instruction and target speed parameters and writes them into the motor control register; if the verification fails, it discards the corresponding data frame and generates a retransmission request.

[0010] In some embodiments, the step of executing three proportional-integral closed-loop control algorithms—constant speed, current limiting, and power limiting—based on the target speed value, and using a field-oriented control method to precisely control the phase current and rotor angle of the motor, and adjusting the motor drive signal to achieve the target speed, includes: using constant speed closed-loop control as the basic control loop, and treating current limiting closed-loop control and power limiting closed-loop control as higher priority protection loops. When the current or power is detected to exceed a preset threshold, current limiting or power limiting control is executed first, and constant speed control is switched back after the parameters recover to a safe range.

[0011] In some embodiments, during the operation of the motor, the rotor angle, shaft current and speed are obtained in real time through a field-oriented control algorithm, and the bus current and voltage are collected and the input power is calculated. This includes: collecting motor operation data at a preset fixed sampling frequency, performing moving average filtering on the collected raw data to remove noise interference, and then calculating the accurate input power value.

[0012] In some embodiments, the motor control board encapsulates the operating data into feedback data frames, parses the feedback data and displays the motor operating status, and sends new control commands based on the feedback information to achieve real-time control and monitoring. This includes: the motor control board encapsulates the motor protection status, current speed, operating current, input power and fault code into feedback data frames and sends them to the controller. The controller parses the data and displays it in real time, and triggers a corresponding audible and visual alarm when a fault code is detected.

[0013] In some embodiments, the method further includes: collecting speed fluctuation data and load change data during continuous operation of the motor through the motor control board, establishing a correlation model between speed and load, and when a sudden change in load is detected, pre-adjusting the motor drive signal in advance according to the correlation model to compensate for the speed deviation caused by the sudden change in load.

[0014] In some embodiments, the method further includes: statistically analyzing the motor's running time, cumulative number of runs, and frequency of various abnormalities; establishing a motor health status assessment model; generating graded early warning information based on the assessment results; and automatically performing deceleration and shutdown operations when the health status is below a preset threshold.

[0015] This application employs a triple proportional-integral closed-loop control architecture with constant speed, current limiting, and power limiting. It prioritizes the protection loop over the basic control loop, enabling rapid overload cutoff under abnormal operating conditions and fundamentally preventing motor burnout. By organically combining field-oriented control technology with serial port closed-loop control, it achieves precise decoupled control of motor phase current and rotor angle, improving speed response and enabling bidirectional real-time transmission of control commands and multi-dimensional operational data. The host computer can simultaneously acquire speed, current, power, protection status, and fault codes, supporting rapid fault location and early warning. Through integrated handshake confirmation, frame verification, and abnormal retransmission mechanisms, the data transmission error rate is less than one in a million. Automatic reconnection attempts are possible after communication interruption, ensuring long-term stable system operation.

[0016] It should be understood that the above general description and the following detailed description are exemplary and explanatory only, and do not limit this application. Attached Figure Description

[0017] To more clearly illustrate the technical solutions of the embodiments of this application, the drawings used in the description of the embodiments will be briefly introduced below. Obviously, the drawings described below are some embodiments of this application. For those skilled in the art, other drawings can be obtained based on these drawings without creative effort.

[0018] Figure 1 This is a schematic flowchart illustrating the steps of a low-voltage small motor speed monitoring method based on UART communication provided in an embodiment of this application; Figure 2 This is a circuit schematic diagram of a low-voltage small motor speed monitoring method based on UART communication provided in an embodiment of this application; Figure 3 This is a schematic block diagram of a low-voltage small motor speed monitoring system based on UART communication provided in one embodiment of this application; Figure 4 This is a schematic block diagram of the controller provided in one embodiment of this application.

[0019] It should be understood that the above general description and the following detailed description are exemplary and explanatory only, and do not limit this application. Detailed Implementation

[0020] The technical solutions of the embodiments of this application will be clearly and completely described below with reference to the accompanying drawings. Obviously, the described embodiments are only some embodiments of this application, not all embodiments. Based on the embodiments of this application, all other embodiments obtained by those skilled in the art without creative effort are within the scope of protection of this application.

[0021] The flowchart shown in the attached diagram is for illustrative purposes only and does not necessarily include all content and operations / steps, nor does it necessarily have to be performed in the order described. For example, some operations / steps can be broken down, combined, or partially merged, so the actual execution order may change depending on the actual situation.

[0022] It should be understood that, in order to clearly describe the technical solutions of the embodiments of the present invention, the terms "first" and "second" are used in the embodiments of the present invention to distinguish identical or similar items with essentially the same function and effect. Those skilled in the art will understand that the terms "first" and "second" do not limit the quantity or execution order, and the terms "first" and "second" are not necessarily different.

[0023] It should be understood that the terminology used in this specification is for the purpose of describing particular embodiments only and is not intended to limit the scope of the application. As used in this specification and the appended claims, the singular forms “a,” “an,” and “the” are intended to include the plural forms unless the context clearly indicates otherwise.

[0024] It should also be understood that the term “and / or” as used in this application specification and the appended claims means any combination of one or more of the associated listed items and all possible combinations, and includes such combinations.

[0025] Low-voltage, low-power motors are widely used in smart homes, consumer electronics, small industrial equipment, and automation devices. Their speed control accuracy and operational reliability directly affect the performance of terminal equipment. Currently, universal asynchronous transceiver serial communication has become a common communication method between low-voltage motors and host computers due to its low hardware cost, simple wiring, and strong anti-interference capability.

[0026] Existing methods for controlling the speed of low-voltage small motors based on universal asynchronous transceivers generally suffer from the following drawbacks: The control logic is simple, mostly using only a single closed-loop speed control, without integrating dual protection mechanisms for current and power. When the motor experiences abnormal operating conditions such as stall or sudden load changes, it is very easy for overcurrent or overpower to burn out the motor, resulting in poor system safety.

[0027] The speed control accuracy is low, and it is not deeply integrated with advanced field-oriented control technology. It is impossible to accurately decouple the phase current and rotor angle of the motor, resulting in obvious vibration when the motor is running at low speed, large speed fluctuations when running at high speed, and slow response speed.

[0028] The status monitoring capability is insufficient, and the feedback data only includes basic speed information. It is unable to upload key operating parameters such as motor bus current, input power, and protection status in real time. The host computer cannot fully grasp the health status of the motor, resulting in low efficiency in fault diagnosis.

[0029] Poor communication reliability and lack of a sound communication connection verification and anomaly handling mechanism mean that when data transmission errors or communication interruptions occur, the connection cannot be automatically restored, which can easily lead to motor malfunction.

[0030] To solve the above problem, please refer to Figure 1 This application provides a method for monitoring the speed of a low-voltage small motor based on UART communication, applied to a controller. The provided method includes steps S101 to S103, detailed below: Step S101. Initialize and configure the serial communication parameters of the universal asynchronous transceiver to complete the communication interface initialization; send a communication handshake data frame to the motor control board through the serial port, and the motor control board receives and returns an acknowledgment response data frame to establish a stable serial communication connection.

[0031] Specifically, by initializing and configuring the serial communication parameters of the universal asynchronous transceiver, the communication interface is initialized, and a communication handshake data frame is sent to the motor control board via the serial port. The motor control board receives and returns an acknowledgment response data frame, thus establishing a stable serial communication connection.

[0032] First, the hardware configuration of the UART peripheral is completed on the controller and motor control board respectively. The corresponding GPIO pins are configured for UART transmit / receive mode, with the TX pin set to push-pull output and the RX pin set to floating input. The UART peripheral clock and receive interrupt are enabled, and the DMA receive channel is preferably enabled to directly transfer serial data to the memory buffer, reducing CPU usage. To improve hardware anti-interference capability, a 100Ω ferrite bead is connected in series and a 3.3V TVS diode is connected in parallel on the UART_TX / RX lines to suppress electrostatic discharge and surge interference. When the transmission distance is greater than 10m, RS485 level conversion chips can be added at both ends to convert UART to differential transmission. After hardware initialization, the communication parameters are configured uniformly on both the upper and lower computers. For low-voltage small motor scenarios, a standard configuration of 115200bps baud rate, 8 data bits, 1 stop bit, and no parity is recommended. A 256-byte transmit buffer and a 512-byte receive buffer are set respectively to avoid data overflow and loss.

[0033] After the communication parameters are configured, the two-way handshake authentication process is initiated. The controller actively sends a handshake request data frame. This data frame adopts a unified format and includes, in sequence, a frame header of 0xAA0x55, a 1-byte slave address, an instruction code of 0x01, a data length of 0x00, a 2-byte CRC16 checksum, and a frame trailer of 0x0D0x0A. The slave address is used to distinguish multiple motor control boards on the bus, ranging from 0x01 to 0xFE, with 0xFF being the broadcast address. The CRC16 uses the standard Modbus protocol algorithm, checking all bytes from the slave address to the data field. After receiving the request frame, the motor control board sequentially performs frame header detection, CRC16 checksum verification, and other related steps. RC verification and address matching are performed. If the verification fails or the address does not match, the frame is discarded. If the verification passes and the address matches, a handshake confirmation data frame is immediately returned. The format of this data frame is the same as the request frame, with the instruction code being 0x81 and the data field containing a 1-byte device status, where 0x00 indicates standby. If the controller receives a correct confirmation frame within a 500ms timeout, it determines that the communication connection has been successfully established. If it does not receive a confirmation frame within the timeout, it automatically retransmits the handshake request, up to 3 times. After 3 consecutive retransmission failures, the controller reports a "communication connection failed" fault and enters standby mode. If the motor control board does not receive any valid instructions within 10 seconds, it automatically enters the safe stop mode.

[0034] After the connection is established, a periodic heartbeat keep-alive and connection self-healing mechanism is activated. The controller sends a heartbeat frame with instruction code 0x02 to the motor control board every second. After receiving the heartbeat frame, the motor control board immediately returns a heartbeat confirmation frame with instruction code 0x82 and resets the local communication timeout timer. If the controller does not receive heartbeat confirmation for 3 consecutive times, it determines that the communication is interrupted and triggers a "communication abnormality" alarm. If the motor control board does not receive any valid instruction or heartbeat frame for 5 consecutive seconds, it automatically performs a safety shutdown operation and waits for the controller to re-initiate the handshake connection to achieve automatic recovery after the communication interruption.

[0035] Step S102. Generate a motor speed setting command according to the equipment operation requirements and send it to the motor control board via serial port; the motor control board receives the data frame via serial port, performs frame header and frame tail detection and data integrity verification in sequence, parses the command code and target speed parameters and writes them into the control register.

[0036] Specifically, a motor speed setting command is generated based on the equipment's operating requirements and sent to the motor control board via a serial port. The motor control board receives the data frames via the serial port, performs frame header and tail detection and data integrity verification in sequence, parses the command code and target speed parameters, and writes them into the control register.

[0037] By designing a unified instruction format, all instruction frames adopt the same universal format as the handshake frame, ensuring the uniformity of the parsing logic. The core instruction types include speed setting instructions, motor start / stop instructions, emergency stop instructions, and parameter reading instructions. The instruction code for the speed setting instruction is 0x03, and the data field contains 2 bytes of target speed parameters in rpm, ranging from 0 to 65535. The instruction code for the motor start / stop instruction is 0x04, and the data field contains 1 byte of operating status parameters: 0x00 indicates stop, 0x01 indicates forward rotation, and 0x02 indicates reverse rotation. The instruction code for the emergency stop instruction is 0x05, with no data field, and it is the highest priority instruction. The instruction code for the parameter reading instruction is 0x06, and the data field contains 1 byte of parameter address.

[0038] All instructions are ordered from highest to lowest priority as follows: emergency stop instruction, fault protection instruction, start / stop instruction, speed setting instruction, and parameter read / write instruction. Higher priority instructions can immediately interrupt the execution of lower priority instructions. All numerical parameters are transmitted in little-endian mode. After the controller generates the corresponding instruction according to the equipment's operating requirements, it first checks whether the serial port transmission buffer is empty. If it is not empty, it waits for the previous frame to be sent. Then, it encapsulates the instruction into a complete data frame according to a common format, calculates and fills the CRC16 checksum, writes the data frame into the serial port transmission buffer, and starts DMA transmission. After transmission, it waits for the motor control board to return an execution confirmation frame. If a correct confirmation frame with the instruction code of the original instruction code plus 0x80 is received within 300ms, the instruction is considered to have been executed successfully. If no frame is received within the timeout or an incorrect frame is received, the instruction is automatically retransmitted, up to a maximum of 2 times. After two consecutive retransmission failures, a "command execution failure" fault is reported and a heartbeat detection process is triggered.

[0039] After the motor control board acquires data via UART receive interrupt or DMA interrupt, it first scans the receive buffer byte by byte. Upon detecting consecutive 0xAA0x55 frame headers, it marks the frame start position. Then, it calculates the total length of the complete frame based on the "data length" field after the frame header and waits to receive the complete frame. After receiving, it sequentially verifies whether the frame tail is 0x0D0x0A, calculates the CRC16 value and compares it with the checksum carried in the frame, and verifies whether the slave address matches or is a broadcast address. If all verifications pass, it extracts the instruction code and data field parameters, jumps to the corresponding execution function based on the instruction code, and writes the parameters to the corresponding hardware control register. For example, the speed setting instruction writes the parsed target speed value to the speed setting register, whose value will be read in real time by the subsequent control algorithm. The emergency stop instruction immediately shuts down all PWM outputs, sets the motor drive bridge arm to a high-impedance state, and sets the "emergency stop fault" flag. After execution, it returns an execution confirmation frame to the controller. If any step of the verification fails, the frame is immediately discarded, the receive buffer is cleared, and no response is returned to avoid erroneous instructions causing motor malfunction.

[0040] Step S103. Based on the target speed value, execute three proportional-integral closed-loop control algorithms: constant speed, current limiting, and power limiting. Use field-oriented control to precisely control the phase current and rotor angle of the motor, and adjust the motor drive signal to achieve the target speed. During motor operation, the rotor angle, shaft current, and speed are acquired in real time through the field-oriented control algorithm. At the same time, the bus current and voltage are collected and the input power is calculated. The motor control board encapsulates the operating data into feedback data frames, parses the feedback data, displays the motor operating status, and sends new control commands based on the feedback information to achieve real-time control and monitoring.

[0041] Specifically, based on the target speed value, three proportional-integral closed-loop control algorithms—constant speed, current limiting, and power limiting—are executed. A field-oriented control method is used to precisely control the motor's phase current and rotor angle, adjusting the motor drive signal to achieve the target speed. During motor operation, the field-oriented control algorithm acquires the rotor angle, shaft current, and speed in real time, while simultaneously collecting bus current and voltage and calculating the input power. The motor control board encapsulates the operating data into feedback data frames. The controller parses the feedback data and displays the motor's operating status, sending new control commands based on the feedback information to achieve real-time control and monitoring.

[0042] By employing a three-level nested PI closed-loop control structure with priority from high to low, and a unified control cycle of 100μs (10kHz), the system ensures that the motor prioritizes safety under any operating condition, followed by constant speed control. The highest priority loop is the power limiting loop, whose input is the difference between the actual input power and the maximum allowable power. The actual input power is calculated by multiplying the bus voltage by the bus current. The maximum allowable power is set based on the motor's rated power, typically 1.2 times the rated power. When the actual power exceeds the maximum allowable power, the PI regulator outputs a power limiting value, progressively reducing the maximum allowable current of subsequent current loops until the power returns to a safe range. If the overpower exceeds 5 seconds, overpower protection is triggered, shutting down the motor and reporting a fault. The second highest priority is the current-limiting closed loop, whose input is the difference between the actual phase current amplitude and the maximum allowable current limited by the power limit value. The actual phase current amplitude is calculated from the two-phase stationary coordinate system currents Iα and Iβ after Clark transformation, that is, the actual phase current amplitude is equal to the square root of the sum of the squares of Iα and Iβ. When the actual current exceeds the maximum allowable current, the PI regulator outputs the current limit value to limit the quadrature-axis current setpoint iq_ref output by the speed loop to avoid motor overcurrent burnout. If the instantaneous current exceeds twice the rated current, the overcurrent protection is immediately triggered, the machine stops and the fault is reported.

[0043] The basic priority is constant speed closed loop, whose input is the difference between the target speed and the actual speed. The PI regulator outputs the quadrature axis current setpoint iq_ref based on the speed difference. This value is used as the input of the FOC current loop after being subject to dual limits of current limit and power limit. For surface mount permanent magnet synchronous motors, the direct axis current setpoint id_ref is fixed at 0 to achieve maximum torque-to-current ratio control and improve motor efficiency. Based on three-level closed-loop control, field-oriented control technology is used to achieve precise motor drive. At the midpoint of the PWM in each control cycle, the two-phase currents Ia and Ib of the three-phase motor are synchronously sampled by the ADC. The third-phase current Ic = -Ia - Ib is calculated according to Kirchhoff's current law. Then, a Clark transformation is performed to transform the current in the three-phase stationary coordinate system into the current in the two-phase stationary coordinate system, where Iα = Ia and Iβ = (Ia + 2Ib) / √3. Next, a Park transformation is performed based on the estimated rotor electrical angle θ to transform the current in the two-phase stationary coordinate system into the current in the two-phase rotating coordinate system, where Id = Iα × cosθ + Iβ×sinθ, Iq=-Iα×sinθ+Iβ×cosθ; PI regulation is applied to the d-axis and q-axis currents respectively, outputting the voltage setpoints Ud_ref and Uq_ref for the d-axis and q-axis respectively; then, an inverse Park transformation is performed to transform the voltage in the two-phase rotating coordinate system into the voltage in the two-phase stationary coordinate system, where Uα=Ud_ref×cosθ-Uq_ref×sinθ, Uβ=Ud_ref×sinθ+Uq_ref×cosθ; based on Uα and Uβ, the sector and duration of the space vector are calculated, generating six complementary PWM drive signals to control the switching transistors of the three-phase inverter bridge and drive the motor to rotate.

[0044] The sliding mode observer algorithm is used to realize sensorless rotor angle and speed estimation. The electrical angle and mechanical speed of the rotor are estimated in real time based on the sampled phase current and bus voltage. No additional encoder is required, which reduces hardware costs. Its estimation accuracy is ≤ ±1 rpm at rated speed and ≤ ±5 rpm at low speed ≤ 100 rpm, with no obvious jitter.

[0045] During motor operation, all key operating parameters are collected in real time. Three-phase current, rotor angle, and estimated speed are collected at a frequency of 10kHz; bus voltage, bus current, and input power are collected periodically at a frequency of 1kHz; and protection status and operating status are collected at a frequency of 100Hz. The collected analog data is preprocessed using a moving average filtering algorithm with a window size of 8 to suppress high-frequency noise interference and improve data accuracy. The motor control board encapsulates all operating data into feedback data frames in a unified format, uploading them once every 100ms. The upload frequency can be adjusted via host computer commands. The feedback data frame sequentially includes a frame header, slave address, command code 0x90, data length of 20 bytes, 2 bytes of actual speed, 2 bytes of bus voltage, 2 bytes of bus current, 2 bytes of input power, 2 bytes of rotor angle, 6 bytes of three-phase current, 1 byte of protection status, 1 byte of operating status, 2 bytes of CRC16 checksum, and a frame tail.

[0046] After receiving the feedback frame, the controller verifies and parses it, displays all parameters in real time on the human-machine interface, and establishes an operation data log to record the historical operating status of the motor for easy fault diagnosis. The controller can also make intelligent decisions based on the feedback data. For example, when the motor temperature is detected to be too high, it will automatically reduce the speed. When a stall is detected, it will first execute the current limiting protection. If the stall lasts for 3 seconds, it will stop the machine and report the fault. At the same time, the controller dynamically adjusts the target speed command according to the actual speed and operating status feedback, realizing real-time closed-loop control and adaptive adjustment of the motor speed.

[0047] When a motor experiences a stall condition, the system first determines the stall state by detecting whether the phase current amplitude continuously exceeds 1.5 times the rated current and the speed is below 50 rpm. Upon determination, the current-limiting closed loop is immediately triggered, limiting the maximum allowable current to 1.2 times the rated current and simultaneously reducing the target speed. If the stall condition persists after 3 seconds of current-limiting protection, the motor drive is immediately cut off, triggering stall protection and reporting a fault. After the fault is resolved, the system is reset via a command from the host computer. When the motor experiences a sudden load change, the constant speed closed loop quickly responds to the speed difference, increasing the quadrature-axis current setpoint to enhance output torque. Simultaneously, the current-limiting and power-limiting closed loops monitor the current and power in real time to ensure they do not exceed safety thresholds. Once the load returns to normal, the system automatically and smoothly transitions to the original target speed, avoiding significant speed fluctuations. When the motor experiences a communication interruption, the motor control board immediately enters a safe stop mode, cuts off the motor drive, and waits for the controller to re-initiate the handshake connection. After the controller detects the communication interruption, it triggers a "communication abnormality" alarm and automatically initiates a handshake request every second. When the communication link is restored, it automatically re-establishes the connection and resumes motor control without manual intervention.

[0048] In some embodiments, the initialization configuration of the serial communication parameters of the universal asynchronous transceiver (UART) to complete the initialization of the communication interface includes: uniformly configuring the serial communication parameters of the controller and the motor control board respectively. The configuration content includes the communication transmission rate, data bit length, number of stop bits, and data verification method. After the configuration is completed, the serial communication interfaces of the controller and the motor control board are started respectively.

[0049] First, the hardware registers of the corresponding UART peripherals are configured using the controller and motor control board. The specified GPIO pins are configured for UART function mode, with the TX pin set to push-pull output mode and an output speed of 50MHz; the RX pin is set to floating input mode to avoid external level interference. Simultaneously, the bus clock of the UART peripherals is enabled, the UART receive interrupt is enabled, and the corresponding channel of DMA1 is prioritized as the UART receive channel. DMA is set to cyclic receive mode, allowing serial data to be automatically transferred directly to the memory receive buffer without CPU intervention.

[0050] After the hardware configuration is completed, the upper and lower computers are configured with communication parameters in a unified manner. The standard configuration for low-voltage small motor scenarios is: communication transmission rate of 115200bps, data bit length of 8 bits, number of stop bits of 1 bit, and data verification method of no parity (i.e., 8N1 mode). For industrial scenarios with complex electromagnetic environments, the baud rate can be reduced to 9600bps and even parity can be enabled to improve anti-interference capability.

[0051] Independent serial port transmit and receive buffers are allocated in the memory of the controller and motor control board, respectively. The transmit buffer size is set to 256 bytes and the receive buffer size is set to 512 bytes. The buffers are managed using a circular queue structure, and data enqueue and dequeue operations are implemented through read and write pointers.

[0052] Near the chip pins on the UART_TX and UART_RX lines, a 100Ω surface-mount ferrite bead is connected in series and a 3.3V TVS transient voltage suppressor diode is connected in parallel to suppress electrostatic discharge and surge interference on the lines. When the communication transmission distance is greater than 10m, MAX485 level conversion chips are added at both ends of the controller and motor control board to convert the UART single-ended signal into an RS485 differential signal.

[0053] After all parameters are configured, enable the UART transmitter and receiver of the controller and motor control board respectively, start the serial communication interface, and enter the standby waiting state.

[0054] By unifying the communication hardware and software parameters between the upper and lower level machines, communication failures or data garbled issues caused by parameter mismatches are avoided at the source. The DMA cyclic reception mode directly moves serial port data to the memory buffer, eliminating the need for CPU byte-by-byte processing and reducing CPU utilization to below 5%, significantly improving system real-time performance. Hardware anti-interference preprocessing measures are added to effectively suppress common static electricity and surge interference in industrial environments, reducing the communication error rate by more than an order of magnitude. Support for RS485 differential transmission extension extends the communication distance from 10m to over 1000m, meeting the needs of different application scenarios.

[0055] In some embodiments, the step of sending a communication handshake data frame to the motor control board via a serial port, and the motor control board receiving and returning an acknowledgment response data frame to establish a stable serial communication connection includes: sending a communication handshake data frame to the motor control board at a preset time interval; if no acknowledgment response data frame is received within a preset timeout period, resending the handshake data frame; and triggering a communication error prompt when the number of consecutive resends reaches a preset threshold and no response is received.

[0056] By adopting a unified standard data frame format, the handshake request data frame structure is as follows: frame header (0xAA0x55) + slave address (1 byte) + instruction code (0x01) + data length (0x00) + CRC16 checksum (2 bytes) + frame trailer (0x0D0x0A); where the slave address is used to distinguish multiple motor control boards on the same bus, the address range is 0x01-0xFE, and 0xFF is the broadcast address; the CRC16 uses the standard Modbus protocol's CRC16-IBM algorithm, and the check range is all bytes from the slave address to the data field.

[0057] After the controller starts, it sends handshake request data frames to the specified slave address at preset 1-second intervals; after each transmission, a 500ms timeout timer is started to wait for the motor control board to return an acknowledgment response data frame.

[0058] After receiving the handshake request data frame, the motor control board sequentially performs frame header detection, slave address matching, and CRC16 verification. If all verifications pass, it immediately returns a handshake confirmation data frame, which has the same format as the request frame, with the instruction code 0x81 and a data field containing a 1-byte device status byte (0x00 for standby, 0x01 for running, and 0x02 for fault). If the controller receives a correct confirmation response data frame within a 500ms timeout period, it determines that the serial communication connection has been successfully established and stops sending handshake requests.

[0059] If the controller does not receive an acknowledgment response within the timeout period, or if the received response data frame fails to be verified, it will automatically resend the handshake request data frame. The threshold for the number of consecutive retransmissions is set to 3. If a correct response is not received after 3 consecutive retransmissions, the controller will trigger a "communication connection failed" error message, display the fault information through the human-machine interface, and enter standby mode. At the same time, if the motor control board does not receive any valid data frames from the controller within 10 seconds, it will automatically enter the safety stop mode and cut off the motor drive power.

[0060] By adopting a "request-response" two-way handshake mechanism, the identities of both communicating parties are matched and the link is unobstructed, avoiding the unreliability of one-way communication. The timeout retransmission mechanism solves the problem of single data transmission failure and improves the success rate of communication connection. A threshold for the number of consecutive retransmissions is set to prevent the controller from getting stuck in an infinite retransmission loop. An timeout safety shutdown mechanism for the motor control board is added, which automatically cuts off the motor drive when communication is interrupted to prevent the motor from going out of control and causing equipment accidents.

[0061] In some embodiments, generating a motor speed setting command according to the device's operating requirements and sending it to the motor control board via a serial port includes: combining the target speed value with a preset command identifier and data verification information in a fixed order to form a complete speed setting command data frame, and sending the data frame to the motor control board according to the configured serial communication parameters.

[0062] By establishing a standardized control command system, all commands adopt the same general data frame format as the handshake frame. The core commands include: speed setting command (command code 0x03), motor start / stop command (command code 0x04), emergency stop command (command code 0x05), parameter read command (command code 0x06), and parameter write command (command code 0x07). The data field of the speed setting command contains a 2-byte target speed parameter in rpm, with a value range of 0-65535.

[0063] The command priorities are defined from highest to lowest as follows: emergency stop command > fault protection command > motor start / stop command > speed setting command > parameter read / write command; higher priority commands can immediately interrupt the execution of lower priority commands. All numerical parameters are encoded and transmitted in little-endian mode, i.e., the least significant byte comes first, followed by the most significant byte.

[0064] After the controller generates the target speed value according to the equipment's operating requirements, it combines it with the preset instruction identifier (instruction code 0x03), slave address, data length, and CRC16 check information in a fixed order to form a complete speed setting instruction data frame. Before sending, it first checks whether the serial port transmission buffer is empty. If it is not empty, it waits for the previous frame of data to be sent. Then, it writes the encapsulated data frame into the serial port transmission buffer and starts the DMA transmission channel to automatically complete the data transmission.

[0065] After the command is sent, a 300ms timeout timer is started to wait for the motor control board to return an execution confirmation frame. The command code of the execution confirmation frame is the original command code plus 0x80. If a correct confirmation frame is received within the timeout period, the command is considered to have been sent successfully. If no confirmation frame is received or an incorrect frame is received within the timeout period, the command is automatically retransmitted, up to 2 times. After 2 consecutive retransmission failures, a "command execution failure" fault is reported, and a heartbeat detection process is triggered to check the communication link status.

[0066] By adopting a unified instruction format, the consistency of parsing logic is ensured, reducing the complexity of software implementation; a clear instruction priority is defined to ensure that urgent instructions are executed first, improving system security; little-endian encoding is adopted, which is consistent with the byte order of mainstream 32-bit microcontrollers, eliminating the need for additional byte conversion operations; and an instruction execution confirmation and retransmission mechanism is added to ensure that control instructions can be accurately received and executed by the motor control board.

[0067] In some embodiments, the motor control board receives data frames via a serial port, sequentially performs frame header and tail detection, data integrity verification, and parses the instruction code and target speed parameters and writes them into the control register. This includes: the motor control board first detects the start and end identifiers of the received data; if the identifiers match, it performs integrity verification on the intermediate data; if the verification passes, it parses the control instruction and target speed parameters and writes them into the motor control register; if the verification fails, it discards the corresponding data frame and generates a retransmission request.

[0068] The motor control board writes serial port data into the circular receive buffer via UART receive interrupt or DMA interrupt; the background parsing thread continuously scans the receive buffer, checking the frame header sequence 0xAA0x55 byte by byte; when two consecutive bytes of 0xAA and 0x55 are detected, it is marked as the start of the frame, and the reception of the complete data frame begins.

[0069] The total length of the complete data frame is calculated based on the third byte after the frame header (data length field). The calculation formula is: total length = 2-byte frame header + 1-byte slave address + 1-byte instruction code + 1-byte data length + N-byte data field + 2-byte CRC16 checksum + 2-byte frame tail. After the data length accumulated in the receive buffer reaches the calculated total length, the complete data frame is extracted for subsequent verification.

[0070] The following three checks are performed sequentially: frame end check, which checks whether the last two bytes of the data frame are 0x0D0x0A; CRC16 check, which calculates the CRC16 value of all bytes from the slave address to the data field and compares it with the CRC16 checksum carried in the data frame; and address check, which checks whether the slave address in the data frame is consistent with the locally set address or whether it is the broadcast address 0xFF.

[0071] If all checks pass, the instruction code and data field parameters in the data frame are extracted, and the corresponding instruction execution function is jumped to according to the instruction code. For the speed setting instruction, the parsed target speed value is written into the "speed setting register" inside the motor control board. The value of this register will be read in real time by the subsequent control algorithm at a frequency of 10kHz. For the emergency stop instruction, all PWM output channels are immediately shut down, the motor drive bridge arm is set to a high impedance state, and the "emergency stop fault" flag is set at the same time.

[0072] If any verification fails, the data frame is immediately discarded, the receive buffer is cleared, and no response is returned. At the same time, if five consecutive data frames with verification failures are received, a "communication data error" alarm is triggered, and a fault feedback frame is sent to the controller.

[0073] The system employs a three-layer verification mechanism—frame header and tail detection, CRC16 checksum, and address checksum—to ensure the legitimacy of instructions and effectively prevent motor malfunction caused by erroneous instructions. A circular buffer is used to receive data, avoiding data overflow and loss. Register mapping is used to execute instructions, improving the speed and efficiency of instruction execution. A continuous error frame detection mechanism is added to promptly detect and report communication link anomalies.

[0074] In some embodiments, the step of executing three proportional-integral closed-loop control algorithms—constant speed, current limiting, and power limiting—based on the target speed value, and using a field-oriented control method to precisely control the phase current and rotor angle of the motor, and adjusting the motor drive signal to achieve the target speed, includes: using constant speed closed-loop control as the basic control loop, and treating current limiting closed-loop control and power limiting closed-loop control as higher priority protection loops. When the current or power is detected to exceed a preset threshold, current limiting or power limiting control is executed first, and constant speed control is switched back after the parameters recover to a safe range.

[0075] By setting the control cycles of the constant speed closed loop, the current limiting closed loop, and the power limiting closed loop to a uniform 100μs (i.e., 10kHz), it is ensured that the three closed loops can be executed synchronously.

[0076] The priorities of the three closed loops are defined from high to low as follows: power limiting closed loop > current limiting closed loop > constant speed closed loop; the output of the high priority closed loop will be used as the input limiting value of the low priority closed loop.

[0077] The input to the power limiting closed loop is the difference between the actual input power and the maximum allowable power, where the actual input power = real-time collected bus voltage × real-time collected bus current, and the maximum allowable power is set to 1.2 times the rated power of the motor. When the actual input power exceeds the maximum allowable power, the power limiting PI regulator outputs a power limiting value, gradually reducing the maximum allowable current value of the subsequent current limiting closed loop until the actual input power returns to a safe range. If the overpower condition lasts for more than 5 seconds, the overpower protection is immediately triggered, the motor drive is cut off, the "overpower fault" flag is set, and the fault information is reported to the controller.

[0078] The input to the current-limiting closed loop is the difference between the actual phase current amplitude and the maximum allowable current limited by the power limit value, where the actual phase current amplitude = √(Iα² + Iβ²), and Iα and Iβ are the two-phase stationary coordinate system currents after Clark transformation. When the actual phase current amplitude exceeds the maximum allowable current, the current-limiting PI regulator outputs the current limit value, limiting the quadrature-axis current setpoint iq_ref output by the constant speed closed loop. If the instantaneous phase current amplitude exceeds twice the rated current of the motor, the overcurrent protection is immediately triggered, the motor drive is cut off, the "overcurrent fault" flag is set, and the fault information is reported to the controller.

[0079] The input to the constant speed closed loop is the difference between the target speed and the actual estimated speed. The constant speed PI controller outputs the quadrature axis current setpoint iq_ref based on the speed difference. This value is first limited by the current limit value, then by the power limit value, and finally used as the input to the FOC current loop. For surface mount permanent magnet synchronous motors, the direct axis current setpoint id_ref is fixed to 0 to achieve maximum torque-to-current ratio control.

[0080] By adopting a three-level nested closed-loop control structure with "safety first", the system ensures that the motor prioritizes operational safety under any operating condition, fundamentally solving the problem of the lack of dual protection mechanisms in existing technologies. The unified control cycle avoids control timing chaos and improves system stability. It achieves dual protection of current and power, effectively preventing overcurrent and overpower burnout accidents caused by abnormal operating conditions such as stalled rotor and sudden load changes. The use of maximum torque-to-current ratio control improves the motor's operating efficiency and reduces energy consumption.

[0081] In some embodiments, during the operation of the motor, the rotor angle, shaft current and speed are obtained in real time through a field-oriented control algorithm, and the bus current and voltage are collected and the input power is calculated. This includes: collecting motor operation data at a preset fixed sampling frequency, performing moving average filtering on the collected raw data to remove noise interference, and then calculating the accurate input power value.

[0082] Different sampling frequencies are set according to the importance and rate of change of different data: high-speed real-time sampling (10kHz): motor three-phase current, rotor electrical angle, estimated mechanical speed, synchronized with FOC control cycle; medium-speed periodic sampling (1kHz): bus voltage, bus current, input power; low-speed status sampling (100Hz): motor protection status, operating status, driver chip temperature.

[0083] For three-phase current and bus voltage, ADC synchronous sampling technology is adopted, and ADC conversion is triggered at the midpoint of each PWM cycle to ensure that the sampling time is staggered from PWM switching noise; through the multi-channel scanning mode of ADC, multiple analog quantities are acquired in one conversion.

[0084] All collected analog raw data are preprocessed using a moving average filtering algorithm with a filter window size of 8. That is, each time new data is collected, it is added to a moving window of length 8, and the average value of all data in the window is calculated as the effective data after filtering.

[0085] The real-time input power is calculated using the filtered bus voltage and bus current values. The calculation formula is: Input power (W) = Bus voltage (V) × Bus current (A); the calculation result is rounded to one decimal place.

[0086] A data cache area is allocated in the memory of the motor control board to cache all the running data of the last 10 seconds for backtracking analysis when a fault occurs.

[0087] The system employs a graded sampling frequency, which reduces the computational burden while ensuring real-time data performance. The use of PWM midpoint synchronous sampling technology effectively avoids the impact of PWM switching noise on sampling accuracy. The use of a moving average filtering algorithm effectively suppresses high-frequency noise interference, reducing data fluctuation amplitude to less than 10% of the original data. A fault data caching function has been added to facilitate cause analysis and troubleshooting after a fault occurs.

[0088] In some embodiments, the motor control board encapsulates the operating data into feedback data frames, parses the feedback data and displays the motor operating status, and sends new control commands based on the feedback information to achieve real-time control and monitoring. This includes: the motor control board encapsulates the motor protection status, current speed, operating current, input power and fault code into feedback data frames and sends them to the controller. The controller parses the data and displays it in real time, and triggers a corresponding audible and visual alarm when a fault code is detected.

[0089] By defining a unified operating status feedback data frame format, the structure is as follows: frame header (0xAA0x55) + slave address (1 byte) + instruction code (0x90) + data length (20 bytes) + actual speed (2 bytes) + bus voltage (2 bytes) + bus current (2 bytes) + input power (2 bytes) + rotor angle (2 bytes) + three-phase current (6 bytes) + protection status (1 byte) + operating status (1 byte) + CRC16 check (2 bytes) + frame tail (0x0D0x0A); where each bit of the protection status byte corresponds to a fault type.

[0090] The motor control board sends a running status feedback data frame to the controller every 100ms by default; the controller can adjust the feedback frequency to any value between 10ms and 1s by sending parameter modification commands.

[0091] After receiving the feedback data frame, the controller first performs frame header, frame tail and CRC16 verification; after the verification is successful, all operating parameters are parsed and displayed on the human-machine interface in real time, including both numerical display and curve display; at the same time, an operating data log file is created and all historical data is stored in local memory.

[0092] The controller parses the protection status bytes in the feedback data frame. If any fault bit is detected to be set, it immediately triggers the corresponding audible and visual alarm and displays the specific fault type and occurrence time on the human-machine interface.

[0093] The controller dynamically adjusts the target speed command based on the actual speed value feedback, realizing remote real-time closed-loop control of the motor speed; at the same time, it makes intelligent decisions based on the feedback operating status data, such as automatically reducing the motor speed when the temperature of the drive chip exceeds 85°C.

[0094] The feedback data frame contains all the key parameters of motor operation, solving the problem of insufficient status monitoring capabilities in existing technologies and enabling the host computer to fully grasp the health status of the motor; the adjustable feedback frequency can meet the monitoring needs of different scenarios; the added operation data log function facilitates subsequent performance analysis and fault diagnosis; and it realizes intelligent decision-making based on the operation status, further improving the safety and reliability of the system.

[0095] In some embodiments, the method further includes: collecting speed fluctuation data and load change data during continuous operation of the motor through the motor control board, establishing a correlation model between speed and load, and when a sudden change in load is detected, pre-adjusting the motor drive signal in advance according to the correlation model to compensate for the speed deviation caused by the sudden change in load.

[0096] During normal operation, the motor control board continuously collects speed fluctuation data and load change data during continuous operation. The load change data is indirectly reflected by the phase current amplitude. A set of data is recorded every 10ms, including the current speed, speed change rate, phase current amplitude, and phase current change rate. The data is stored in local non-volatile memory.

[0097] Based on the collected historical data, a speed-load correlation model is established using a linear regression algorithm. The model inputs are the phase current change rate and the current load level, and the model output is the amount of quadrature-axis current compensation that needs to be applied in advance. The model parameters can be optimized through offline training or online self-learning.

[0098] The rate of change of phase current is calculated in real time. When the absolute value of the rate of change of phase current exceeds a preset threshold (e.g., 50% of the rated current / 10ms), it is determined that a load change has occurred.

[0099] When a sudden load change is detected, the corresponding quadrature axis current compensation is immediately calculated based on the speed-load correlation model and superimposed on the iq_ref of the constant speed closed-loop output to pre-adjust the motor drive signal in advance.

[0100] After the pre-adjustment is executed, the constant speed closed loop continues to work normally, gradually adjusting the speed back to the target value, achieving a smooth transition after a sudden load change.

[0101] By predicting load changes in advance and making pre-adjustments, the speed fluctuation caused by sudden load changes can be reduced compared to traditional closed-loop speed response. The model parameters are optimized through online self-learning, and the prediction accuracy of the model will continue to improve with the increase of running time. No additional hardware sensors are required, and it can be achieved solely through software algorithms, thus reducing system costs. The dynamic response performance of the system is improved, enabling the motor to maintain stable speed during sudden load changes.

[0102] In some embodiments, the method further includes: statistically analyzing the motor's running time, cumulative number of runs, and frequency of various abnormalities; establishing a motor health status assessment model; generating graded early warning information based on the assessment results; and automatically performing deceleration and shutdown operations when the health status is below a preset threshold.

[0103] The motor control board has a built-in non-volatile memory that continuously tracks the motor's cumulative running time, cumulative number of starts, frequency and duration of various abnormalities. All statistical data will not be lost after the motor is powered off and will be automatically loaded each time it is powered on.

[0104] A weighted scoring method was used to establish a motor health status assessment model, with a total score of 100 points. The cumulative running time accounted for 30 points, the cumulative number of starts accounted for 20 points, and the frequency of abnormal occurrences accounted for 50 points. For example, if the rated service life of the motor is 10,000 hours, 0.3 points are deducted for every 100 hours of operation; 5 points are deducted for each overcurrent fault and 10 points are deducted for each stall fault.

[0105] Based on the health status assessment score, the motor health status is divided into three levels: normal status (score ≥ 80 points), the motor is running normally and no special treatment is required; warning status (score ≤ 60 points < 80 points), a yellow warning is triggered and the controller displays the message "motor needs maintenance"; danger status (score < 60 points), a red warning is triggered and the controller displays the message "motor is about to be damaged" and automatically performs a deceleration and shutdown operation.

[0106] All health status assessment results and early warning information will be uploaded to the controller via UART communication. The controller can then further upload them to the cloud server to achieve remote equipment health management and predictive maintenance.

[0107] When the motor is maintained or replaced, a special command can be sent through the controller to reset all statistical data and health status assessment results on the motor control board.

[0108] Through statistical analysis of long-term operating data, early warning of motor failures is achieved, transforming passive maintenance into proactive maintenance and extending the service life of the motor. The adoption of a graded early warning mechanism enables different response measures to be taken according to the health status of the motor, avoiding equipment accidents and economic losses caused by sudden motor damage. Remote health management is supported, facilitating centralized management and maintenance of a large number of devices. The data reset function facilitates motor maintenance and replacement.

[0109] In some embodiments, such as Figure 2 As shown, this embodiment provides a UART interface hardware protection circuit for the aforementioned low-voltage small motor speed monitoring method based on UART communication. Specifically, the UART interface hardware protection circuit includes a 4-pin UART connector J1, a first bidirectional transient suppression diode D1, a second bidirectional transient suppression diode D2, a third bidirectional transient suppression diode D3, a first current-limiting resistor R1, a second current-limiting resistor R2, and a power supply filter capacitor C4. Pin 1 of the 4-pin UART connector J1 is a power supply pin, connected to the system power supply VDD; pin 2 is a UART transmit pin (TX), connected to the UART_TX pin of the controller or motor control board; pin 3 is a UART receive pin (RX), connected to the UART_RX pin of the controller or motor control board; and pin 4 is a ground pin, connected to the system ground GND.

[0110] One end of the first bidirectional transient suppression diode D1 is connected to pin 1 of the 4-pin UART connector J1, and the other end is connected to system ground GND. The power supply filter capacitor C4 is connected in parallel with the first bidirectional transient suppression diode D1, that is, one end of the power supply filter capacitor C4 is connected to pin 1 of the 4-pin UART connector J1, and the other end is connected to system ground GND. The first current-limiting resistor R1 is connected in series between pin 2 of the 4-pin UART connector J1 and the UART_TX pin of the controller or motor control board. One end of the third bidirectional transient suppression diode D3 is connected to the end of the first current-limiting resistor R1 near the UART_TX pin, and the other end is connected to system ground GND. The second current-limiting resistor R2 is connected in series between pin 3 of the 4-pin UART connector J1 and the UART_RX pin of the controller or motor control board. One end of the second bidirectional transient suppression diode D2 is connected to the end of the second current-limiting resistor R2 near the UART_RX pin, and the other end is connected to system ground GND.

[0111] The specific parameters and selection of each component are as follows: The 4-pin UART connector J1 adopts a through-hole or surface-mount pin header connector with a pitch of 2.54mm, suitable for the standard interface design of low-voltage small motor control boards; the first bidirectional transient suppression diode D1, the second bidirectional transient suppression diode D2, and the third bidirectional transient suppression diode D3 are all SMBJ series surface-mount bidirectional TVS diodes. When the system power supply VDD is 3.3V, the selected type is SMBJ3.3CA, with a reverse cutoff voltage of 3.3V. The breakdown voltage is 5.8V, and the peak pulse power is 600W. When the system power supply VDD is 5V, the selected type is SMBJ5.0CA, which has a reverse cutoff voltage of 5.0V, a breakdown voltage of 6.4V, and a peak pulse power of 600W. The first current-limiting resistor R1 and the second current-limiting resistor R2 are both surface-mount carbon film resistors in 0402 packages with a resistance of 100Ω and an accuracy of ±5%. The power supply filter capacitor C4 is a multilayer ceramic capacitor in 0402 packages with a capacitance of 100nF and a withstand voltage of 16V.

[0112] When the UART interface is subjected to electrostatic discharge, surge voltage, or other overvoltage interference, the corresponding bidirectional transient suppression diode will break down and conduct within nanoseconds, rapidly dissipating the interference energy to system ground (GND) and clamping the interface voltage within a safe range, preventing overvoltage damage to the microcontroller's UART pins. Simultaneously, the current-limiting resistors R1 and R2 connected in series on the signal lines limit the current flowing through the bidirectional transient suppression diode, preventing it from burning out due to overcurrent and further attenuating interference signals. The power supply filter capacitor C4 on the power supply line filters out high-frequency noise interference, ensuring power supply voltage stability and improving the anti-interference capability of UART communication.

[0113] By employing a combined protection structure of "current-limiting resistor + bidirectional TVS diode", both overvoltage and overcurrent protection are achieved simultaneously, effectively resisting ±15kV air electrostatic discharge and ±8kV contact electrostatic discharge, meeting relevant requirements. A TVS diode and filter capacitor are simultaneously installed at the power supply end, suppressing surge interference on the power line and filtering out high-frequency noise, significantly improving power supply stability. All components are surface-mount packaged, resulting in small size and low cost, eliminating the need for additional PCB area and facilitating integration into the motor control board and controller. The circuit structure is simple and highly reliable, operating automatically without any software configuration, and is fully compatible with the aforementioned UART communication protocol and control method, significantly improving the hardware reliability and communication stability of the entire motor speed monitoring system.

[0114] Please see Figure 3 As shown, Figure 3 This is a schematic diagram of the structure of a low-voltage small motor speed monitoring system 200 based on UART communication provided in this application embodiment. The low-voltage small motor speed monitoring system 200 based on UART communication is used to execute the steps of the low-voltage small motor speed monitoring method based on UART communication shown in the above embodiments. The low-voltage small motor speed monitoring system 200 based on UART communication can be a single server or a server cluster, or it can be a terminal, such as a handheld terminal, laptop computer, wearable device, or robot.

[0115] like Figure 3 As shown, the low-voltage small motor speed monitoring system 200 based on UART communication includes: The initial configuration unit 201 is used to initialize the serial communication parameters of the general asynchronous transceiver and complete the initialization of the communication interface; it sends a communication handshake data frame to the motor control board through the serial port, and the motor control board receives and returns an acknowledgment response data frame to establish a stable serial communication connection. The parameter writing unit 202 is used to generate a motor speed setting command according to the equipment operation requirements and send it to the motor control board through the serial port. The motor control board receives the data frame through the serial port, performs frame header and frame tail detection and data integrity verification in sequence, parses the command code and target speed parameters and writes them into the control register. The power calculation unit 203 is used to execute three proportional-integral closed-loop control algorithms—constant speed, current limiting, and power limiting—based on the target speed value. It employs a field-oriented control method to precisely control the phase current and rotor angle of the motor and adjusts the motor drive signal to achieve the target speed. During motor operation, the rotor angle, shaft current, and speed are acquired in real time through the field-oriented control algorithm. Simultaneously, the bus current and voltage are collected, and the input power is calculated. The motor control board encapsulates the operating data into feedback data frames, parses the feedback data, displays the motor operating status, and sends new control commands based on the feedback information to achieve real-time control and monitoring.

[0116] In some embodiments, the initialization configuration of the serial communication parameters of the universal asynchronous transceiver (UART) to complete the initialization of the communication interface includes: uniformly configuring the serial communication parameters of the controller and the motor control board respectively. The configuration content includes the communication transmission rate, data bit length, number of stop bits, and data verification method. After the configuration is completed, the serial communication interfaces of the controller and the motor control board are started respectively.

[0117] In some embodiments, the step of sending a communication handshake data frame to the motor control board via a serial port, and the motor control board receiving and returning an acknowledgment response data frame to establish a stable serial communication connection includes: sending a communication handshake data frame to the motor control board at a preset time interval; if no acknowledgment response data frame is received within a preset timeout period, resending the handshake data frame; and triggering a communication error prompt when the number of consecutive resends reaches a preset threshold and no response is received.

[0118] In some embodiments, generating a motor speed setting command according to the device's operating requirements and sending it to the motor control board via a serial port includes: combining the target speed value with a preset command identifier and data verification information in a fixed order to form a complete speed setting command data frame, and sending the data frame to the motor control board according to the configured serial communication parameters.

[0119] In some embodiments, the motor control board receives data frames via a serial port, sequentially performs frame header and tail detection, data integrity verification, and parses the instruction code and target speed parameters and writes them into the control register. This includes: the motor control board first detects the start and end identifiers of the received data; if the identifiers match, it performs integrity verification on the intermediate data; if the verification passes, it parses the control instruction and target speed parameters and writes them into the motor control register; if the verification fails, it discards the corresponding data frame and generates a retransmission request.

[0120] In some embodiments, the step of executing three proportional-integral closed-loop control algorithms—constant speed, current limiting, and power limiting—based on the target speed value, and using a field-oriented control method to precisely control the phase current and rotor angle of the motor, and adjusting the motor drive signal to achieve the target speed, includes: using constant speed closed-loop control as the basic control loop, and treating current limiting closed-loop control and power limiting closed-loop control as higher priority protection loops. When the current or power is detected to exceed a preset threshold, current limiting or power limiting control is executed first, and constant speed control is switched back after the parameters recover to a safe range.

[0121] In some embodiments, during the operation of the motor, the rotor angle, shaft current and speed are obtained in real time through a field-oriented control algorithm, and the bus current and voltage are collected and the input power is calculated. This includes: collecting motor operation data at a preset fixed sampling frequency, performing moving average filtering on the collected raw data to remove noise interference, and then calculating the accurate input power value.

[0122] In some embodiments, the motor control board encapsulates the operating data into feedback data frames, parses the feedback data and displays the motor operating status, and sends new control commands based on the feedback information to achieve real-time control and monitoring. This includes: the motor control board encapsulates the motor protection status, current speed, operating current, input power and fault code into feedback data frames and sends them to the controller. The controller parses the data and displays it in real time, and triggers a corresponding audible and visual alarm when a fault code is detected.

[0123] In some embodiments, the method further includes: collecting speed fluctuation data and load change data during continuous operation of the motor through the motor control board, establishing a correlation model between speed and load, and when a sudden change in load is detected, pre-adjusting the motor drive signal in advance according to the correlation model to compensate for the speed deviation caused by the sudden change in load.

[0124] In some embodiments, the method further includes: statistically analyzing the motor's running time, cumulative number of runs, and frequency of various abnormalities; establishing a motor health status assessment model; generating graded early warning information based on the assessment results; and automatically performing deceleration and shutdown operations when the health status is below a preset threshold.

[0125] It should be noted that those skilled in the art will understand that, for the sake of convenience and brevity, the specific working process of the UART-based low-voltage small motor speed monitoring system and its modules described above can be found in the corresponding contents of the various embodiments of the UART-based low-voltage small motor speed monitoring method, and will not be repeated here.

[0126] The aforementioned method for monitoring the speed of low-voltage small motors based on UART communication can be implemented as a computer program, which can be used in various ways, such as... Figure 3 It runs on the device shown.

[0127] Please see Figure 4 , Figure 4 This is a schematic block diagram of the controller provided in an embodiment of this application. The controller includes a processor, a memory, and a network interface connected via a device bus, wherein the memory may include a storage medium and internal memory.

[0128] The storage medium can store operating devices and computer programs. The computer program includes program instructions that, when executed, cause the processor to perform any method for monitoring the speed of a low-voltage small motor based on UART communication.

[0129] The processor provides computing and control capabilities to support the operation of the entire controller.

[0130] The internal memory provides an environment for the execution of computer programs in non-volatile storage media. When the computer program is executed by the processor, it enables the processor to execute any method for monitoring the speed of a low-voltage small motor based on UART communication.

[0131] This network interface is used for network communication, such as sending assigned tasks. Those skilled in the art will understand that... Figure 4 The structure shown is merely a block diagram of a portion of the structure related to the present application and does not constitute a limitation on the terminal to which the present application is applied. The specific controller may include more or fewer components than those shown in the figure, or combine certain components, or have different component arrangements.

[0132] It should be understood that the processor can be a Central Processing Unit (CPU), but it can also be other general-purpose processors, digital signal processors (DSPs), application-specific integrated circuits (ASICs), field-programmable gate arrays (FPGAs), or other programmable logic devices, discrete gate or transistor logic devices, discrete hardware components, etc. Among these, a general-purpose processor can be a microprocessor or any conventional processor.

[0133] In one embodiment, the processor is configured to run a computer program stored in memory to perform the following steps: Initialize and configure the serial communication parameters of the general asynchronous transceiver to complete the communication interface initialization; send a communication handshake data frame to the motor control board through the serial port, and the motor control board receives and returns an acknowledgment response data frame to establish a stable serial communication connection. Based on the equipment's operational requirements, a motor speed setting command is generated and sent to the motor control board via a serial port. The motor control board receives the data frame via the serial port, performs frame header and tail detection and data integrity verification in sequence, parses the command code and target speed parameters, and writes them into the control register. Based on the target speed, three proportional-integral closed-loop control algorithms—constant speed, current-limiting, and power-limiting—are executed. A field-oriented control method is used to precisely control the motor's phase current and rotor angle, adjusting the motor drive signal to achieve the target speed. During motor operation, the rotor angle, shaft current, and speed are acquired in real-time through the field-oriented control algorithm. Simultaneously, bus current and voltage are collected, and input power is calculated. The motor control board encapsulates the operating data into feedback data frames, parses the feedback data, displays the motor's operating status, and sends new control commands based on the feedback information, achieving real-time control and monitoring.

[0134] In some embodiments, the initialization configuration of the serial communication parameters of the universal asynchronous transceiver (UART) to complete the initialization of the communication interface includes: uniformly configuring the serial communication parameters of the controller and the motor control board respectively. The configuration content includes the communication transmission rate, data bit length, number of stop bits, and data verification method. After the configuration is completed, the serial communication interfaces of the controller and the motor control board are started respectively.

[0135] In some embodiments, the step of sending a communication handshake data frame to the motor control board via a serial port, and the motor control board receiving and returning an acknowledgment response data frame to establish a stable serial communication connection includes: sending a communication handshake data frame to the motor control board at a preset time interval; if no acknowledgment response data frame is received within a preset timeout period, resending the handshake data frame; and triggering a communication error prompt when the number of consecutive resends reaches a preset threshold and no response is received.

[0136] In some embodiments, generating a motor speed setting command according to the device's operating requirements and sending it to the motor control board via a serial port includes: combining the target speed value with a preset command identifier and data verification information in a fixed order to form a complete speed setting command data frame, and sending the data frame to the motor control board according to the configured serial communication parameters.

[0137] In some embodiments, the motor control board receives data frames via a serial port, sequentially performs frame header and tail detection, data integrity verification, and parses the instruction code and target speed parameters and writes them into the control register. This includes: the motor control board first detects the start and end identifiers of the received data; if the identifiers match, it performs integrity verification on the intermediate data; if the verification passes, it parses the control instruction and target speed parameters and writes them into the motor control register; if the verification fails, it discards the corresponding data frame and generates a retransmission request.

[0138] In some embodiments, the step of executing three proportional-integral closed-loop control algorithms—constant speed, current limiting, and power limiting—based on the target speed value, and using a field-oriented control method to precisely control the phase current and rotor angle of the motor, and adjusting the motor drive signal to achieve the target speed, includes: using constant speed closed-loop control as the basic control loop, and treating current limiting closed-loop control and power limiting closed-loop control as higher priority protection loops. When the current or power is detected to exceed a preset threshold, current limiting or power limiting control is executed first, and constant speed control is switched back after the parameters recover to a safe range.

[0139] In some embodiments, during the operation of the motor, the rotor angle, shaft current and speed are obtained in real time through a field-oriented control algorithm, and the bus current and voltage are collected and the input power is calculated. This includes: collecting motor operation data at a preset fixed sampling frequency, performing moving average filtering on the collected raw data to remove noise interference, and then calculating the accurate input power value.

[0140] In some embodiments, the motor control board encapsulates the operating data into feedback data frames, parses the feedback data and displays the motor operating status, and sends new control commands based on the feedback information to achieve real-time control and monitoring. This includes: the motor control board encapsulates the motor protection status, current speed, operating current, input power and fault code into feedback data frames and sends them to the controller. The controller parses the data and displays it in real time, and triggers a corresponding audible and visual alarm when a fault code is detected.

[0141] In some embodiments, the method further includes: collecting speed fluctuation data and load change data during continuous operation of the motor through the motor control board, establishing a correlation model between speed and load, and when a sudden change in load is detected, pre-adjusting the motor drive signal in advance according to the correlation model to compensate for the speed deviation caused by the sudden change in load.

[0142] In some embodiments, the method further includes: statistically analyzing the motor's running time, cumulative number of runs, and frequency of various abnormalities; establishing a motor health status assessment model; generating graded early warning information based on the assessment results; and automatically performing deceleration and shutdown operations when the health status is below a preset threshold.

[0143] This application also provides a computer-readable storage medium storing a computer program that, when executed by a processor, causes the processor to implement the steps of the low-voltage small motor speed monitoring method based on UART communication provided in any embodiment of this application.

[0144] The computer-readable storage medium may be an internal storage unit of the controller as described in the foregoing embodiments, such as the hard disk or memory of the controller. Alternatively, the computer-readable storage medium may be an external storage device of the controller, such as a plug-in hard disk, Smart Media Card (SMC), Secure Digital (SD) card, or Flash Card.

[0145] The above description is merely a specific embodiment of this application, but the scope of protection of this application is not limited thereto. Any person skilled in the art can easily conceive of various equivalent modifications or substitutions within the technical scope disclosed in this application, and these modifications or substitutions should all be covered within the scope of protection of this application. Therefore, the scope of protection of this application should be determined by the scope of the claims.

Claims

1. A method for monitoring the speed of a low-voltage small motor based on UART communication, characterized in that, Applied to controllers; include: Initialize and configure the serial communication parameters of the general asynchronous transceiver to complete the communication interface initialization; send a communication handshake data frame to the motor control board through the serial port, and the motor control board receives and returns an acknowledgment response data frame to establish a stable serial communication connection. Based on the equipment's operational requirements, a motor speed setting command is generated and sent to the motor control board via a serial port. The motor control board receives the data frame via the serial port, performs frame header and tail detection and data integrity verification in sequence, parses the command code and target speed parameters, and writes them into the control register. Based on the target speed, three proportional-integral closed-loop control algorithms—constant speed, current limiting, and power limiting—are executed. A field-oriented control method is used to precisely control the motor's phase current and rotor angle, adjusting the motor drive signal to achieve the target speed. This includes: using constant speed closed-loop control as the base control loop, and prioritizing current limiting and power limiting closed-loop control as higher-priority protection loops. When current or power exceeds a preset threshold, current limiting or power limiting control is executed first, switching back to constant speed control only after the parameters return to a safe range. During motor operation, the rotor angle, shaft current, and speed are acquired in real-time through the field-oriented control algorithm, while bus current and voltage are collected and input power is calculated. The motor control board encapsulates the operating data into feedback data frames, parses the feedback data, displays the motor's operating status, and sends new control commands based on the feedback information, achieving real-time control and monitoring.

2. The method according to claim 1, characterized in that, The initialization configuration of the serial port communication parameters of the universal asynchronous transceiver (GAT) to complete the communication interface initialization includes: Configure the serial communication parameters of the controller and motor control board in a unified manner. The configuration includes the communication transmission rate, data bit length, number of stop bits, and data verification method. After the configuration is completed, start the serial communication interface of the controller and motor control board respectively.

3. The method according to claim 1, characterized in that, The process of sending a communication handshake data frame to the motor control board via the serial port, and the motor control board receiving and returning an acknowledgment response data frame to establish a stable serial communication connection includes: Communication handshake data frames are sent to the motor control board at preset time intervals. If no acknowledgment response data frame is received within the preset timeout period, the handshake data frame is resent. When the number of consecutive resentments reaches the preset threshold and no response is received, a communication error prompt is triggered.

4. The method according to claim 1, characterized in that, The step of generating a motor speed setting command based on equipment operating requirements and sending it to the motor control board via a serial port includes: The target speed value is combined with the preset command identifier and data verification information in a fixed order to form a complete speed setting command data frame, and the data frame is sent to the motor control board according to the configured serial communication parameters.

5. The method according to claim 1, characterized in that, The motor control board receives data frames via a serial port, sequentially performs frame header and tail detection, data integrity verification, parses the data to obtain the instruction code and target speed parameters, and writes them into the control register, including: The motor control board first detects the start and end identifiers of the received data. If the identifiers match, it performs integrity verification on the intermediate data. If the verification passes, it parses out the control command and target speed parameters and writes them into the motor control register. If the verification fails, it discards the corresponding data frame and generates a retransmission request.

6. The method according to claim 1, characterized in that, During the operation of the motor, the rotor angle, shaft current, and speed are acquired in real time through a field-oriented control algorithm. Simultaneously, the bus current and voltage are collected, and the input power is calculated, including: Motor operation data is collected at a preset fixed sampling frequency. The collected raw data is then processed by moving average filtering to remove noise interference before the accurate input power value is calculated.

7. The method according to claim 1, characterized in that, The process involves encapsulating the operating data into feedback data frames via the motor control board, parsing the feedback data and displaying the motor's operating status, and sending new control commands based on the feedback information to achieve real-time control and monitoring, including: The motor control board encapsulates the motor protection status, current speed, operating current, input power, and fault codes into feedback data frames and sends them to the controller. The controller parses the data and displays it in real time, and triggers the corresponding audible and visual alarm when a fault code is detected.

8. The method according to claim 1, characterized in that, The method further includes: By collecting speed fluctuation data and load change data of the motor during continuous operation through the motor control board, a correlation model between speed and load is established. When a sudden change in load is detected, the motor drive signal is pre-adjusted in advance according to the correlation model to compensate for the speed deviation caused by the sudden change in load.

9. The method according to claim 1, characterized in that, The method further includes: The system collects statistics on motor running time, cumulative number of runs, and frequency of various abnormalities to establish a motor health status assessment model. Based on the assessment results, it generates graded early warning information and automatically performs deceleration and shutdown operations when the health status falls below a preset threshold.

Citation Information

Patent Citations

  • CN111900909A

  • CN118971683A