A method and apparatus for detecting stall of a direct current motor

By processing DC motor signals through the MCU main control module and signal processing module and shaping them into PWM signals, and using the input capture timer to determine the motor status, the applicability and accuracy problems of DC motor stall detection in the prior art are solved, and efficient stall detection and protection are achieved.

CN116317825BActive Publication Date: 2026-06-23NANJING UNIV OF INFORMATION SCI & TECH

Patent Information

Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
NANJING UNIV OF INFORMATION SCI & TECH
Filing Date
2023-03-22
Publication Date
2026-06-23

Smart Images

  • Figure CN116317825B_ABST
    Figure CN116317825B_ABST
Patent Text Reader

Abstract

The application discloses a method and device for detecting the stall of a direct current motor, comprising: using a double-channel operational amplifier to detect the working output signal of the direct current motor, and performing signal difference and amplification; using a voltage following circuit to always keep the obtained voltage signal as a positive signal; sending the signal to a single-channel Schmidt trigger buffer, shaping the sine wave signal into a square wave signal, i.e. a PWM signal, and transmitting the PWM signal to a master control chip; configuring a timer for input capture in the master control chip, capturing the detected PWM signal, and setting the frequency as 100 Hz; if the PWM signal is captured, it indicates that the direct current motor is in normal operation and no stall phenomenon occurs; if no PWM signal is captured, when the direct current motor is not in a starting state, it indicates that the direct current motor is not working, and when the direct current motor is in the starting state, it indicates that the direct current motor is stalled. The method provided by the application can realize real-time detection of the running state of the direct current motor, has high detection precision, is simple to operate, and has low manufacturing cost.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] This invention relates to the field of DC motor fault detection technology, and in particular to a method and apparatus for detecting DC motor stall. Background Technology

[0002] A DC motor is an electric motor that converts direct current electrical energy into mechanical energy. Due to its excellent speed regulation performance, it is widely used in electric drives. The structure of a DC motor consists of two main parts: the stator and the rotor. The stationary part of the DC motor during operation is called the stator, and its main function is to generate a magnetic field. The stator consists of a frame, main magnetic poles, commutating poles, end covers, bearings, and brush assembly. The rotating part during operation is called the rotor, and its main function is to generate electromagnetic torque and induced electromotive force. It is the hub of energy conversion in the DC motor and is therefore often called the armature. It consists of a shaft, armature core, armature windings, commutator, and fan. For a DC motor, the supply voltage is DC input, and it can be controlled using PWM (Pulse Width Modulation) technology. PWM is a signal with an adjustable duty cycle. By changing the duty cycle of the PWM signal, the average voltage across the DC motor can be changed, thereby achieving speed regulation. DC motors have good adjustment performance, a wide constant power range, are relatively simple to control, and are inexpensive. They are widely used in automobiles, tools, industrial control, and model aircraft, and also have a significant advantage in automatic door and window control.

[0003] When a DC motor stalls during operation, if the mechanical device reaches its limit or encounters an obstacle, failure to promptly and quickly lock the motor and stop its torque output can damage the motor and mechanical device, and may also cause personal injury to the user, such as crushing or pinching injuries. Therefore, timely detection and stall protection of DC motors are essential.

[0004] Chinese patent application "Detection Device and Mobile Phone Holder for Detecting Motor Stall Based on Magnet and Hall Element" (Application No. CN201920169963.2, Publication No. CN209514010U) discloses a detection device and mobile phone holder for detecting DC motor stall based on magnet and Hall element. This device places a magnet on the worm gear of the DC motor and places a Hall element next to the magnet to sense changes in the magnetic field. This allows the device to detect the opening and closing of the clamping arm of the mobile phone holder by controlling the rotation of the DC motor, thus avoiding the risk of the DC motor burning out due to stall. The drawback of this device is its limited applicability; it is not suitable for industrial control or model aircraft applications, and the detection effect is relatively poor. Chinese patent application "A Low-Cost Method for Detecting DC Motor Stall" (Application No. CN202111163186.9, Publication No. CN113872156A) discloses a low-cost method for detecting DC motor stall. This method uses the energy storage characteristics of a detection capacitor to determine the simplest high and low voltage levels to identify whether the DC motor is stalled, thus reducing costs. The automatic power-off protection device immediately cuts off the contact when it detects a DC motor stall, thus protecting the DC motor. This method of detecting DC motor stall requires connecting a detection capacitor in parallel with the DC motor coil between the positive and negative terminals. This capacitor is then electrically connected to a central processing unit (CPU). The CPU monitors whether there is a potential difference across the capacitor. Finally, the CPU issues a stall alarm signal based on the potential difference across the capacitor. This detection method is relatively cumbersome, requires modification to the DC motor itself, and is not very practical, making it unsuitable for effective detection in industrial control and model aircraft applications. Summary of the Invention

