Pressure detection method in motor operation process

By integrating high-current NMOS tubes and external PMOS tubes in the MCU chip to form an H-bridge drive circuit, the motor current is monitored in real time, which solves the high cost and complexity problems of the existing motor pressure detection methods and achieves low-cost, accurate motor pressure. Detection and operational control.

CN118670588APending Publication Date: 2024-09-20SINMIKRO ELEKTRONIKS KO LTD
View PDF 0 Cites 2 Cited by

Patent Information

Application Number
CN202410730203.X
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2024-06-06
Publication Date
2024-09-20

AI Technical Summary

Technical Problem

Existing motor pressure detection methods are costly, complex to install, and susceptible to environmental influences, making it impossible to obtain lower-cost, more accurate motor operating information.

Method used

By integrating high-current NMOS tubes into the MCU chip and forming an H-bridge drive circuit together with external PMOS tubes, the motor current changes are monitored in real time to determine the motor load. The timer and ADC module are used to collect current data, and the average filtering algorithm is combined to perform pressure analysis. detection.

Benefits of technology

It achieves low-cost, accurate motor pressure detection without additional sensors, reduces hardware costs and system complexity, improves response speed and current control accuracy, and enhances the real-time and reliability of the system.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN118670588A
    Figure CN118670588A
Patent Text Reader

Abstract

The invention provides a pressure detection method in a motor operation process, which comprises the following steps of: integrating an NMOS (N-channel Metal Oxide Semiconductor) tube into an MCU (Microprogrammed Control Unit) chip, and respectively connecting an external PMOS (P-channel Metal Oxide Semiconductor) tube and an NMOS tube in the chip to two ends of a motor to form an H-bridge driving circuit; setting a timer to be two times of the operation frequency of the motor, and setting a trigger value for triggering interruption as the PWM duty ratio of the motor; when the timer counts to a trigger value and generates trigger interruption, generating a PWM (Pulse Width Modulation) signal to control a first pair of PMOS (P-channel Metal Oxide Semiconductor) tube and NMOS (N-channel Metal Oxide Semiconductor) tube which are not directly connected in the H-bridge driving circuit to be switched on at the same time and a second pair of PMOS tube and NMOS tube to be switched off at the same time; enabling an ADC module to start to collect motor current, and obtaining relatively smooth current data by using an average filtering algorithm after multiple times of collection; whether a motor pressure abnormal event occurs or not is judged by detecting the pressure change in the motor operation process. The load condition of the motor is deduced by monitoring the current change of the motor in real time, and then whether the pressure of the motor is abnormal or not is judged.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present invention relates to the technical field of motor pressure detection, and in particular to a method for detecting pressure during the operation of a motor. Background Art

[0002] At present, in the way that MCU controls motors, especially in the fields of industrial and consumer electronics, it mainly relies on high-current MOS tubes to control the operation of motors. The operation of the motor is controlled by controlling the conduction and cutoff of the MOS tube. In order to more accurately control the operation of the motor, control the torque of the motor, and the change of the motor's stall, it is necessary to detect the pressure changes of the motor during operation. Traditional pressure detection methods include the use of strain sensors, pressure sensors, force-sensitive resistor sensors, etc., but these methods have many disadvantages, such as high cost, complex installation, and susceptibility to environmental influences. It can be seen that no matter which pressure detection method is used, it requires additional cost and increased product structure.

[0003] In addition, the torque, angle and pressure of the motor are coupled to the voltage and current of the motor. For example, in a three-phase permanent magnet synchronous motor, the angle and torque of the rotor are coupled to the voltage, current and flux of the motor. If the current of the motor can be collected and this information can be decoupled, the real-time information of the motor can be obtained in a lower cost, more accurate and more efficient way.

[0004] Therefore, there is an urgent need for a motor pressure detection method that does not require additional sensors, has low cost, is easy to install, and has stronger adaptability to the environment. Summary of the invention

[0005] In order to solve the problems existing in the prior art, the present invention provides a pressure detection method during the operation of a motor. The circuit infers the load condition of the motor by monitoring the current changes of the motor in real time, and then determines whether the motor has abnormal pressure.

[0006] The present invention achieves the above-mentioned purpose through the following technical solutions:

[0007] A method for detecting pressure during motor operation, comprising integrating a high-current NMOS tube into an MCU chip, wherein the NMOS tube integrated in the MCU chip works together with an external PMOS tube;

