Motor control method and device, computer device and storage medium
By monitoring the motor circuit current and setting a threshold for closed-loop control, the problem of untimely motor stall protection in existing technologies is solved, and reliable current limiting protection of the motor is achieved, avoiding damage due to current overload.
Patent Information
- Application Number
- CN202210784239.7
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2022-07-05
- Publication Date
- 2026-03-03
- Estimated Expiration
- 2042-07-05
AI Technical Summary
Existing motor stall protection methods rely on position sensors, which cannot achieve closed-loop control of the circuit current, resulting in slow protection and easy overheating of the motor current circuit, causing device damage.
By monitoring the motor circuit current, the voltage value is obtained using a sampling resistor to calculate the current flowing through the motor, and different thresholds are set for closed-loop control, including discharging and issuing warnings when the current exceeds the threshold, to prevent the motor from stalling or short-circuiting.
It achieves current limiting protection for motor stall conditions, improves the reliability of motor control, and avoids device damage caused by current overload.
Smart Images

Figure CN115085633B_ABST
Abstract
Description
Technical Field
[0001] This application relates to the field of motor current limiting protection technology, and in particular to a motor control method, device, computer equipment, and storage medium. Background Technology
[0002] With the advancement of automotive electrification, the use of electric motors in automobiles is gradually increasing. Motor stall occurs when the motor fails to start or stop due to excessive load, mechanical failure of the driven component, or bearing damage. When a motor is stalled, its power factor is extremely low, and the stall current (called stall current) is very high; prolonged stalling can burn out the motor.
[0003] In related technologies, motor stall protection uses a position sensor to obtain the position of the motor rotor, determines whether the motor is stalled, and then implements corresponding protection strategies. Because this method relies on position and does not consider the current in the motor circuit, it cannot achieve closed-loop control of the circuit current, resulting in slow protection and potentially causing excessively high temperatures in the motor current circuit, which can easily damage components. Summary of the Invention
[0004] Therefore, it is necessary to provide a simple and effective motor control method, device, computer equipment, computer-readable storage medium, and computer program product to address the aforementioned technical problems.
[0005] In a first aspect, this application provides a motor control method applied to a motor control circuit. The motor control circuit includes four MOSFETs, a first sampling resistor, and a second sampling resistor. The first and fourth MOSFETs constitute a first driving circuit for the motor, and the second and third MOSFETs constitute a second driving circuit for the motor. The first terminal of the first sampling resistor is connected to a power supply, and the second terminal of the first sampling resistor is connected to the drain of both the first and second MOSFETs. The first terminal of the second sampling resistor is connected to the source of both the third and fourth MOSFETs, and the second terminal of the second sampling resistor is grounded. The method includes:
[0006] Obtain the first voltage at the first terminal of the second sampling resistor and the second voltage at the second terminal of the first sampling resistor;
[0007] Calculate the current flowing through the motor based on the first voltage and the second voltage;
[0008] If the current flowing through the motor is greater than the first preset threshold and less than the second preset threshold, the motor is controlled to discharge. After the discharge time of the motor reaches the preset time, the first voltage and the second voltage are reacquired, and the current flowing through the motor is recalculated until the current flowing through the motor is not greater than the first preset threshold.
[0009] If the current flowing through the motor is not less than the second preset threshold, the power supply to the motor will be turned off and a warning will be issued.
[0010] In one embodiment, the current flowing through the motor is calculated based on the first voltage and the second voltage, including:
[0011] The moment when the first voltage is acquired is taken as the current moment. The target drive circuit where the motor is located at the current moment is determined. The target drive circuit is either the first drive circuit or the second drive circuit.
[0012] Determine the voltage across the motor based on the on-state voltage, the first voltage, and the second voltage of the two MOSFETs in the target drive circuit.
[0013] Calculate the current flowing through the motor based on the voltage across the motor terminals.
[0014] In one embodiment, the current flowing through the motor is calculated based on the first voltage and the second voltage, including:
[0015] Calculate the first current flowing through the second sampling resistor based on the first voltage;
[0016] Calculate the second current flowing through the first sampling resistor based on the second voltage and the voltage value of the power supply;
[0017] When the first current equals the second current, the first current is taken as the current flowing through the motor.
[0018] In one embodiment, the target driving circuit is a first driving circuit; correspondingly, controlling the motor to discharge includes:
[0019] The first and second MOSFETs are controlled to be in an off state, and the third and fourth MOSFETs are controlled to be in a conducting state.
[0020] In one embodiment, the target driving circuit is a first driving circuit; correspondingly, controlling the motor to discharge includes:
[0021] The first and fourth MOSFETs are controlled to be in an off state, and the second and third MOSFETs are controlled to be in a conducting state.
[0022] In one embodiment, after calculating the current flowing through the motor based on the first voltage and the second voltage, the method further includes:
[0023] If the current flowing through the resistor is not greater than the first preset threshold, return to the step of obtaining the first voltage at the first end of the second sampling resistor and the second voltage at the second end of the first sampling resistor.
[0024] Secondly, this application also provides a motor control device applied to a motor control circuit. The motor control circuit includes four MOSFETs, a first sampling resistor, and a second sampling resistor. The first and fourth MOSFETs constitute a first driving circuit for the motor, and the second and third MOSFETs constitute a second driving circuit for the motor. The first terminal of the first sampling resistor is connected to a power supply, and the second terminal of the first sampling resistor is connected to the drain of both the first and second MOSFETs. The first terminal of the second sampling resistor is connected to the source of both the third and fourth MOSFETs, and the second terminal of the second sampling resistor is grounded. The device includes:
[0025] The acquisition module is used to acquire the first voltage at the first terminal of the second sampling resistor and the second voltage at the second terminal of the first sampling resistor;
[0026] The calculation module is used to calculate the current flowing through the motor based on the first voltage and the second voltage;
[0027] The first control module is used to control the motor to discharge when the current flowing through it is greater than a first preset threshold and less than a second preset threshold, and after the discharge time of the motor reaches a preset time, to reacquire the first voltage and the second voltage, and recalculate the current flowing through the motor until the current flowing through it is not greater than the first preset threshold.
[0028] The second control module is used to shut off the power to the motor and provide a warning when the current flowing through it is not less than a second preset threshold.
[0029] Thirdly, this application also provides a computer device. The computer device includes a memory and a processor, the memory storing a computer program, and the processor executing the computer program to perform the following steps:
[0030] Obtain the first voltage at the first terminal of the second sampling resistor and the second voltage at the second terminal of the first sampling resistor;
[0031] Calculate the current flowing through the motor based on the first voltage and the second voltage;
[0032] If the current flowing through the motor is greater than the first preset threshold and less than the second preset threshold, the motor is controlled to discharge. After the discharge time of the motor reaches the preset time, the first voltage and the second voltage are reacquired, and the current flowing through the motor is recalculated until the current flowing through the motor is not greater than the first preset threshold.
[0033] If the current flowing through the motor is not less than the second preset threshold, the power supply to the motor will be turned off and a warning will be issued.
[0034] Fourthly, this application also provides a computer-readable storage medium. The computer-readable storage medium stores a computer program thereon, which, when executed by a processor, performs the following steps:
[0035] Obtain the first voltage at the first terminal of the second sampling resistor and the second voltage at the second terminal of the first sampling resistor;
[0036] Calculate the current flowing through the motor based on the first voltage and the second voltage;
[0037] If the current flowing through the motor is greater than the first preset threshold and less than the second preset threshold, the motor is controlled to discharge. After the discharge time of the motor reaches the preset time, the first voltage and the second voltage are reacquired, and the current flowing through the motor is recalculated until the current flowing through the motor is not greater than the first preset threshold.
[0038] If the current flowing through the motor is not less than the second preset threshold, the power supply to the motor will be turned off and a warning will be issued.
[0039] Fifthly, this application also provides a computer program product. The computer program product includes a computer program that, when executed by a processor, performs the following steps:
[0040] Obtain the first voltage at the first terminal of the second sampling resistor and the second voltage at the second terminal of the first sampling resistor;
[0041] Calculate the current flowing through the motor based on the first voltage and the second voltage;
[0042] If the current flowing through the motor is greater than the first preset threshold and less than the second preset threshold, the motor is controlled to discharge. After the discharge time of the motor reaches the preset time, the first voltage and the second voltage are reacquired, and the current flowing through the motor is recalculated until the current flowing through the motor is not greater than the first preset threshold.
[0043] If the current flowing through the motor is not less than the second preset threshold, the power supply to the motor will be turned off and a warning will be issued.
[0044] The aforementioned motor control method, device, computer equipment, storage medium, and computer program product acquire a first voltage at the first terminal of the second sampling resistor and a second voltage at the second terminal of the first sampling resistor; calculate the motor current based on the first and second voltages; if the current is greater than a first preset threshold but less than a second preset threshold, control the motor to discharge; after the motor discharge duration reaches a preset duration, reacquire the first and second voltages and recalculate the motor current until the current is no greater than the first preset threshold; if the current is no less than the second preset threshold, shut off the motor power and provide a warning. Closed-loop control is achieved by monitoring the motor circuit current. By setting different thresholds to determine the current state of the motor, different control methods are used to control the motor, achieving current limiting protection under motor stall conditions and improving the reliability of motor control. Attached Figure Description
[0045] Figure 1 This is a flowchart illustrating a motor control method in one embodiment;
[0046] Figure 2 This is a schematic diagram of a motor control circuit in one embodiment;
[0047] Figure 3 This is a flowchart illustrating the motor control method in another embodiment;
[0048] Figure 4 This is a flowchart illustrating the motor control method in yet another embodiment;
[0049] Figure 5 This is a schematic diagram of the motor control circuit in another embodiment;
[0050] Figure 6 This is a structural block diagram of the motor control device in one embodiment;
[0051] Figure 7 This is an internal structural diagram of a computer device in one embodiment. Detailed Implementation
[0052] To make the objectives, technical solutions, and advantages of this application clearer, the following detailed description is provided in conjunction with the accompanying drawings and embodiments. It should be understood that the specific embodiments described herein are merely illustrative and not intended to limit the scope of this application.
[0053] With the advancement of automotive electrification, the use of electric motors in automobiles is gradually increasing. Motor stall occurs when the motor fails to start or stop due to excessive load, mechanical failure of the driven component, or bearing damage. When a motor is stalled, its power factor is extremely low, and the stall current (called stall current) is very high; prolonged stalling can burn out the motor.
[0054] In related technologies, motor stall protection uses a position sensor to obtain the position of the motor rotor, determines whether the motor is stalled, and then implements corresponding protection strategies. Because this method relies on position and does not consider the current in the motor circuit, it cannot achieve closed-loop control of the circuit current, resulting in slow protection and potentially causing excessively high temperatures in the motor current circuit, which can easily damage components.
[0055] In one embodiment, such as Figure 1 As shown, a motor control method is provided. This method is applied to a terminal and achieves motor control by controlling a motor control circuit. The motor control circuit includes four MOSFETs, a first sampling resistor, and a second sampling resistor. The first and fourth MOSFETs constitute a first driving circuit for the motor, and the second and third MOSFETs constitute a second driving circuit for the motor. The first terminal of the first sampling resistor is connected to the power supply, and the second terminal of the first sampling resistor is connected to the drain of both the first and second MOSFETs. The first terminal of the second sampling resistor is connected to the source of both the third and fourth MOSFETs, and the second terminal of the second sampling resistor is grounded. The method includes the following steps:
[0056] Step 102: Obtain the first voltage at the first terminal of the second sampling resistor and the second voltage at the second terminal of the first sampling resistor;
[0057] It should be noted that the motor control circuit in this embodiment consists of four MOSFETs, a first sampling resistor, and a second sampling resistor. (See [link to documentation]). Figure 2 The four MOSFETs are arranged in a shape similar to the letter "H," hence the motor control circuit is also called an H-bridge circuit. In an H-bridge control circuit, the motor, as the load, is mounted on a fan-shaped structure like a bridge, with the four MOSFETs positioned as four "bridge arms." Figure 2 In the H-bridge control circuit shown, when the first MOSFET Q1 and the fourth MOSFET Q4 are turned on, the current flows from the positive terminal of the power supply through the first sampling resistor R1 and Q1, from left to right through the motor, and then through Q4 and the second sampling resistor R2 back to the negative terminal of the power supply. This current flow will drive the motor to rotate clockwise, and this is the first drive circuit for the motor. When the second MOSFET Q2 and the third MOSFET Q3 are turned on, the current flows from the positive terminal of the power supply through R1 and Q2, from right to left through the motor, and then through Q4 and R2 back to the negative terminal of the power supply. This current flow will drive the motor to rotate counterclockwise, and this is the second drive circuit for the motor.
[0058] As can be seen from the circuit structure, when the motor circuit is conducting, the first sampling resistor and the second sampling resistor are connected in series with the motor, and the current flowing through them is the same. Therefore, the sampling resistors are used to obtain the current value of the motor. Both the first and second sampling resistors are chosen to be resistors with small resistance values. The resistance values of the first and second sampling resistors can be the same or different, and this application does not impose any specific limitations on this.
[0059] The first voltage is the voltage across one end of the second sampling resistor. Based on the connection position of the second sampling resistor in the circuit structure, the voltage across the second sampling resistor can be determined. Similarly, the voltage across the first sampling resistor can be determined based on the second voltage. Based on the voltage across the resistor and the resistance value, the current flowing through it can be determined. In some embodiments, the motor control method can also be tested based on the first and second sampling resistors. For example, when the resistance values of the first and second sampling resistors are the same, the current flowing through them is the same, and the voltage across them should be the same. The voltage sampling sensor can be tested based on this condition.
[0060] The motor control method provided in this application begins each time the motor is powered on, at which time the H-bridge is turned on. The motor is then controlled by the motor control method provided in this application. If the motor needs to be shut down during the motor control process, the operating condition of the motor is re-evaluated according to the motor control method provided in this application after the motor is restarted, and corresponding protection control steps are executed for each operating condition.
[0061] Step 104: Calculate the current flowing through the motor based on the first voltage and the second voltage;
[0062] Based on the circuit structure of the motor control circuit, the current flowing through the motor circuit can be determined according to the second voltage and the first voltage of the first sampling resistor. It should be noted that in the motor drive circuit, the MOSFET acts as a switch. In a drive circuit, all electronic components are connected in series. Based on this series connection, the current in the circuit can be calculated, which is the current flowing through the motor. According to the motor structure, the current flowing through the motor refers to the current that the motor drives the load.
[0063] Step 106: When the current flowing through the motor is greater than the first preset threshold and less than the second preset threshold, control the motor to discharge. After the motor discharge time reaches the preset time, reacquire the first voltage and the second voltage, and recalculate the current flowing through the motor until the current flowing through the motor is not greater than the first preset threshold.
[0064] The first preset threshold indicates the minimum current value when the motor is in a stalled state, and the second preset threshold indicates the minimum current value when the motor is in a short-circuit state. It can be understood that compared to the rated current of the motor during normal operation, the stator current in the motor changes with the load size when the motor is in a stalled state; a small load corresponds to a small current, and a large load corresponds to a large current. Stalled state means controlling the rotor to a stationary state. To change this stationary state, the stator must have a sufficiently large force to change this inertia, which inevitably corresponds to a large current. When the motor is in a short-circuit state, the load impedance of the motor suddenly changes, and the load current of the motor suddenly increases. Therefore, the first preset threshold is set lower than the second preset threshold.
[0065] According to the principle of conservation of energy, in a motor, when electrical energy is connected to a coil (i.e., an inductor), it is converted into magnetic energy. Magnetic field energy is relatively easy to convert into electrical energy automatically. When the motor power is turned off, the magnetic energy stored in the coil is converted into electrical energy to compensate for the gradually disappearing electric field. Externally, the current in the coil will slowly decrease. In other words, when the motor experiences a stall condition, resulting in excessive current, discharging the motor can reduce the current flow, thus protecting the motor.
[0066] The preset duration is used to discharge the motor. Specifically, when the current flowing through the motor is greater than a first preset threshold but less than a second preset threshold, it is determined that the motor is in a stall condition. At this time, the motor is turned off to cut off the conduction of the H-bridge, and the motor is continuously discharged for t. off , where t off The motor is restarted after the preset discharge time to activate the H-bridge.
[0067] It should be noted that the preset duration t off The settings determine the operating state of the motor after discharge, based on the preset duration t. off The size may include: 1, t off If the time is long enough, the motor will discharge fully and return to normal operation; 2. t off If the discharge time is too short, the motor will not discharge sufficiently. When the discharge time t... off After the process ended, the motor remained stalled, and the controller restarted a new round of diagnostics. Because t off The current cannot be discharged within the detection cycle within a short time, so the current will gradually accumulate until it exceeds the second preset threshold, causing the H-bridge to enter a near-short-circuit state; 3. When t offWhen the time is between these two states, the motor cannot return to normal operation after the current is discharged. It will enter a locked state, return to normal operation, and then enter a locked state cycle. During this time, the current magnitude will fluctuate around the first preset threshold and cannot continuously return to normal operation.
[0068] In this process, the current stored in the motor coil can be discharged through the body diode integrated in the MOSFET in the motor control circuit. By turning off all the MOSFETs, the current can be discharged along the body diode.
[0069] Step 108: If the current flowing through the motor is not less than the second preset threshold, turn off the power supply to the motor and provide a warning.
[0070] As explained above, when the current flowing through the motor is not less than the second preset threshold, it indicates that the motor is in a short circuit or other state that causes extremely high current. At this time, the extremely high current will cause the motor to burn out and be damaged. Therefore, the motor power is turned off and the motor is left to wait for the staff to check and then manually power it on.
[0071] After the motor power is turned off, the motor control system can remind the staff to check the motor in a variety of ways, such as by flashing indicator lights, sounding a buzzer alarm, or displaying the motor status on the display interface of the motor control system.
[0072] In the method provided in the above embodiments, a first voltage at the first terminal of the second sampling resistor and a second voltage at the second terminal of the first sampling resistor are obtained; the current flowing through the motor is calculated based on the first and second voltages; if the current flowing through the motor is greater than a first preset threshold but less than a second preset threshold, the motor is controlled to discharge, and after the motor discharge time reaches a preset time, the first and second voltages are obtained again, and the current flowing through the motor is recalculated until the current flowing through the motor is not greater than the first preset threshold; if the current flowing through the motor is not less than the second preset threshold, the power supply to the motor is turned off, and a warning is provided. Closed-loop control is performed by monitoring the motor circuit current. By setting different thresholds to determine the current state of the motor, different methods are used to control the motor, achieving current limiting protection under motor stall conditions and improving the reliability of motor control.
[0073] In one embodiment, see Figure 3 Based on the first voltage and the second voltage, calculate the current flowing through the motor, including:
[0074] Step 302: Take the time when the first voltage is acquired as the current time, and determine the target drive circuit where the motor is located at the current time. The target drive circuit is either the first drive circuit or the second drive circuit.
[0075] Here, the target drive circuit refers to the drive circuit where the motor is currently in its current state, for example, according to Figure 2 It can be seen that when the motor rotates forward, the target drive circuit is the first drive circuit, which drives the motor by the first MOSFET and the fourth MOSFET; when the motor rotates in reverse, the target drive circuit is the second drive circuit, which drives the motor by the second MOSFET and the third MOSFET.
[0076] Step 304: Determine the voltage across the motor based on the on-state voltage of the two MOSFETs in the target drive circuit, the first voltage, and the second voltage.
[0077] Based on the series connection between the MOSFET and the motor in the target drive circuit, and combined with the power supply voltage, the voltage across the motor is determined using the following formula:
[0078] U M =V CC -U1-U2-2×u GS ;
[0079] Among them, U M V is the voltage across the motor. CC U1 is the power supply voltage; U2 is the first voltage; U3 is the second voltage; u4 is the power supply voltage. GS This is the turn-on voltage of the MOSFET.
[0080] Step 306: Calculate the current flowing through the motor based on the voltage across the motor terminals.
[0081] The impedance of the load driven by the motor is known, and the current flowing through the motor can be calculated according to Ohm's law.
[0082] In the method provided in the above embodiments, the current flowing through the motor is calculated by the conduction voltage of the MOSFET. Even without using a sampling resistor and a position sensor at the same time, the motor current can be obtained, thereby judging the operating condition of the motor. When the motor is stalled or short-circuited, the motor can be controlled and protected.
[0083] In one embodiment, the current flowing through the motor is calculated based on the first voltage and the second voltage, including:
[0084] Calculate the first current flowing through the second sampling resistor based on the first voltage;
[0085] Calculate the second current flowing through the first sampling resistor based on the second voltage and the voltage value of the power supply;
[0086] When the first current equals the second current, the first current is taken as the current flowing through the motor.
[0087] It should be noted that the first voltage is the voltage at the first terminal of the second sampling resistor, and the second voltage is the voltage at the second terminal of the first sampling resistor. When calculating the voltage across the resistor using Ohm's law, the voltage difference across the resistor is required. The voltage difference across the first sampling resistor is determined based on the second voltage and the power supply, thus allowing the calculation of the second current flowing through the first sampling resistor. Since the second terminal of the second sampling resistor is grounded, the voltage difference across the second sampling resistor is equal to the first voltage, allowing the calculation of the first current flowing through the second sampling resistor.
[0088] Based on the series relationship between the first and second sampling resistors, when the resistance values of the first and second sampling resistors are equal, the first current should be equal to the second current. In this case, if the first current is equal to the second current, the first current or the second current is taken as the current flowing through the motor. If the two are not equal, it indicates that there is an abnormality in the voltage sampling process or the motor operation process. The motor should be shut down and the operator should wait for inspection.
[0089] In some embodiments, if the resistance values of the first sampling resistor and the second sampling resistor are equal, the voltage difference across the first sampling resistor and the voltage difference across the second sampling resistor can be obtained first. By judging the magnitude of the two, if they are equal, the current flowing through the motor only needs to be calculated based on the voltage difference across one of the sampling resistors and its resistance value.
[0090] In the method provided in the above embodiments, the motor current is determined by the current of the sampling resistor, eliminating the need for direct measurement of the motor current. Furthermore, the state of the motor control circuit can be judged through two sampling resistors, avoiding errors in the motor control circuit and ensuring more accurate and effective control of the motor.
[0091] In one embodiment, the target driving circuit is a first driving circuit; correspondingly, controlling the motor to discharge includes:
[0092] The first and second MOSFETs are controlled to be in an off state, and the third and fourth MOSFETs are controlled to be in a conducting state.
[0093] In a circuit, a MOSFET is equivalent to a switch. When a MOSFET is turned on, it is like a "closed switch," meaning the circuit is open and current can flow through the MOSFET. When a MOSFET is turned off, it is like a "open switch," meaning the circuit is open but current cannot flow through the MOSFET.
[0094] exist Figure 2In the first driving circuit, there are first MOSFETs Q1 and Q4. Currently, the current in the motor flows from left to right. When discharging the motor, the upper bridge arms Q1 and Q2 are turned off, and the lower bridge arms Q3 and Q4 are turned on. The current in the motor coil still flows from left to right. At this time, because the two MOSFETs in the lower bridge arm are in a conducting state, the motor is theoretically equivalent to a short circuit across the motor coil. The current energy is circulated and consumed in the closed-loop system composed of the motor coil, Q3, and Q4, thus achieving the purpose of discharging the motor coil.
[0095] In the method provided in the above embodiments, the motor discharge is achieved through the lower bridge arm of the H-bridge control circuit. During the discharge process, less heat is generated on the motor coil, and the motor coil discharge can be completed quickly, which can effectively control the motor and better protect the motor.
[0096] In one embodiment, the target driving circuit is a first driving circuit; correspondingly, controlling the motor to discharge includes:
[0097] The first and fourth MOSFETs are controlled to be in an off state, and the second and third MOSFETs are controlled to be in a conducting state.
[0098] Since the target drive circuit for the motor is the first drive circuit, the current flow inside the motor is from left to right at this time. After the motor is turned off, the first and fourth MOSFETs are turned off, and the second and third MOSFETs are turned on. The current in the motor coil still flows from left to right during the initial stage of shutdown, passing through the second and third MOSFETs, so that the energy in the motor coil is circulated into the power supply system.
[0099] In the method provided in the above embodiments, another drive circuit of the motor makes the voltage applied to the motor coil and the current therein opposite in direction, thereby causing the current in the motor coil to decay rapidly and circulating the energy into the power supply system to protect the motor control system.
[0100] In one embodiment, after calculating the current flowing through the motor based on the first voltage and the second voltage, the method further includes:
[0101] If the current flowing through the resistor is not greater than the first preset threshold, return to the step of obtaining the first voltage at the first end of the second sampling resistor and the second voltage at the second end of the first sampling resistor.
[0102] When the current flowing through the motor is not greater than the first preset threshold, the motor operates normally. For the subsequent operation of the motor, real-time monitoring can be adopted, that is, the first voltage and the second voltage are acquired in real time, the current flowing through the motor is calculated, and the operating condition of the motor is judged. Alternatively, the motor status can be monitored periodically, that is, the first voltage and the second voltage are acquired in each preset cycle, the current flowing through the motor is calculated, and the operating condition of the motor is judged.
[0103] In the method provided in the above embodiments, if the current flowing through the device is not greater than a first preset threshold, the steps of obtaining the first voltage at the first end of the second sampling resistor and the second voltage at the second end of the first sampling resistor are returned. Closed-loop control is performed by monitoring the motor circuit current. By setting different thresholds to determine the current state of the motor, different methods are used to control the motor, achieving current limiting protection under motor stall conditions and improving the reliability of motor control.
[0104] In one embodiment, see Figure 4 The CL threshold is the first preset threshold, and the CL state indicates a stalled motor condition. The OC threshold is the second preset threshold, and the OC state indicates a short-circuit motor condition. The CL threshold is less than the OC threshold. The motor control circuit is controlled by a controller; see [link to relevant documentation]. Figure 5 , Figure 5 The right side shows the H-bridge drive structure, which consists of 4 MOSFETs, a motor, and a sampling resistor; Figure 5 The left side is the controller, where pins 1, 2, 3, and 4 are used to control the four MOSFETs of the H-bridge, respectively; pin 5 is used to acquire the voltage across the first sampling resistor; and pin 6 is used to acquire the voltage across the second sampling resistor. By acquiring the voltages across the first and second sampling resistors, the current in the motor circuit is calculated. The current in the motor circuit is compared with the CL threshold and the OC threshold to determine the current operating state of the motor.
[0105] It should be understood that although the steps in the flowcharts of the above embodiments are shown sequentially according to the arrows, these steps are not necessarily executed in the order indicated by the arrows. Unless explicitly stated herein, there is no strict order restriction on the execution of these steps, and they can be executed in other orders. Moreover, at least some steps in the flowcharts of the above embodiments may include multiple steps or multiple stages. These steps or stages are not necessarily completed at the same time, but can be executed at different times. The execution order of these steps or stages is not necessarily sequential, but can be performed alternately or in turn with other steps or at least some of the steps or stages of other steps.
[0106] Based on the same inventive concept, this application also provides a motor control device for implementing the motor control method described above. The solution provided by this device is similar to the solution described in the above method; therefore, the specific limitations in one or more motor control device embodiments provided below can be found in the limitations of the motor control method described above, and will not be repeated here.
[0107] In one embodiment, such as Figure 6 As shown, a motor control device is provided, applied to a motor control circuit. The motor control circuit includes four MOSFETs, a first sampling resistor, and a second sampling resistor. The first and fourth MOSFETs constitute a first driving circuit for the motor, and the second and third MOSFETs constitute a second driving circuit for the motor. The first terminal of the first sampling resistor is connected to a power supply, and the second terminal of the first sampling resistor is connected to the drain of both the first and second MOSFETs. The first terminal of the second sampling resistor is connected to the source of both the third and fourth MOSFETs, and the second terminal of the second sampling resistor is grounded. The device includes an acquisition module 601, a calculation module 602, a first control module 603, and a second control module 604.
[0108] The acquisition module 601 is used to acquire the first voltage at the first terminal of the second sampling resistor and the second voltage at the second terminal of the first sampling resistor;
[0109] The calculation module 602 is used to calculate the current flowing through the motor based on the first voltage and the second voltage;
[0110] The first control module 603 is used to control the motor to discharge when the current flowing through it is greater than a first preset threshold and less than a second preset threshold, and after the discharge time of the motor reaches a preset time, to reacquire the first voltage and the second voltage, and recalculate the current flowing through the motor until the current flowing through it is not greater than the first preset threshold.
[0111] The second control module 604 is used to shut off the power supply to the motor and provide a warning when the current flowing through it is not less than a second preset threshold.
[0112] In one embodiment, the computing module 602 is further configured to:
[0113] The moment when the first voltage is acquired is taken as the current moment. The target drive circuit where the motor is located at the current moment is determined. The target drive circuit is either the first drive circuit or the second drive circuit.
[0114] Determine the voltage across the motor based on the on-state voltage, the first voltage, and the second voltage of the two MOSFETs in the target drive circuit.
[0115] Calculate the current flowing through the motor based on the voltage across the motor terminals.
[0116] In one embodiment, the computing module 602 is further configured to:
[0117] Calculate the first current flowing through the second sampling resistor based on the first voltage;
[0118] Calculate the second current flowing through the first sampling resistor based on the second voltage and the voltage value of the power supply;
[0119] When the first current equals the second current, the first current is taken as the current flowing through the motor.
[0120] In one embodiment, the target driving circuit is a first driving circuit; correspondingly, the first control module 603 is further configured to:
[0121] The first and second MOSFETs are controlled to be in an off state, and the third and fourth MOSFETs are controlled to be in a conducting state.
[0122] In one embodiment, the target driving circuit is a first driving circuit; correspondingly, the first control module 603 is further configured to:
[0123] The first and fourth MOSFETs are controlled to be in an off state, and the second and third MOSFETs are controlled to be in a conducting state.
[0124] In one embodiment, the motor control device further includes a third control module, which is used for:
[0125] If the current flowing through the resistor is not greater than the first preset threshold, return to the step of obtaining the first voltage at the first end of the second sampling resistor and the second voltage at the second end of the first sampling resistor.
[0126] Each module in the aforementioned motor control device can be implemented entirely or partially through software, hardware, or a combination thereof. These modules can be embedded in the processor of a computer device in hardware form or independent of it, or stored in the memory of a computer device in software form, so that the processor can call and execute the operations corresponding to each module.
[0127] In one embodiment, a computer device is provided, which may be a terminal, and its internal structure diagram may be as follows: Figure 7As shown, the computer device includes a processor, memory, communication interface, display screen, and input devices connected via a system bus. The processor provides computing and control capabilities. The memory includes non-volatile storage media and internal memory. The non-volatile storage media stores the operating system and computer programs. The internal memory provides an environment for the operation of the operating system and computer programs stored in the non-volatile storage media. The communication interface is used for wired or wireless communication with external terminals; wireless communication can be achieved through Wi-Fi, mobile cellular networks, NFC (Near Field Communication), or other technologies. When the computer program is executed by the processor, it implements a motor control method. The display screen can be an LCD screen or an e-ink screen. The input devices can be a touch layer covering the display screen, buttons, a trackball, or a touchpad mounted on the computer device casing, or an external keyboard, touchpad, or mouse.
[0128] Those skilled in the art will understand that Figure 7 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 computer device to which the present application is applied. Specific computer devices may include more or fewer components than those shown in the figure, or combine certain components, or have different component arrangements.
[0129] In one embodiment, a computer device is provided, including a memory and a processor, wherein the memory stores a computer program, and the processor executes the computer program to perform the following steps:
[0130] Obtain the first voltage at the first terminal of the second sampling resistor and the second voltage at the second terminal of the first sampling resistor;
[0131] Calculate the current flowing through the motor based on the first voltage and the second voltage;
[0132] If the current flowing through the motor is greater than the first preset threshold and less than the second preset threshold, the motor is controlled to discharge. After the discharge time of the motor reaches the preset time, the first voltage and the second voltage are reacquired, and the current flowing through the motor is recalculated until the current flowing through the motor is not greater than the first preset threshold.
[0133] If the current flowing through the motor is not less than the second preset threshold, the power supply to the motor will be turned off and a warning will be issued.
[0134] In one embodiment, the processor, when executing a computer program, also performs the following steps:
[0135] The moment when the first voltage is acquired is taken as the current moment. The target drive circuit where the motor is located at the current moment is determined. The target drive circuit is either the first drive circuit or the second drive circuit.
[0136] Determine the voltage across the motor based on the on-state voltage, the first voltage, and the second voltage of the two MOSFETs in the target drive circuit.
[0137] Calculate the current flowing through the motor based on the voltage across the motor terminals.
[0138] In one embodiment, the processor, when executing a computer program, also performs the following steps:
[0139] Calculate the first current flowing through the second sampling resistor based on the first voltage;
[0140] Calculate the second current flowing through the first sampling resistor based on the second voltage and the voltage value of the power supply;
[0141] When the first current equals the second current, the first current is taken as the current flowing through the motor.
[0142] In one embodiment, the processor, when executing a computer program, also performs the following steps:
[0143] The first and second MOSFETs are controlled to be in an off state, and the third and fourth MOSFETs are controlled to be in a conducting state.
[0144] In one embodiment, the processor, when executing a computer program, also performs the following steps:
[0145] The first and fourth MOSFETs are controlled to be in an off state, and the second and third MOSFETs are controlled to be in a conducting state.
[0146] In one embodiment, the processor, when executing a computer program, also performs the following steps:
[0147] If the current flowing through the resistor is not greater than the first preset threshold, return to the step of obtaining the first voltage at the first end of the second sampling resistor and the second voltage at the second end of the first sampling resistor.
[0148] In one embodiment, a computer-readable storage medium is provided having a computer program stored thereon, the computer program performing the following steps when executed by a processor:
[0149] Obtain the first voltage at the first terminal of the second sampling resistor and the second voltage at the second terminal of the first sampling resistor;
[0150] Calculate the current flowing through the motor based on the first voltage and the second voltage;
[0151] If the current flowing through the motor is greater than the first preset threshold and less than the second preset threshold, the motor is controlled to discharge. After the discharge time of the motor reaches the preset time, the first voltage and the second voltage are reacquired, and the current flowing through the motor is recalculated until the current flowing through the motor is not greater than the first preset threshold.
[0152] If the current flowing through the motor is not less than the second preset threshold, the power supply to the motor will be turned off and a warning will be issued.
[0153] In one embodiment, when the computer program is executed by a processor, it further performs the following steps:
[0154] The moment when the first voltage is acquired is taken as the current moment. The target drive circuit where the motor is located at the current moment is determined. The target drive circuit is either the first drive circuit or the second drive circuit.
[0155] Determine the voltage across the motor based on the on-state voltage, the first voltage, and the second voltage of the two MOSFETs in the target drive circuit.
[0156] Calculate the current flowing through the motor based on the voltage across the motor terminals.
[0157] In one embodiment, when the computer program is executed by a processor, it further performs the following steps:
[0158] Calculate the first current flowing through the second sampling resistor based on the first voltage;
[0159] Calculate the second current flowing through the first sampling resistor based on the second voltage and the voltage value of the power supply;
[0160] When the first current equals the second current, the first current is taken as the current flowing through the motor.
[0161] In one embodiment, when the computer program is executed by a processor, it further performs the following steps:
[0162] The first and second MOSFETs are controlled to be in an off state, and the third and fourth MOSFETs are controlled to be in a conducting state.
[0163] In one embodiment, when the computer program is executed by a processor, it further performs the following steps:
[0164] The first and fourth MOSFETs are controlled to be in an off state, and the second and third MOSFETs are controlled to be in a conducting state.
[0165] In one embodiment, when the computer program is executed by a processor, it further performs the following steps:
[0166] If the current flowing through the resistor is not greater than the first preset threshold, return to the step of obtaining the first voltage at the first end of the second sampling resistor and the second voltage at the second end of the first sampling resistor.
[0167] In one embodiment, a computer program product is provided, including a computer program that, when executed by a processor, performs the following steps:
[0168] Obtain the first voltage at the first terminal of the second sampling resistor and the second voltage at the second terminal of the first sampling resistor;
[0169] Calculate the current flowing through the motor based on the first voltage and the second voltage;
[0170] If the current flowing through the motor is greater than the first preset threshold and less than the second preset threshold, the motor is controlled to discharge. After the discharge time of the motor reaches the preset time, the first voltage and the second voltage are reacquired, and the current flowing through the motor is recalculated until the current flowing through the motor is not greater than the first preset threshold.
[0171] If the current flowing through the motor is not less than the second preset threshold, the power supply to the motor will be turned off and a warning will be issued.
[0172] In one embodiment, when the computer program is executed by a processor, it further performs the following steps:
[0173] The moment when the first voltage is acquired is taken as the current moment. The target drive circuit where the motor is located at the current moment is determined. The target drive circuit is either the first drive circuit or the second drive circuit.
[0174] Determine the voltage across the motor based on the on-state voltage, the first voltage, and the second voltage of the two MOSFETs in the target drive circuit.
[0175] Calculate the current flowing through the motor based on the voltage across the motor terminals.
[0176] In one embodiment, when the computer program is executed by a processor, it further performs the following steps:
[0177] Calculate the first current flowing through the second sampling resistor based on the first voltage;
[0178] Calculate the second current flowing through the first sampling resistor based on the second voltage and the voltage value of the power supply;
[0179] When the first current equals the second current, the first current is taken as the current flowing through the motor.
[0180] In one embodiment, when the computer program is executed by a processor, it further performs the following steps:
[0181] The first and second MOSFETs are controlled to be in an off state, and the third and fourth MOSFETs are controlled to be in a conducting state.
[0182] In one embodiment, when the computer program is executed by a processor, it further performs the following steps:
[0183] The first and fourth MOSFETs are controlled to be in an off state, and the second and third MOSFETs are controlled to be in a conducting state.
[0184] In one embodiment, when the computer program is executed by a processor, it further performs the following steps:
[0185] If the current flowing through the resistor is not greater than the first preset threshold, return to the step of obtaining the first voltage at the first end of the second sampling resistor and the second voltage at the second end of the first sampling resistor.
[0186] Those skilled in the art will understand that all or part of the processes in the methods of the above embodiments can be implemented by a computer program instructing related hardware. The computer program can be stored in a non-volatile computer-readable storage medium, and when executed, it can include the processes of the embodiments of the above methods. Any references to memory, databases, or other media used in the embodiments provided in this application can include at least one of non-volatile and volatile memory. Non-volatile memory can include read-only memory (ROM), magnetic tape, floppy disk, flash memory, optical memory, high-density embedded non-volatile memory, resistive random access memory (ReRAM), magnetic random access memory (MRAM), ferroelectric random access memory (FRAM), phase change memory (PCM), graphene memory, etc. Volatile memory can include random access memory (RAM) or external cache memory, etc. By way of illustration and not limitation, RAM can take many forms, such as Static Random Access Memory (SRAM) or Dynamic Random Access Memory (DRAM). The databases involved in the embodiments provided in this application may include at least one type of relational database and non-relational database. Non-relational databases may include, but are not limited to, blockchain-based distributed databases. The processors involved in the embodiments provided in this application may be general-purpose processors, central processing units, graphics processing units, digital signal processors, programmable logic devices, quantum computing-based data processing logic devices, etc., and are not limited to these.
[0187] The technical features of the above embodiments can be combined in any way. For the sake of brevity, not all possible combinations of the technical features in the above embodiments are described. However, as long as there is no contradiction in the combination of these technical features, they should be considered to be within the scope of this specification.
[0188] The embodiments described above are merely illustrative of several implementation methods of this application, and while the descriptions are specific and detailed, they should not be construed as limiting the scope of this patent application. It should be noted that those skilled in the art can make various modifications and improvements without departing from the concept of this application, and these all fall within the protection scope of this application. Therefore, the protection scope of this application should be determined by the appended claims.
Claims
1. A motor control method, characterized in that, The method is applied to a motor control circuit, which includes four MOSFETs, a first sampling resistor, and a second sampling resistor. The first and fourth MOSFETs constitute a first driving circuit for the motor, and the second and third MOSFETs constitute a second driving circuit for the motor. The first terminal of the first sampling resistor is connected to a power supply, and the second terminal is connected to the drain of both the first and second MOSFETs. The first terminal of the second sampling resistor is connected to the source of both the third and fourth MOSFETs, and the second terminal is grounded. Obtain the first voltage at the first terminal of the second sampling resistor and the second voltage at the second terminal of the first sampling resistor; Calculate the current flowing through the motor based on the first voltage and the second voltage; If the current flowing through the motor is greater than a first preset threshold and less than a second preset threshold, the motor is controlled to discharge. After the discharge time of the motor reaches a preset time, the first voltage and the second voltage are reacquired, and the current flowing through the motor is recalculated until the current flowing through the motor is not greater than the first preset threshold. If the current flowing through the motor is not less than the second preset threshold, the power supply to the motor is turned off and a warning is provided. The step of calculating the current flowing through the motor based on the first voltage and the second voltage includes: taking the time when the first voltage is acquired as the current time, determining the target driving circuit where the motor is located at the current time, wherein the target driving circuit is either the first driving circuit or the second driving circuit; determining the voltage across the motor based on the on-state voltage of the two MOSFETs in the target driving circuit, the first voltage, and the second voltage; and calculating the current flowing through the motor based on the voltage across the motor. The step of calculating the current flowing through the motor based on the first voltage and the second voltage includes: calculating a first current flowing through the second sampling resistor based on the first voltage; calculating a second current flowing through the first sampling resistor based on the second voltage and the voltage value of the power supply; if the first current and the second current are not equal, it indicates that there is an abnormality in the voltage sampling process or the motor operation process, and the motor is shut down.
2. The method according to claim 1, characterized in that, The target driving circuit is a first driving circuit; correspondingly, controlling the motor to discharge includes: The first and second MOSFETs are controlled to be in an off state, and the third and fourth MOSFETs are controlled to be in a conducting state.
3. The method according to claim 1, characterized in that, The target driving circuit is a first driving circuit; correspondingly, controlling the motor to discharge includes: The first MOSFET and the fourth MOSFET are controlled to be in an off state, and the second MOSFET and the third MOSFET are controlled to be in a conducting state.
4. The method according to claim 1, characterized in that, The step of calculating the current flowing through the motor based on the first voltage and the second voltage further includes: If the current flowing through the resistor is not greater than a first preset threshold, return to the step of obtaining the first voltage at the first end of the second sampling resistor and the second voltage at the second end of the first sampling resistor.
5. A motor control device, characterized in that, This device is applied to a motor control circuit, which includes four MOSFETs, a first sampling resistor, and a second sampling resistor. The first and fourth MOSFETs constitute a first driving circuit for the motor, and the second and third MOSFETs constitute a second driving circuit for the motor. The first terminal of the first sampling resistor is connected to a power supply, and the second terminal is connected to the drain of both the first and second MOSFETs. The first terminal of the second sampling resistor is connected to the source of both the third and fourth MOSFETs, and the second terminal is grounded. The acquisition module is used to acquire the first voltage at the first terminal of the second sampling resistor and the second voltage at the second terminal of the first sampling resistor; A calculation module is used to calculate the current flowing through the motor based on the first voltage and the second voltage; The first control module is used to control the motor to discharge when the current flowing through it is greater than a first preset threshold and less than a second preset threshold, and after the discharge time of the motor reaches a preset time, to reacquire the first voltage and the second voltage, and recalculate the current flowing through the motor until the current flowing through it is not greater than the first preset threshold. The second control module is used to shut off the power supply of the motor and provide a warning when the current flowing through it is not less than the second preset threshold. The calculation module is also used to: take the acquisition time of the first voltage as the current time, determine the target driving circuit where the motor is at the current time, and the target driving circuit is either the first driving circuit or the second driving circuit; determine the voltage across the motor based on the on-state voltage of the two MOS transistors in the target driving circuit, the first voltage, and the second voltage; and calculate the current flowing through the motor based on the voltage across the motor. The calculation module is also used to calculate a first current flowing through the second sampling resistor based on the first voltage; calculate a second current flowing through the first sampling resistor based on the second voltage and the voltage value of the power supply; if the first current and the second current are not equal, it indicates that there is an abnormality in the voltage sampling process or the motor operation process, and the motor is shut down.
6. A computer device comprising a memory and a processor, wherein the memory stores a computer program, characterized in that, When the processor executes the computer program, it implements the steps of the method according to any one of claims 1 to 4.
7. A computer-readable storage medium having a computer program stored thereon, characterized in that, When the computer program is executed by a processor, it implements the steps of the method according to any one of claims 1 to 4.
8. A computer program product, comprising a computer program, characterized in that, When the computer program is executed by a processor, it implements the steps of the method according to any one of claims 1 to 4.
Citation Information
Patent Citations
Motor driving circuit
CN101783501A
Dc load driver
JP2002191122A