[0005] The technical problem to be solved by the present invention is to provide a method and device for detecting DC motor stall, which mainly consists of an MCU main control module and a signal processing module. The two signal lines of the DC motor are led out and connected to the signal processing module. The operating status of the DC motor can be detected in real time through the judgment of the MCU main control module. The detection principle is simple, the detection accuracy is high, the operation is simple, and it is suitable for detecting stall of most DC motors on the market.

[0006] To solve the above technical problems, the present invention adopts the following technical solution:

[0007] The method and apparatus for detecting DC motor stall proposed in this invention employ a MEB358ASG dual-channel operational amplifier and an SN74LVC1G17DBVR single-channel Schmitt trigger buffer in the signal processing module. The specific steps are as follows:

[0008] S1. Use a dual-channel operational amplifier to detect the sinusoidal signal output by the DC motor, and perform differential and amplification on the sinusoidal signal.

[0009] S2. A voltage follower circuit is used to provide a static operating point, which shifts the sine wave signal above zero so that it is always a positive signal.

[0010] S3. The processed sine wave signal is transmitted to a single-channel Schmitt trigger buffer and shaped into a square wave signal, i.e., a PWM signal.

[0011] S4. Transmit the PWM signal to the main control chip that configures the input capture timer, and capture the PWM signal using the rising edge.

[0012] S5. When the DC motor is not started, no PWM signal is output; when the DC motor is in the starting state, after capturing the PWM signal, the corresponding input capture interrupt function is entered, a rolling array is defined, a duty cycle calculation function is added, and the real-time PWM duty cycle of the DC motor is calculated.

[0013] S6. In the main function, call the motor detection and judgment function and configure a general timer to judge the values ​​in the scrolling array.

[0014] S7. Determine the status of the DC motor by checking the flag returned by the motor detection function.

[0015] Furthermore, in step S4, the frequency of the captured and detected PWM signal is set to 100Hz; the specific content of configuring the input capture timer is as follows: using TIM_2_CH1 as the input capture channel, setting the timer 2 input capture interrupt, completing the initialization of TIM2 input capture parameters, setting rising edge capture, configuring the input to not be divided or filtered, and enabling the TIM_2_CH1 input capture interrupt.

[0016] Furthermore, in step S5, the specific content of the input capture interrupt function is as follows: the frequency of the timer capturing the PWM signal is set to 100Hz. When the PWM signal appears, the timer enters the input capture interrupt function. If the DC motor is running normally, the entire scroll array is assigned a value of 1; if the DC motor stalls, the entire scroll array is assigned a value of 2; after each interrupt, the corresponding interrupt flag is cleared.

[0017] The specific operation of the duty cycle calculation function for calculating the real-time PWM duty cycle of a DC motor is as follows:

[0018] / * Duty cycle calculation formula * /

[0019] DutyCycle = (float)((IC2Value+1) * 100) / (IC1Value+1);

[0020] / * Frequency calculation formula * /