[0008] Connect the external PMOS tube and the NMOS tube inside the chip to the two ends of the motor to form an H-bridge drive circuit to control the direction of the current;

[0009] Set the MCU chip's timer to twice the motor's operating frequency, and set the interrupt trigger value to the motor's PWM duty cycle;

[0010] When the timer counts to the trigger value and generates a trigger interrupt, a PWM signal is generated to control the first pair of PMOS and NMOS tubes that are not directly connected in the H-bridge drive circuit to be turned on at the same time, and the second pair of PMOS and NMOS tubes are turned off at the same time, and the motor current collection process begins;

[0011] Enable the ADC module to start collecting motor current. After multiple collections, use the average filtering algorithm to obtain relatively smooth current data.

[0012] The current change rate of the motor current is detected in real time, and whether an abnormal motor pressure event occurs is determined by detecting the pressure change during the operation of the motor.

[0013] According to a pressure detection method during motor operation provided by the present invention, a PMOS tube P1 and an NMOS tube N1 are respectively connected to one end of the motor, and a PMOS tube P2 and an NMOS tube N2 are respectively connected to the other end of the motor.

[0014] According to a pressure detection method during motor operation provided by the present invention, in the high-level stage of PWM, when a timer counts to a trigger value and generates a trigger interrupt, a PWM signal is generated to control the PMOS tube P1 and the NMOS tube N2 to be turned on, and a coil of the motor is positively excited, and current flows into the PMOS tube P1 and flows out through the NMOS tube N2; at the same time, the PMOS tube P2 and the NMOS tube N1 are cut off to ensure that no current flows through the other coil of the motor.

[0015] According to a pressure detection method during motor operation provided by the present invention, in the low level stage of PWM, that is, when the timer generates an overflow interrupt, the state of the PMOS tube P1 is switched to cut-off, and the forward excitation is stopped. At this time, the NMOS tube N1 is turned on, and the current flows into the NMOS tube N1, allowing the current of one coil of the motor to flow back through the diode.

[0016] According to a pressure detection method during motor operation provided by the present invention, if phase switching is required, that is, changing the rotation direction of the motor, a PWM signal is generated in the high level stage of the next PWM cycle to control the PMOS tube P2 and the NMOS tube N1 to be turned on, and the other coil of the motor is positively excited, and the current flows into the PMOS tube P2 and flows out through the NMOS tube N1; at the same time, the PMOS tube P1 and the NMOS tube N2 are turned off.

[0017] According to a pressure detection method during motor operation provided by the present invention, in the low level stage of the next PWM cycle, that is, when the timer generates an overflow interrupt, the state of the PMOS tube P2 is switched to cut-off, and the forward excitation is stopped. At this time, the NMOS tube N2 is turned on, and the current flows into the NMOS tube N2.

[0018] According to a method for detecting pressure during operation of a motor provided by the present invention, the method of detecting pressure changes during operation of the motor to determine whether an abnormal motor pressure event occurs includes:

[0019] When the motor is operating normally and there is no external pressure, detect the current value of the motor and set this value as the reference current;

[0020] According to the characteristics and application scenarios of the motor, one or more current thresholds are set to judge different levels of pressure, where these thresholds should be set based on the reference current and the expected pressure variation range;

[0021] During the operation of the motor, the current value of the motor is detected in real time;

[0022] The real-time detected current value is compared with the set current threshold. If the real-time current value is greater than the set current threshold, it is determined that the motor is under pressure; wherein the magnitude of the pressure or the abnormality level is determined based on the number or degree of the threshold exceeded.

[0023] According to a method for detecting pressure during motor operation provided by the present invention, a process of performing motor current acquisition and pressure judgment by configuring a register access interface, enabling a timer and an ADC module, includes:

[0024] Configure the timer frequency according to the MCU clock source and pre-scaling factor;

[0025] Calculate the initial value of the timer based on the required time interval;

[0026] Configure the timer's interrupt enable and priority;

[0027] Configure the corresponding GPIO port to analog input mode to input the motor current signal to the ADC channel;

[0028] Select the clock source and set the pre-scaling factor of the ADC module to ensure that the ADC module operates at an appropriate clock frequency;

[0029] Select the ADC mode of single conversion mode or continuous conversion mode;

[0030] Configure the ADC channel that needs to be converted and connect it to the GPIO pin that measures the current;

[0031] When the timer triggers an interrupt, the ADC module is started to sample the current, the current value converted by the ADC module is read, and the collected current value is filtered to reduce the influence of noise and interference.

[0032] According to a method for detecting pressure during operation of a motor provided by the present invention, the method of using an average filtering algorithm to obtain relatively smooth current data includes:

[0033] Step S11, determine the filter window size: select a suitable filter window size, that is, the number of sampling points involved in the average calculation;

[0034] Step S12, calculating the average value: accumulating the sampling points in the filter window, and then dividing by the window size, that is, the number of sampling points, to obtain the average value;

[0035] Step S13, updating the filter window: sliding the filter window to the right by one sampling point, that is, discarding the oldest sampling point and adding the latest sampling point;

[0036] Step S14, repeating steps S13 and S14, continuously updating and outputting the filtered current value.

[0037] It can be seen that compared with the prior art, the present invention has the following beneficial effects:

[0038] Low cost: The present invention does not require additional sensors to detect pressure changes during motor operation, significantly reducing hardware costs. At the same time, the number of external components and connectors is reduced, further reducing system costs.

[0039] Improved integration: The present invention integrates the NMOS tube into the MCU, which significantly improves the integration of the entire system, reduces the physical size, and makes the entire system more compact and lightweight.

[0040] Faster response speed: In the present invention, since the NMOS tube is directly integrated inside the MCU, the MCU can respond and control the motor faster, which reduces the delay of signal transmission and improves the real-time and dynamic performance of the system.

[0041] Energy efficiency improvement: The present invention allows the MCU to more accurately control the direction and size of the motor current through the design of the H-bridge drive circuit, thereby optimizing the motor's operating efficiency. In addition, by accurately controlling the PWM duty cycle, the power consumption of the motor can be more effectively managed.

[0042] Improved current control accuracy: The present invention can accurately control the current direction and magnitude of the motor, and combined with the average filtering algorithm, can obtain smoother and more accurate current data, which helps to achieve more sophisticated current control and optimization.

[0043] Abnormal pressure detection: The present invention can more effectively detect abnormal motor pressure events by detecting the current change rate of the motor current in real time and combining it with the pressure changes during the operation of the motor. This helps to promptly discover and solve potential problems and improve the reliability and safety of the system.

[0044] Enhanced software flexibility: Due to the programmability of the MCU, the present invention can easily implement complex control algorithms and logic, allowing users to customize and optimize the control strategy of the motor according to specific needs, achieving higher flexibility and adaptability.

[0045] System simplification: The integrated design of the present invention reduces the number of external components and connectors, reduces the complexity and failure rate of the system. At the same time, the simplified design also makes the installation, debugging and maintenance of the system easier.

[0046] In summary, the present invention integrates a high-current NMOS tube into the MCU chip and combines it with an external PMOS tube to form an H-bridge drive circuit to control the motor. It has the advantages of high integration, fast response speed, improved energy efficiency, high current control accuracy, strong pressure anomaly detection capability, enhanced software flexibility and system simplification. These advantages make the design have broad application prospects and important practical significance in the field of motor control.

[0047] The present invention is further described in detail below in conjunction with the accompanying drawings and specific embodiments. BRIEF DESCRIPTION OF THE DRAWINGS

[0048] Figure 1 It is a flow chart of an embodiment of a method for detecting pressure during operation of a motor according to the present invention.

[0049] Figure 2 It is a first circuit schematic diagram of a pressure detection circuit implemented in an embodiment of a pressure detection method during motor operation of the present invention.

[0050] Figure 3 It is a second circuit schematic diagram of a pressure detection circuit implemented in an embodiment of a pressure detection method during motor operation of the present invention. DETAILED DESCRIPTION

[0051] In order to make the purpose, technical solution and advantages of the embodiment of the present invention clearer, the technical solution of the embodiment of the present invention will be clearly and completely described below in conjunction with the drawings of the embodiment of the present invention. Obviously, the described embodiment is a part of the embodiment of the present invention, not all of the embodiments. Based on the described embodiment of the present invention, all other embodiments obtained by ordinary technicians in this field without creative work are within the scope of protection of the present invention.

[0052] See also Figure 1 , a pressure detection method during motor operation involved in this embodiment includes:

[0053] Step S1, integrating a high current NMOS tube into the MCU chip, and the NMOS tube integrated inside the MCU chip works together with the external PMOS tube;

[0054] Step S2, connecting the external PMOS tube and the NMOS tube inside the chip to the two ends of the motor respectively to form an H-bridge drive circuit for controlling the direction of the current;

[0055] Step S3, setting the timer of the MCU chip to twice the motor operating frequency, and setting the trigger value of the interrupt to the PWM duty cycle of the motor;

[0056] Step S4, when the timer counts to the trigger value and generates a trigger interrupt, a PWM signal is generated to control the first pair of PMOS tubes and NMOS tubes that are not directly connected in the H-bridge drive circuit to be turned on at the same time, and the second pair of PMOS tubes and NMOS tubes are turned off at the same time, and the motor current collection process is entered;

[0057] Step S5, enabling the ADC module to start collecting motor current, and using an average filtering algorithm to obtain relatively smooth current data after multiple collections;

[0058] Step S6, detecting the current change rate of the motor current in real time, and determining whether an abnormal motor pressure event occurs by detecting the pressure change during the operation of the motor.

[0059] In this embodiment, two external PMOS tubes and two high-current NMOS tubes of the MCU chip are used to form an H-bridge drive circuit, and the MCU timer is used to generate PWM waves to control the conduction and cutoff of the four MOS tubes. When one of the PMOS tubes and the NMOS tubes that are not directly connected to it are turned on, the NMOS channel of the ADC is turned on to collect the motor current. After the motor current is collected, the average filtering algorithm is used to convert the current into relatively stable data. When the motor is not pressed, the motor current is at a stable reference value. When the motor is pressed hard, the motor current will increase, and it is considered that an object is pressing the motor.

[0060] In this embodiment, the PMOS transistor P1 and the NMOS transistor N1 are connected to one end of the motor respectively, and the PMOS transistor P2 and the NMOS transistor N2 are connected to the other end of the motor respectively.

[0061] Among them, the MCU timer has overflow interrupt and trigger interrupt. In the interrupt function, by turning on or off different MOS tubes, a reasonable PWM waveform is generated to control the movement of the motor.

[0062] The timer frequency is set to twice the motor operating frequency. For example, if the motor operating frequency is 1kHz, the timer frequency should be set to 2kHz. This is because the frequency of the PWM signal determines the resolution of the motor control. A higher frequency usually provides smoother control. The trigger value for the interrupt is set to the PWM duty cycle of the motor. For example, if the PWM duty cycle is 50%, an interrupt is generated when the timer counts to half of its cycle.

[0063] In the high level stage of PWM, when the timer counts to the trigger value and generates a trigger interrupt, a PWM signal is generated to control the PMOS tube P1 and the NMOS tube N2 to turn on, and one coil of the motor is positively excited. The current flows into the PMOS tube P1 and flows out through the NMOS tube N2; at the same time, the PMOS tube P2 and the NMOS tube N1 are cut off to ensure that no current flows through the other coil of the motor.

[0064] In the low level stage of PWM, that is, when the timer generates an overflow interrupt, the state of the PMOS tube P1 is switched to cut-off, and the forward excitation is stopped. At this time, the NMOS tube N1 is turned on, and the current flows into the NMOS tube N1, allowing the current of one coil of the motor to flow back through the diode.

[0065] In this embodiment, if commutation is required, that is, changing the rotation direction of the motor, a PWM signal is generated in the high-level stage of the next PWM cycle to control the PMOS tube P2 and the NMOS tube N1 to be turned on, and the other coil of the motor is positively excited, and the current flows into the PMOS tube P2 and flows out through the NMOS tube N1; at the same time, the PMOS tube P1 and the NMOS tube N2 are turned off.

[0066] In the low level stage of the next PWM cycle, that is, when the timer generates an overflow interrupt, the state of the PMOS tube P2 is switched to cut-off, and the forward excitation is stopped. At this time, the NMOS tube N2 is turned on, and the current flows into the NMOS tube N2.