[0021] Frequency = 168000000 / 168 / (float(IC1Value+1);

[0022] Where IC1Value = TIM_GetCapture1(TIM2);

[0023] IC2Value = TIM_GetCapture2(TIM2); This directly uses the firmware library function that comes with the main control chip for direct calling.

[0024] Furthermore, in step S6, the calling frequency of the motor detection and judgment function is set to 20Hz; the specific content of the motor detection and judgment function is as follows: the configured motor detection and judgment function is put into a while(1) loop, and the state of the DC motor is judged by the if condition:

[0025] (1) When the DC motor is in the state, further if condition judgment is made. If all the values ​​in the rolling array are 1, it means that the DC motor is running normally. At this time, the DC motor normal operation flag is returned. If the value in the rolling array is not 1, the else condition judgment is made to see if all the values ​​in the rolling array are 2. If all the values ​​in the rolling array are 2, it means that the DC motor is stalled. At this time, the motor stall flag is returned.

[0026] (2) When the DC motor is not started, return to the DC motor not started flag.

[0027] Furthermore, in step S7, if the motor stall flag is returned, the PWM wave output is turned off or the DC motor switch is turned off to prevent the DC motor from burning out and the device from being damaged.

[0028] Furthermore, the present invention also proposes a device for detecting DC motor stall, which consists of a housing and an internal module;

[0029] The outer shell has an ABS material 3D printed outer packaging 1 and a detection signal line inlet 2;

[0030] The internal modules include a signal processing module and an MCU main control module. The signal processing module includes a dual-channel operational amplifier and a single-channel Schmitt trigger buffer, used to acquire sine wave signals and shape them into square wave signals, i.e., PWM signals. The MCU main control module uses a timer configured for input capture to capture the PWM signals detected by the corresponding I / O ports, enters the input capture interrupt function, and determines the state of the DC motor by checking the flag bit returned by the motor detection and judgment function.

[0031] Furthermore, the negative INA and positive INA signal detection ports of the dual-channel operational amplifier of the signal processing module are connected to the signal lines of the DC motor, and the interface Y of the single-channel Schmitt trigger buffer is connected to the timer IO port on the MCU main control module.

[0032] Furthermore, the MCU main control module is an STM32F103C8T6 main control chip.

[0033] Furthermore, in the MCU main control module, when the DC motor is in the start-up state, the frequency of the timer capturing the PWM signal in the input capture interrupt function is set to 100Hz. When the PWM signal is captured, the timer enters the input capture interrupt function, defining a global variable array as a rolling array. If the DC motor is running normally, the rolling array is set to 1 for all values; if the DC motor stalls, the rolling array is set to 2 for all values. After each interrupt is entered, the corresponding interrupt flag is cleared.

[0034] Furthermore, in the MCU main control module, the calling frequency of the motor detection and judgment function is set to 20Hz. The configured motor detection and judgment function is placed in a while(1) loop, and the state of the DC motor is judged by the if condition:

[0035] (1) When the DC motor is in the starting state, further if condition judgment is made. If all the values ​​in the rolling array are 1, it means that the DC motor is running normally. At this time, the DC motor normal operation flag is returned. If the value in the rolling array is not 1, the else condition judgment is made to see if all the values ​​in the rolling array are 2. If all the values ​​in the rolling array are 2, it means that the DC motor is stalled. At this time, the motor stall flag is returned.

[0036] (2) When the DC motor is not started, return to the DC motor not started flag.

[0037] If the motor stall flag is returned, the PWM output will be turned off or the DC motor switch will be turned off to prevent the DC motor from burning out and the device from being damaged.

[0038] The present invention adopts the above technical solution, and its significant technical effects compared with the prior art are as follows:

[0039] The method designed in this invention features high detection accuracy, good results, and simple operation. It only requires connecting two signal lines from the DC motor to the signal processing module to monitor the DC motor's operating status in real time. Furthermore, the device uses fewer electronic components, resulting in lower manufacturing costs. It can detect stalled operation in most commercially available DC motors, preventing serious problems such as motor burnout and mechanical damage caused by failure to detect stalled operation in a timely manner. Attached Figure Description

[0040] Figure 1 This is a schematic block diagram of the DC motor stall detection system of the present invention.

[0041] Figure 2 This is a flowchart of the method for detecting stall in a DC motor according to the present invention.

[0042] Figure 3 This is a circuit diagram of the DC motor stall signal processing module of the present invention.

[0043] Figure 4 This invention relates to the original signal diagram of a DC motor and the signal diagram obtained by subtracting the original signal diagram of the DC motor.

[0044] Figure 5 This is a 3D printed shell structure diagram of the DC motor stall detection device of the present invention. Detailed Implementation

[0045] The present invention will now be described in further detail with reference to the accompanying drawings and specific embodiments.

[0046] like Figure 1 As shown, this invention provides a method and apparatus for detecting DC motor stall, which mainly consists of an MCU main control module and a signal processing module. The MCU main control module uses the relatively inexpensive STM32F103C8T6 main control chip and employs a pin with timer function. By configuring the timer to input capture, it acquires the square wave signal detected by the corresponding IO port and processed by the signal processing module. The signal processing module mainly uses a MEB358ASG dual-channel operational amplifier and an SN74LVC1G17DBVR single-channel Schmitt trigger buffer. By connecting the two signal lines of the DC motor to the negative INA and positive INA signal detection ports of the dual-channel operational amplifier, the dual-channel operational amplifier subtracts and amplifies the sinusoidal signal detected by the DC motor's output. Then, a voltage follower circuit provides a static operating point, shifting the sinusoidal signal above zero to ensure it remains a positive signal. Finally, the processed sinusoidal signal is sent to the single-channel Schmitt trigger buffer and shaped into a square wave signal, i.e., a PWM signal. Then, connect the interface Y of the single-channel Schmitt trigger buffer directly to the timer I / O port on the MCU main control module. By configuring the timer to capture the input signal to detect the PWM signal, the operating status of the DC motor can be determined. Specific operation steps are as follows: Figure 2 As shown:

[0047] S1. Use a dual-channel operational amplifier to detect the sinusoidal signal output by the DC motor, and perform differential and amplification on the sinusoidal signal.

[0048] S2. A voltage follower circuit is used to provide a static operating point, shifting the sine wave signal above zero so that it always remains a positive signal.

[0049] S3. The processed sine wave signal is transmitted to a single-channel Schmitt trigger buffer and shaped into a square wave signal, i.e., a PWM signal.

[0050] S4. Transmit the PWM signal to the main control chip that configures the input capture timer. Use rising edge capture for the PWM signal, and set the capture detection frequency to 100Hz. The specific configuration of the input capture timer is as follows: use TIM_2_CH1 as the channel for this input capture, configure the corresponding I / O port, set the Timer 2 input capture interrupt, initialize the TIM2 input capture parameters, set rising edge capture, configure the input to not be divided or filtered, and enable the TIM_2_CH1 input capture interrupt.

[0051] S5. When the DC motor is not running, no PWM signal is output. When the DC motor is running, after capturing the PWM signal, the corresponding input capture interrupt function is entered. A global variable is defined as a rolling array, and a duty cycle calculation function is added to calculate the real-time PWM duty cycle of the DC motor. Specifically, the timer captures the PWM signal at a frequency of 100Hz. When the PWM signal appears, the timer enters the input capture interrupt function. If the DC motor is running normally, the rolling array is set to 1; if the DC motor stalls, the rolling array is set to 2. After each interrupt, the corresponding interrupt flag is cleared to prevent errors from occurring on the next interrupt. The specific operation of the duty cycle calculation function to calculate the real-time PWM duty cycle of the DC motor is as follows:

[0052] / * Duty cycle calculation formula * /

[0053] DutyCycle = (float)((IC2Value+1) * 100) / (IC1Value+1);

[0054] / * Frequency calculation formula * /

[0055] Frequency = 168000000 / 168 / (float(IC1Value+1);

[0056] Where IC1Value = TIM_GetCapture1(TIM2);

[0057] IC2Value = TIM_GetCapture2(TIM2); This directly uses the firmware library function that comes with the main control chip for direct calling.

[0058] S6. In the main function, call the motor detection and judgment function and configure a general timer to judge the values ​​in the scrolling array. Specifically, set the calling frequency of the motor detection and judgment function to 20Hz, put the configured motor detection and judgment function into a while(1) loop, and judge the state of the DC motor through the if condition:

[0059] (1) When the DC motor is in the state, further if condition judgment is made. If all values ​​in the scroll array are 1, it means that the DC motor is running normally. At this time, the DC motor is returned to the normal operation flag. If the value in the scroll array is not 1, the above if condition judgment will not be entered. Instead, the else condition judgment will be entered to determine whether all values ​​in the scroll array are 2. If all values ​​in the scroll array are 2, it means that the DC motor is stalled. The LED indicator lights up red to indicate that the DC motor is stalled. At this time, the motor stall flag is returned.

[0060] (2) When the DC motor is not started, return to the DC motor not started flag.

[0061] S7. The status of the DC motor is determined by the flag returned by the motor detection function. If the motor stall flag is returned, the PWM wave output is turned off or the DC motor switch is turned off to prevent the DC motor from burning out and the device from being damaged.

[0062] like Figure 3 The circuit shown has J1 as a 3-port wire-to-wire connector and J2 as a 4-port wire-to-wire connector. J2 is connected to the 5V and GND of the DC motor, as well as the two Hall effect signal lines. Connect ports 3 and 4 of J2 to the -INA and +INA terminals of the MEB358ASG dual-channel operational amplifier. Two resistors, R2 and R4, with a resistance of 12KΩ, are connected to the corresponding two connection lines. A 33KΩ resistor, R1, is connected in parallel with the OUTA port to the -INA terminal. This part primarily functions as a voltage amplification circuit. Figure 4 The two original signals of the DC motor shown in Figure A are obtained by subtracting them as follows: Figure 4 The signal V2 shown in B is then amplified by a voltage amplifier circuit and the result is a signal waveform with an amplitude of approximately -1.65V to +1.65V obtained by using the formula (33K / 12K)*V2. Figure 3The right-side VCC of the MEB358ASG dual-channel operational amplifier is connected to a 5V power supply module, providing the main power for the chip. OUTB and -INB are connected in parallel and connected to +INA in series with resistor R6. +INB is connected to resistors R3 and R5 respectively. This part of the circuit is a voltage follower circuit, which mainly provides a static operating point, shifting the basic voltage upward to above zero, so that the obtained voltage signal is always a positive signal and remains in the range of approximately 0 to 3.3V. Finally, the OUTA port is connected to port A of a SN74LVC1G17DBVR single-channel Schmitt trigger buffer. The main function of this trigger buffer is to shape the differential amplified offset signal into a square wave signal, i.e., a PWM signal. Finally, the Y port of the trigger buffer is connected to port 3 of J1. By connecting the microcontroller's timer input capture port to this port, the signal to be detected can be captured.

[0063] This invention also proposes a device for detecting stall in a DC motor, such as... Figure 5 As shown, the steps for implementing the aforementioned method for detecting DC motor stall include a signal processing module and an MCU main control module. Both modules are housed in a protective shell made of 3D-printed ABS material, with dimensions of 70*45*15mm, effectively protecting the hardware circuitry. It should be noted that each module in the above system corresponds to a specific step in the method provided in this embodiment of the invention, possessing the corresponding functional modules and beneficial effects for executing the method. Technical details not described in detail in this embodiment can be found in the method provided in this embodiment of the invention.

[0064] The above embodiments are merely illustrative of the technical concept of the present invention and should not be construed as limiting the scope of protection of the present invention. Any modifications made to the technical solutions based on the technical concept proposed in this invention shall fall within the scope of protection of this invention.

Claims

1. A method for detecting stall in a DC motor, characterized in that, Includes the following steps: S1. Use a dual-channel operational amplifier to detect the sinusoidal signal output by the DC motor, and perform differential and amplification on the sinusoidal signal; S2. Use a voltage follower circuit to provide a static operating point, shift the sine wave signal above zero so that it is always a positive signal; S3. The processed sine wave signal is transmitted to a single-channel Schmitt trigger buffer and shaped into a square wave signal, i.e., a PWM signal. S4. Transmit the PWM signal to the main control chip that configures the input capture timer, and capture the PWM signal using the rising edge; S5. When the DC motor is not started, no PWM signal is output; when the DC motor is in the starting state, after capturing the PWM signal, the corresponding input capture interrupt function is entered, a rolling array is defined, a duty cycle calculation function is added, and the real-time PWM duty cycle of the DC motor is calculated. Specifically: The timer captures PWM signals at a frequency of 100Hz. When a PWM signal appears, the timer enters the input capture interrupt function. If the DC motor is running normally, the entire scroll array is set to 1. If the DC motor stalls, the entire scroll array is set to 2. After each interrupt, the corresponding interrupt flag is cleared. S6. In the main function, call the motor detection and judgment function and configure a general timer to judge the values ​​in the scrolling array; specifically: The calling frequency of the motor detection and judgment function is set to 20Hz; the specific content of the motor detection and judgment function is as follows: the configured motor detection and judgment function is put into a while(1) loop, and the state of the DC motor is judged by the if condition: (1) When the DC motor is in the starting state, further if condition judgment is made. If all the values ​​in the rolling array are 1, it means that the DC motor is running normally. At this time, the DC motor normal operation flag is returned. If the value in the rolling array is not 1, the else condition is entered to judge whether all the values ​​in the rolling array are 2. If all the values ​​in the rolling array are 2, it means that the DC motor is stalled. At this time, the motor stall flag is returned. (2) When the DC motor is not started, return to the DC motor not started flag; S7. Determine the status of the DC motor by checking the flag returned by the motor detection function.

2. The method for detecting stall in a DC motor according to claim 1, characterized in that, In step S4, the frequency of the captured PWM signal is set to 100Hz; the specific content of the input capture timer configuration is as follows: use TIM_2_CH1 as the input capture channel, set the timer 2 input capture interrupt, complete the initialization of TIM2 input capture parameters, set rising edge capture, configure the input to not be divided or filtered, and enable the TIM_2_CH1 input capture interrupt.

3. The method for detecting stall in a DC motor according to claim 1, characterized in that, In step S7, if the motor stall flag is returned, the PWM wave output is turned off or the DC motor switch is turned off.

4. A device for detecting stall in a DC motor, characterized in that, It consists of an outer shell and internal modules; The outer shell has an ABS material 3D printed outer packaging (1) and a detection signal line inlet (2); The internal modules include a signal processing module and an MCU main control module. The signal processing module includes a dual-channel operational amplifier and a single-channel Schmitt trigger buffer, which are used to acquire sine wave signals and shape them into square wave signals, i.e., PWM signals. The MCU main control module uses a timer configured for input capture to capture the PWM signals detected by the corresponding I / O port, enters the input capture interrupt function, and determines the state of the DC motor by the flag bit returned by the motor detection and judgment function. In the MCU main control module, when the DC motor is in the start-up state, the frequency of the timer capturing the PWM signal in the input capture interrupt function is set to 100Hz; when the PWM signal is captured, the timer enters the input capture interrupt function, defines a global variable array as a rolling array, if the DC motor is running normally, the rolling array is set to 1; if the DC motor stalls, the rolling array is set to 2; after each interrupt, the corresponding interrupt flag is cleared. The calling frequency of the motor detection and judgment function is set to 20Hz. The configured motor detection and judgment function is placed in a while(1) loop, and the state of the DC motor is judged by the if condition: (1) When the DC motor is in the starting state, further if condition judgment is made. If all the values ​​in the rolling array are 1, it means that the DC motor is running normally. At this time, the DC motor normal operation flag is returned. If the value in the rolling array is not 1, the else condition is entered to judge whether all the values ​​in the rolling array are 2. If all the values ​​in the rolling array are 2, it means that the DC motor is stalled. At this time, the motor stall flag is returned. (2) When the DC motor is not started, return to the DC motor not started flag; If the motor stall flag is returned, the PWM output will be turned off or the DC motor switch will be turned off.

5. The device for detecting stall in a DC motor according to claim 4, characterized in that, The signal processing module consists of a MEB358ASG dual-channel operational amplifier and an SN74LVC1G17DBVR single-channel Schmitt trigger buffer. The negative INA and positive INA signal detection ports of the dual-channel operational amplifier are connected to the signal lines of the DC motor, and the interface Y of the single-channel Schmitt trigger buffer is connected to the timer IO port on the MCU main control module.

6. The device for detecting stall in a DC motor according to claim 4, characterized in that, The MCU main control module is an STM32F103C8T6 main control chip.