[0067] Specifically, first set the timer frequency to twice the motor operating frequency, set the trigger value of the trigger interrupt to the motor's PWM duty cycle, and generate a trigger interrupt when the timer counts to the trigger value. At this time, let the PMOS tube P1 and NMOS tube N2 be turned on, and the PMOS tube P2 and NMOS tube N1 be turned off. When the timer generates an overflow interrupt, the PMOS tube P1 is turned off and the NMOS tube N1 is turned on. In this way, the motor current will rotate or vibrate in one direction. If phase switching is required, turn on the PMOS tube P2 and NMOS tube N1 when the next interrupt is triggered, and the PMOS tube P1 and NMOS tube N2 are turned off. When the overflow interrupt occurs, the PMOS tube P2 is turned off. Figure 2 and Figure 3 As shown, Figure 2 and Figure 3 They represent the movement of the motor current in two directions respectively. When the PMOS is turned on, the ADC module is enabled to start collecting the motor current. After multiple collections, the average filtering algorithm is used to obtain relatively smooth current data. When the motor is running normally and not pressed, the motor current will have a baseline value. When the motor is pressed hard, the motor current increases. The current size varies with the force used, which can be used to determine that an object is pressing the motor.

[0068] When the PMOS tube is turned on, the ADC module inside the MCU starts to collect the motor current. Since the high-current MOS tube is directly integrated inside the MCU, high-precision current collection can be achieved. After multiple collections, the average filtering algorithm or other data processing algorithms can be used to obtain relatively smooth current data.

[0069] When the motor is operating normally, its current will have a baseline value. When an external object applies pressure to the motor, the motor's current will change. This change is proportional to the pressure applied to the motor, that is, the greater the pressure, the greater the current. By comparing the current current with the baseline value, it can be determined whether there is an object pressing on the motor and the magnitude of the pressure.

[0070] In this embodiment, detecting the pressure change during the operation of the motor to determine whether an abnormal motor pressure event occurs includes:

[0071] When the motor is operating normally and there is no external pressure, detect the current value of the motor and set this value as the reference current;

[0072] According to the characteristics and application scenarios of the motor, one or more current thresholds are set to judge different levels of pressure, where these thresholds should be set based on the reference current and the expected pressure variation range;

[0073] During the operation of the motor, the current value of the motor is detected in real time;

[0074] The real-time detected current value is compared with the set current threshold. If the real-time current value is greater than the set current threshold, it is determined that the motor is under pressure; wherein the magnitude of the pressure or the abnormality level is determined based on the number or degree of the threshold exceeded.

[0075] In this embodiment, the register access interface is used to provide the MCU with the frequency and ADC module for operating the motor through register access, which includes the frequency configuration of the timer, interruption and other operations, and the sampling rate and sampling channel of the ADC can be configured through the register interface. After the timer and ADC are configured and enabled through the register access interface, the MCU first filters the collected current value, and then determines whether there is pressure pressing the motor.

[0076] Specifically, the process of configuring and enabling the timer and ADC module through the register access interface to collect motor current and determine pressure includes:

[0077] Configure the timer frequency according to the MCU clock source and pre-division factor. For example, if the MCU clock is 72MHz and 6 is set, the timer clock frequency will be 12MHz (72MHz / 6).

[0078] Calculate the initial value of the timer based on the required time interval (such as 50ms). Taking 12MHz as an example, the timer count value corresponding to 50ms can be calculated using the formula.

[0079] Configure the interrupt enable and priority of the timer. The interrupt can be used to trigger ADC sampling or other operations when the timer reaches a specified time interval.

[0080] Configure the corresponding GPIO port to analog input mode to input the motor current signal to the ADC channel.

[0081] Select the clock source and set the pre-scaling factor of the ADC module to ensure that the ADC module operates at an appropriate clock frequency;

[0082] Select the ADC mode of single conversion mode or continuous conversion mode;

[0083] Configure the ADC channel that needs to be converted and connect it to the GPIO pin that measures the current;

[0084] When the timer triggers an interrupt, the ADC module is started to sample the current, the current value converted by the ADC module is read, and the collected current value is filtered to reduce the influence of noise and interference.

[0085] After configuring and enabling the timer and ADC through the register access interface, the MCU can periodically collect the current value of the motor and determine whether there is pressure pressing the motor after filtering. This method combines the functions of hardware (timer and ADC) and software (interrupt service program and data processing algorithm) to achieve real-time monitoring and control of the motor's operating status.

[0086] In this embodiment, an average filtering algorithm is used to obtain relatively smooth current data, including:

[0087] Step S11, determine the filter window size: select a suitable filter window size, that is, the number of sampling points involved in the average calculation;

[0088] Step S12, calculating the average value: accumulating the sampling points in the filter window, and then dividing by the window size, that is, the number of sampling points, to obtain the average value;

[0089] Step S13, updating the filter window: sliding the filter window to the right by one sampling point, that is, discarding the oldest sampling point and adding the latest sampling point;

[0090] Step S14, repeating steps S13 and S14, continuously updating and outputting the filtered current value.

[0091] For example, this embodiment selects 8 sampling points for average filtering, and the sampling points are recorded as (x_1, x_2, ..., x_8), then:

[0092] The current average value is calculated as:

[0093] (I_{avg}=\frac{x_1+x_2+...+x_8}{8})

[0094] When the filter window slides one sampling point to the right, that is, a new sampling point (x_9) arrives and the old sampling point (x_1) is discarded, the new average value calculation formula is:

[0095] (I_{avg}^{\prime}=\frac{x_2+x_3+...+x_8+x_9}{8})

[0096] In practical applications, in order to improve calculation efficiency, the recursive formula of sliding average can be used to avoid repeated calculations. The recursive formula can be expressed as:

[0097] (I_{avg}^{\prime}=I_{avg}+\frac{x_9-x_1}{8})

[0098] In summary, the present invention does not require additional sensors to detect pressure changes during the operation of the motor, which significantly reduces the hardware cost. At the same time, the system cost is further reduced due to the reduction in the number of external components and connectors. The present invention integrates the NMOS tube into the MCU, significantly improves the integration of the entire system, reduces the physical size, and makes the entire system more compact and lightweight. Since the NMOS tube is directly integrated into the MCU, the MCU can respond and control the motor faster, which reduces the delay of signal transmission and improves the real-time and dynamic performance of the system. The present invention allows the MCU to more accurately control the current direction and size of the motor through the design of the H-bridge drive circuit, thereby optimizing the operating efficiency of the motor. In addition, by accurately controlling the PWM duty cycle, the power consumption of the motor can be more effectively managed. The present invention can accurately control the current direction and size of the motor, and combined with the average filtering algorithm, a smoother and more accurate current data can be obtained, which helps to achieve more refined current control and optimization. The present invention can more effectively detect abnormal motor pressure events by detecting the current change rate of the motor current in real time, and combined with the pressure changes during the operation of the motor, which helps to timely discover and solve potential problems and improve the reliability and safety of the system. The present invention can easily implement complex control algorithms and logic, and can allow users to customize and optimize the control strategy of the motor according to specific needs, achieving higher flexibility and adaptability. The integrated design of the present invention reduces the number of external components and connectors, reduces the complexity and failure rate of the system. At the same time, the simplified design also makes the installation, debugging and maintenance of the system easier.

[0099] Therefore, the present invention integrates a high-current NMOS tube into the MCU chip and combines it with an external PMOS tube to form an H-bridge drive circuit to control the motor. It has the advantages of high integration, fast response speed, improved energy efficiency, high current control accuracy, strong pressure anomaly detection capability, enhanced software flexibility and system simplification. These advantages make the design have broad application prospects and important practical significance in the field of motor control.

[0100] The above-mentioned embodiments are only preferred embodiments of the present invention and cannot be used to limit the scope of protection of the present invention. Any non-substantial changes and substitutions made by technicians in this field on the basis of the present invention shall fall within the scope of protection required by the present invention.

Claims

1. A method for detecting pressure during motor operation, characterized in that: include: Integrate high-current NMOS tubes into the MCU chip, and the NMOS tubes integrated inside the MCU chip work together with the external PMOS tubes; Connect the external PMOS tube and the NMOS tube inside the chip to the two ends of the motor to form an H-bridge drive circuit to control the direction of the current; Set the MCU chip's timer to twice the motor's operating frequency, and set the interrupt trigger value to the motor's PWM duty cycle; When the timer counts to the trigger value and generates a trigger interrupt, a PWM signal is generated to control the first pair of PMOS and NMOS tubes that are not directly connected in the H-bridge drive circuit to be turned on at the same time, and the second pair of PMOS and NMOS tubes are turned off at the same time, and the motor current collection process begins; Enable the ADC module to start collecting motor current. After multiple collections, use the average filtering algorithm to obtain relatively smooth current data. The current change rate of the motor current is detected in real time, and whether an abnormal motor pressure event occurs is determined by detecting the pressure change during the operation of the motor.

2. The pressure detection method according to claim 1, characterized in that: The PMOS tube P1 and the NMOS tube N1 are respectively connected to one end of the motor, and the PMOS tube P2 and the NMOS tube N2 are respectively connected to the other end of the motor.

3. The pressure detection method according to claim 2, characterized in that: In the high level stage of PWM, when the timer counts to the trigger value and generates a trigger interrupt, a PWM signal is generated to control the PMOS tube P1 and the NMOS tube N2 to turn on, and one coil of the motor is positively excited. The current flows into the PMOS tube P1 and flows out through the NMOS tube N2; at the same time, the PMOS tube P2 and the NMOS tube N1 are cut off to ensure that no current flows through the other coil of the motor.

4. The pressure detection method according to claim 3, characterized in that: In the low level stage of PWM, that is, when the timer generates an overflow interrupt, the state of the PMOS tube P1 is switched to cut-off, and the forward excitation is stopped. At this time, the NMOS tube N1 is turned on, and the current flows into the NMOS tube N1, allowing the current of one coil of the motor to flow back through the diode.

5. The pressure detection method according to claim 4, characterized in that: If phase switching is required, that is, changing the rotation direction of the motor, a PWM signal is generated in the high-level phase of the next PWM cycle to control the PMOS tube P2 and the NMOS tube N1 to turn on, and the other coil of the motor is positively excited. The current flows into the PMOS tube P2 and flows out through the NMOS tube N1; at the same time, the PMOS tube P1 and the NMOS tube N2 are turned off.

6. The pressure detection method according to claim 5, characterized in that: In the low level stage of the next PWM cycle, that is, when the timer generates an overflow interrupt, the state of the PMOS tube P2 is switched to cut-off, and the forward excitation is stopped. At this time, the NMOS tube N2 is turned on, and the current flows into the NMOS tube N2.

7. The pressure detection method according to any one of claims 1 to 6, characterized in that: The method of determining whether an abnormal motor pressure event occurs by detecting the pressure change during the operation of the motor includes: When the motor is operating normally and there is no external pressure, detect the current value of the motor and set this value as the reference current; According to the characteristics and application scenarios of the motor, one or more current thresholds are set to judge different levels of pressure, where these thresholds should be set based on the reference current and the expected pressure variation range; During the operation of the motor, the current value of the motor is detected in real time; The real-time detected current value is compared with the set current threshold. If the real-time current value is greater than the set current threshold, it is determined that the motor is under pressure; wherein the magnitude of the pressure or the abnormality level is determined based on the number or degree of the threshold exceeded.

8. The pressure detection method according to any one of claims 1 to 6, characterized in that: The process of configuring and enabling the timer and ADC module through the register access interface for motor current acquisition and pressure judgment includes: Configure the timer frequency according to the MCU clock source and pre-scaling factor; Calculate the initial value of the timer based on the required time interval; Configure the timer's interrupt enable and priority; Configure the corresponding GPIO port to analog input mode to input the motor current signal to the ADC channel; Select the clock source and set the pre-scaling factor of the ADC module to ensure that the ADC module operates at an appropriate clock frequency; Select the ADC mode of single conversion mode or continuous conversion mode; Configure the ADC channel that needs to be converted and connect it to the GPIO pin that measures the current; When the timer triggers an interrupt, the ADC module is started to sample the current, the current value converted by the ADC module is read, and the collected current value is filtered to reduce the influence of noise and interference.

9. The pressure detection method according to any one of claims 1 to 6, characterized in that: The method of using an average filtering algorithm to obtain relatively smooth current data includes: Step S11, determine the filter window size: select a suitable filter window size, that is, the number of sampling points involved in the average calculation; Step S12, calculating the average value: accumulating the sampling points in the filter window, and then dividing by the window size, that is, the number of sampling points, to obtain the average value; Step S13, updating the filter window: sliding the filter window to the right by one sampling point, that is, discarding the oldest sampling point and adding the latest sampling point; Step S14, repeating steps S13 and S14, continuously updating and outputting the filtered current value.

Citation Information

Cited By

  • Interruption time sequence adjustment method for arc discharge detection, arc discharge detection method and photovoltaic system

    CN119921671A

  • Arc detection interruption timing adjustment method, arc detection method, and photovoltaic system

    CN119921671B