CN115425874A - Motor control method and system - Google Patents

Motor control method and system Download PDF

Info

Publication number
CN115425874A
CN115425874A CN202211005641.7A CN202211005641A CN115425874A CN 115425874 A CN115425874 A CN 115425874A CN 202211005641 A CN202211005641 A CN 202211005641A CN 115425874 A CN115425874 A CN 115425874A
Authority
CN
China
Prior art keywords
data
motor
storage data
counter
period
Prior art date
Legal status (The legal status is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the status listed.)
Withdrawn
Application number
CN202211005641.7A
Other languages
Chinese (zh)
Inventor
郗盛凯
袁国顺
孔德伟
Current Assignee (The listed assignees may be inaccurate. Google has not performed a legal analysis and makes no representation or warranty as to the accuracy of the list.)
Suzhou Motuo Semiconductor Technology Co ltd
Original Assignee
Suzhou Motuo Semiconductor Technology Co ltd
Priority date (The priority date is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the date listed.)
Filing date
Publication date
Application filed by Suzhou Motuo Semiconductor Technology Co ltd filed Critical Suzhou Motuo Semiconductor Technology Co ltd
Priority to CN202211005641.7A priority Critical patent/CN115425874A/en
Publication of CN115425874A publication Critical patent/CN115425874A/en
Withdrawn legal-status Critical Current

Links

Images

Classifications

    • HELECTRICITY
    • H02GENERATION; CONVERSION OR DISTRIBUTION OF ELECTRIC POWER
    • H02PCONTROL OR REGULATION OF ELECTRIC MOTORS, ELECTRIC GENERATORS OR DYNAMO-ELECTRIC CONVERTERS; CONTROLLING TRANSFORMERS, REACTORS OR CHOKE COILS
    • H02P6/00Arrangements for controlling synchronous motors or other dynamo-electric motors using electronic commutation dependent on the rotor position; Electronic commutators therefor
    • H02P6/08Arrangements for controlling the speed or torque of a single motor

Landscapes

  • Engineering & Computer Science (AREA)
  • Power Engineering (AREA)
  • Control Of Motors That Do Not Use Commutators (AREA)

Abstract

The invention provides a motor control method and a system, wherein the motor control method comprises the following steps: setting starting preparation for a motor, and determining the rotation direction and the period of the motor; starting the motor, setting output PWM waves according to the starting preparation, and acquiring an initial phase of the motor; counting through a counter to obtain counter data; and judging whether the rotating speed of the motor is stable according to the counter data, and adjusting the duty ratio of a PWM wave according to the calculator data when the rotating speed of the motor is stable to realize the adjustment of the rotating speed of the motor. The invention provides a motor control method and a motor control system, which realize the adjustment of the rotating speed of a motor by adopting simple steps, have low cost consumption and can ensure that the rotating speed of the motor meets the requirement in a short time.

Description

Motor control method and system
Technical Field
The invention relates to the technical field of electronics, in particular to a motor control method and system.
Background
The invention provides a motor control method and a system, which have the characteristics of high efficiency, good torque characteristic, high stability and the like, and are widely applied to the fields of industrial servo, automobiles and the like.
Disclosure of Invention
The present invention is directed to a method and a system for controlling a motor, so as to solve the problems in the background art.
In order to achieve the purpose, the invention provides the following technical scheme: a motor control method, comprising:
setting starting preparation for a motor, and determining the rotation direction and the period of the motor;
starting the motor, setting output PWM waves according to the starting preparation, and acquiring an initial phase of the motor;
counting through a counter to obtain counter data;
and judging whether the rotating speed of the motor is stable according to the counter data, and adjusting the duty ratio of a PWM wave according to the calculator data when the rotating speed of the motor is stable to realize the adjustment of the rotating speed of the motor.
Further, when the initial phase of the motor is obtained, the magnetic field change of the motor is induced through a Hall sensor to obtain sensor induction data, and the initial phase of the motor is obtained after digital filtering processing is carried out on the sensor induction data.
Further, when the counting is performed by the counter, the counter starts counting from zero, and when the motor rotates to the initial phase value again, the metering data of the counter when the motor rotates to the initial phase value again last time is stored as second storage data C2, and the metering data of the counter at this time is used as first storage data C1, and meanwhile, the counter is cleared to zero, and the counting is started from zero again.
Further, judging whether the rotating speed of the motor is stable according to the counter data comprises the following steps:
performing difference analysis on the first storage data C1 and the second storage data C2 to obtain difference data;
determining judgment reference data according to the first storage data C1, and taking data obtained by shifting the first storage data C1 by seven bits to the right as judgment reference data;
and judging by combining the difference data with the judgment reference data, when the difference data is smaller than the judgment reference data, the rotating speed of the motor reaches a stable state, at the moment, the duty ratio of a PWM wave is adjusted according to the first storage data C1, when the difference data is not smaller than the judgment reference data, the rotating speed of the motor does not reach the stable state, at the moment, the metering data of the counter is obtained again, the first storage data C1 and the second storage data C2 are updated, and then whether the rotating speed of the motor is stable is judged again according to the updated first storage data C1 and the updated second storage data C2.
Further, when the duty ratio of the PWM wave is adjusted according to the first storage data C1, a size determination is performed on the first storage data C1 and the period, when the first storage data C1 is not greater than the period, it is analyzed whether a difference between the first storage data C1 and the period is greater than a preset value, when it is analyzed that the difference between the first storage data C1 and the period is not greater than the preset value, the duty ratio of the PWM wave is increased according to an increase step, when the first storage data C1 is greater than the period, it is analyzed whether the difference between the first storage data C1 and the period is greater than the preset value, when the difference between the first storage data C1 and the period is greater than the preset value, the duty ratio of the PWM wave is decreased according to a decrease step, a new first storage data C1 is obtained again after the duty ratio of the PWM wave is increased or the duty ratio of the PWM wave is decreased, and a size determination is performed on the new first storage data C1 and the period until the first storage data C1 is less than the period, and the period meet a demand.
A motor control system comprising: the device comprises a preparation setting module, a starting acquisition module, a counting module and an analysis adjusting module;
the preparation setting module is used for carrying out starting preparation setting aiming at the motor and determining the rotation direction and the rotation period of the motor;
the starting acquisition module is used for starting the motor, enabling the motor to output PWM waves according to the starting preparation setting set by the preparation setting module, and acquiring the initial phase of the motor;
the counting module is used for counting the PWM waves output by the motor through a counter to obtain counter data;
and the analysis and adjustment module is used for judging whether the rotating speed of the motor is stable according to the counter data, and adjusting the duty ratio of PWM waves according to the calculator data when the rotating speed of the motor is stable, so that the rotating speed of the motor is adjusted.
Further, the start acquisition module comprises: the device comprises a starting unit, a collecting unit and a processing unit;
the starting unit is used for starting the motor;
the acquisition unit is used for sensing the magnetic field change of the motor by using the Hall sensor to obtain sensor sensing data;
and the processing unit is used for carrying out digital filtering processing on the sensor induction data obtained by the acquisition unit and determining the initial phase of the motor.
Further, when the counting module counts through a counter, and the counter starts counting from zero, and when the motor rotates to the initial phase value again, the counting data of the counter last time the motor rotates to the initial phase value again is stored as second storage data C2, and the counting data of the counter at this time is used as first storage data C1, and meanwhile, the counter is cleared and starts counting from zero again.
Further, the analysis adjusting module includes: a stability analysis unit and an analysis adjustment unit;
the stability analysis unit is used for judging whether the rotating speed of the motor is stable according to the counter data, and comprises: performing difference analysis on the first storage data C1 and the second storage data C2 to obtain difference data; determining judgment reference data according to the first storage data C1, and taking data obtained by shifting the first storage data C1 by seven bits to the right as judgment reference data; the difference data is combined with the judgment reference data for judgment, when the difference data is smaller than the judgment reference data, the rotating speed of the motor reaches a stable state, the first storage data C1 at the moment is transmitted to the analysis control unit, when the difference data is not smaller than the judgment reference data, the rotating speed of the motor does not reach the stable state, at the moment, the metering data of a counter in the counting module is obtained again, the first storage data C1 and the second storage data C2 are updated, and whether the rotating speed of the motor is stable or not is judged according to the updated first storage data C1 and the updated second storage data C2;
and the analysis adjusting unit is used for adjusting the duty ratio of the PWM wave according to the first storage data C1 transmitted by the stability analyzing unit.
Further, when the analysis and adjustment unit adjusts the duty ratio of the PWM wave according to the first storage data C1 transmitted by the stability analysis unit, the analysis and adjustment unit performs a size determination for the first storage data C1 and the period, when the first storage data C1 is not greater than the period, analyzes whether a difference between the first storage data C1 and the period is greater than a preset value, when the difference between the first storage data C1 and the period is not greater than the preset value, increases the duty ratio of the PWM wave according to an increase step, when the first storage data C1 is greater than the period, analyzes whether the difference between the first storage data C1 and the period is greater than the preset value, when the difference between the first storage data C1 and the period is greater than the preset value, decreases the duty ratio of the PWM wave according to a decrease step, reacquires the new first storage data C1 after increasing the duty ratio of the PWM wave or decreasing the duty ratio of the PWM wave, and performs a size determination for the new first storage data C1 and the period until the first storage data C1 is less than the period, and the motor period is less than the requirement.
Additional features and advantages of the invention will be set forth in the description which follows, and in part will be obvious from the description, or may be learned by the practice of the invention. The objectives and other advantages of the invention will be realized and attained by the structure particularly pointed out in the written description and claims hereof as well as the appended drawings.
The technical solution of the present invention is further described in detail by the accompanying drawings and embodiments.
Drawings
The accompanying drawings, which are included to provide a further understanding of the invention and are incorporated in and constitute a part of this specification, illustrate embodiments of the invention and together with the description serve to explain the principles of the invention and not to limit the invention. In the drawings:
FIG. 1 is a schematic step diagram of a motor control method according to the present invention;
fig. 2 is a schematic diagram illustrating a corresponding relationship between a clockwise phase and a PWM wave in a motor control method according to the present invention;
fig. 3 is a schematic diagram illustrating a corresponding relationship between a counterclockwise phase and a PWM wave in the motor control method according to the present invention;
fig. 4 is a schematic diagram of a second step in a motor control method according to the present invention;
fig. 5 is a schematic flow chart of a third step in the motor control method according to the present invention.
Fig. 6 is a schematic flow chart illustrating the step four of determining whether the rotation speed of the motor is stable according to the motor control method of the present invention.
Fig. 7 is a schematic flow chart illustrating the adjustment of the duty ratio of the PWM wave in step four of the motor control method according to the present invention;
fig. 8 is a schematic diagram of a motor control system according to the present invention.
Detailed Description
The preferred embodiments of the present invention will be described in conjunction with the accompanying drawings, and it will be understood that they are described herein for the purpose of illustration and explanation and not limitation.
As shown in fig. 1, an embodiment of the present invention provides a motor control method, including:
the method comprises the steps of firstly, carrying out starting preparation setting aiming at a motor, and determining the rotation direction and the rotation period of the motor;
step two, starting the motor, setting output PWM waves according to the starting preparation, and acquiring an initial phase of the motor;
counting through a counter to obtain counter data;
and fourthly, judging whether the rotating speed of the motor is stable according to the counter data, and adjusting the duty ratio of the PWM wave according to the calculator data when the rotating speed of the motor is stable to realize the adjustment of the rotating speed of the motor.
The technical scheme provides a motor control method, particularly self-adjustment is carried out on the rotating speed of a motor, and the process is as follows: firstly, starting preparation setting is carried out before the motor is started, the rotating direction and the period of the motor are set, then the motor is started after the setting is finished, PWM waves are output by the motor according to the set rotating direction and the set period, meanwhile, the initial phase of the motor is obtained, the counter counts the PWM waves after the motor is started, so that counter data are obtained, whether the rotating speed of the motor is stable or not is judged according to the counter data, if the rotating speed of the motor is stable, the duty ratio of the PWM waves is adjusted according to the counter data, the rotating speed of the motor is adjusted through the duty ratio of the PWM waves, and therefore the rotating speed of the motor is adjusted to meet requirements. Where the period of the PWM wave is T/60 (or less) clock cycles, where T is a period determined when the motor is ready to be started, the initial duty ratio D is 50%, and the correspondence between the phase and the PWM wave at the time of clockwise rotation is as shown in fig. 2, and the correspondence between the phase and the PWM wave at the time of counterclockwise rotation is as shown in fig. 3.
Above-mentioned technical scheme adopts simple step to realize the adjustment to motor speed, and not only cost consumption is little, but also can make motor speed accord with the demand in short time to above-mentioned technical scheme need not to stop the motor that starts in the adjustment process of motor speed and carries out the rotational speed adjustment, avoids stopping the loss that the motor caused to the motor many times, can also reduce the influence to motor efficiency simultaneously.
In one embodiment provided by the invention, when the initial phase of the motor is obtained, the magnetic field change of the motor is induced by the Hall sensor to obtain sensor induction data, and the initial phase of the motor is obtained after the sensor induction data is subjected to digital filtering.
As shown in fig. 4, in the above technical solution, when the initial phase of the motor is obtained, the hall sensor is used for acquiring data of the motor, the hall sensor is used for sensing a magnetic field change of the motor, so as to obtain sensor sensing data, then digital filtering is performed on the sensor sensing data, and a signal of the sensor sensing data output by the hall sensor is filtered by the digital filter, so as to obtain the initial phase of the motor.
According to the technical scheme, the magnetic field change of the Hall sensor induction motor is good in linearity, wide in application condition range and high in precision, the accuracy of sensor induction data can be guaranteed, and after the Hall sensor obtains the sensor induction data about the motor, the signal filtering of the sensor induction data is carried out through the digital filter, so that the noise in the signal of the sensor induction data can be reduced, the signal of the sensor induction data is optimized, and the accuracy of the initial phase of the motor is improved.
As shown in fig. 5, in an embodiment of the present invention, when the counter counts, the counter starts counting from zero, and when the motor rotates to the initial phase value again, the metering data of the counter last time the motor rotates to the initial phase value again is stored as the second storage data C2, and the metering data of the counter at this time is used as the first storage data C1, and the counter is cleared at the same time to start counting from zero again.
According to the technical scheme, when the counter is used for counting, the counter starts counting from zero, when the motor rotates to the initial phase value again, the counter performs data statistics, and when the metering data of the counter is obtained each time, the metering data of the counter when the motor rotates to the initial phase value again last time is stored as second storage data C2, the metering data of the counter at the moment is used as first storage data C1, meanwhile, the counter is cleared, and counting is started from zero again.
According to the technical scheme, automatic metering is achieved through the counter, metering data can be accurately obtained, errors are not prone to occurring, the metering data obtained each time are distinguished by storing the metering data of the counter into the second storage data C2 when the motor rotates to the initial phase value for the last time and using the metering data of the counter as the first storage data C1, confusion is avoided, the analysis difficulty of follow-up steps is reduced, data confusion is avoided, in addition, the complexity of the metering data can be reduced when the counter is reset to zero after the metering data of the counter is obtained each time, and the metering data can be conveniently and directly used for follow-up processing.
In an embodiment of the present invention, determining whether the rotation speed of the motor is stable according to the counter data includes:
performing difference analysis on the first storage data C1 and the second storage data C2 to obtain difference data;
determining judgment reference data according to the first storage data C1, and taking data obtained by shifting the first storage data C1 by seven bits to the right as judgment reference data;
and combining the difference data with the judgment reference data for judgment, when the difference data is smaller than the judgment reference data, the rotating speed of the motor reaches a stable state, at the moment, adjusting the duty ratio of a PWM wave according to the first storage data C1, when the difference data is not smaller than the judgment reference data, the rotating speed of the motor does not reach the stable state, at the moment, obtaining the metering data of the counter again, updating the first storage data C1 and the second storage data C2, and then judging whether the rotating speed of the motor is stable again according to the updated first storage data C1 and the updated second storage data C2.
As shown in fig. 6, in the above technical solution, when determining whether the rotation speed of the motor is stable according to the counter data, firstly, performing difference analysis on the first storage data C1 and the second storage data C2 to obtain difference data; then, determining judgment reference data according to the first storage data C1, and taking data obtained by right-shifting the first storage data C1 by seven bits as the judgment reference data, wherein the reference data is specifically represented as C1/128; and then, the difference data is combined with the judgment reference data for judgment, when the difference data is smaller than the judgment reference data, the rotating speed of the motor reaches a stable state, the duty ratio of the PWM wave is adjusted according to the first storage data C1, when the difference data is not smaller than the judgment reference data, the rotating speed of the motor does not reach the stable state, at the moment, the metering data of the counter is obtained again, the first storage data C1 and the second storage data C2 are updated, and whether the rotating speed of the motor is stable or not is judged again according to the updated first storage data C1 and the second storage data C2 until the rotating speed of the motor reaches the stable state.
According to the technical scheme, the metering data of the counter is obtained again when the rotating speed of the motor does not reach the stable state, the first storage data C1 and the second storage data C2 are updated, whether the rotating speed of the motor is stable is judged again according to the updated first storage data C1 and the updated second storage data C2, whether the rotating speed of the motor reaches the stable state is automatically monitored, the participation of a CPU is not needed, system (program) resources are saved, and the stable state of the rotating speed of the motor can be accurately determined.
In an embodiment provided by the present invention, when the duty ratio of the PWM wave is adjusted according to the first storage data C1, a size determination is performed on the first storage data C1 and the period, when the first storage data C1 is not greater than the period, it is analyzed whether a difference between the first storage data C1 and the period is greater than a preset value, when the difference between the first storage data C1 and the period is not greater than the preset value, the duty ratio of the PWM wave is increased according to an increasing step, when the first storage data C1 is greater than the period, it is analyzed whether the difference between the first storage data C1 and the period is greater than the preset value, when the difference between the first storage data C1 and the period is greater than the preset value, the duty ratio of the PWM wave is decreased according to a decreasing step, after the duty ratio of the PWM wave is increased or decreased, a new first storage data C1 is obtained again, and a size determination is performed on the new first storage data C1 and the period, and the cycle is performed until the first storage data C1 is less than or equal to the period, and the motor requirement is satisfied.
As shown in fig. 7, in the above technical solution, when the duty ratio of the PWM wave is adjusted according to the first storage data C1, a size determination is performed on the first storage data C1 and a period, where the period is a period set before starting the motor, if the first storage data C1 is not greater than the period, it is analyzed whether a difference between the first storage data C1 and the period is greater than a preset value, when the first storage data C1 is not greater than the period and the difference between the first storage data C1 and the period is not greater than the preset value, the duty ratio of the PWM wave is increased according to an increase step, when the first storage data C1 is greater than the period, it is analyzed whether the difference between the first storage data C1 and the period is greater than the preset value, when the first storage data C1 is greater than the period and the difference between the first storage data C1 and the period is greater than the preset value, the duty ratio of the PWM wave is decreased according to a decrease step, a new first storage data C1 is obtained again after the duty ratio of the PWM wave is increased or the duty ratio is decreased, and the new first storage data C1 is determined until the period is less than the first storage data C1, and the period are determined until the first storage data are equal to meet the requirement of the motor. Wherein the increase step and the decrease step are 10%,5%,2%,1%,0.5%.
According to the technical scheme, the duty ratio of the PWM waves is increased step by step according to the increase, and the duty ratio of the PWM waves is gradually adjusted according to the duty ratio of the PWM waves which is decreased step by step, so that the resource waste caused by overlarge adjustment is avoided, or the time waste caused by undersize adjustment is avoided, and the rotation speed of the motor can be adjusted by driving the voltage through the PWM waves.
An embodiment of the present invention provides a motor control system, including: the system comprises a preparation setting module, a starting acquisition module, a counting module and an analysis adjusting module;
the preparation setting module is used for carrying out starting preparation setting on the motor and determining the rotation direction and the period of the motor;
the starting acquisition module is used for starting the motor, enabling the motor to output PWM waves according to the starting preparation setting set by the preparation setting module, and acquiring the initial phase of the motor;
the counting module is used for counting the PWM waves output by the motor through a counter to obtain counter data;
and the analysis and adjustment module is used for judging whether the rotating speed of the motor is stable according to the counter data, and adjusting the duty ratio of the PWM wave according to the calculator data when the rotating speed of the motor is stable, so that the rotating speed of the motor is adjusted.
As shown in fig. 8, the motor control system in the above technical solution includes: the device comprises a preparation setting module, a starting acquisition module, a counting module and an analysis adjusting module; the device comprises a preparation setting module, a starting acquisition module, an analysis adjusting module, a counting module, a motor control module and a motor control module, wherein the preparation setting module is connected with the starting acquisition module, the starting acquisition module is connected with the counting module, the analysis adjusting module is connected with the starting acquisition module and the counting module, and when the motor is controlled, firstly, starting preparation setting is carried out on the motor in the preparation setting module to determine the rotation direction and the period of the motor; then, starting the motor by starting the acquisition module, and enabling the motor to output PWM waves according to the starting preparation setting set by the preparation setting module to obtain the initial phase of the motor; the counting module counts the PWM waves output by the motor through a counter to obtain counter data; and then, the analysis and adjustment module judges whether the rotating speed of the motor is stable according to the data of the counter, if the rotating speed of the motor is stable, the duty ratio of the PWM wave is adjusted according to the data of the counter, and the rotating speed of the motor is adjusted according to the duty ratio of the PWM wave, so that the rotating speed of the motor is adjusted to meet the requirement.
Above-mentioned technical scheme adopts simple step to realize the adjustment to motor speed, and not only cost consumption is little, but also can make motor speed accord with the demand in short time to above-mentioned technical scheme need not to stop the motor that starts and carry out the rotational speed adjustment in to motor speed adjustment process, avoids stopping the loss that the motor caused to the motor many times, can also reduce the influence to motor efficiency simultaneously.
In an embodiment of the present invention, the start-up collecting module includes: the device comprises a starting unit, a collecting unit and a processing unit;
the starting unit is used for starting the motor;
the acquisition unit is used for sensing the magnetic field change of the motor by using the Hall sensor to obtain sensor sensing data;
and the processing unit is used for performing digital filtering processing on the sensor induction data obtained by the acquisition unit and determining the initial phase of the motor.
The collection starting module in the technical scheme comprises: the device comprises a starting unit, a collecting unit and a processing unit; starting the motor through the starting unit; the Hall sensor is used for acquiring data of the motor through the acquisition unit, and the Hall sensor is used for sensing the change of a magnetic field of the motor, so that sensor sensing data are obtained; and filtering the signal of the sensor sensing data output by the Hall sensor through a digital filter by a processing unit to obtain the initial phase of the motor.
According to the technical scheme, the magnetic field change of the Hall sensor induction motor is good in linearity, wide in application condition range and high in precision, the accuracy of sensor induction data can be guaranteed, and after the Hall sensor obtains the sensor induction data about the motor, the signal filtering of the sensor induction data is carried out through the digital filter, so that the noise in the signal of the sensor induction data can be reduced, the signal of the sensor induction data is optimized, and the accuracy of the initial phase of the motor is improved.
In an embodiment of the present invention, when the counting module counts through a counter, the counter starts counting from zero, and when the motor rotates to the initial phase value again, the counting data of the counter last time the motor rotates to the initial phase value again is stored as the second storage data C2, and the counting data of the counter at this time is used as the first storage data C1, and at the same time, the counter is cleared to zero, and counting is started from zero again.
When the counting module in the above technical solution counts through the counter, the counter starts counting from zero, when the motor rotates to the initial phase value again, the counter performs data statistics, and when the counting data of the counter is obtained each time, the counting data of the counter when the motor rotates to the initial phase value again last time is stored as the second storage data C2, and the counting data of the counter at this time is used as the first storage data C1, and the counter is cleared at the same time to start counting from zero again.
According to the technical scheme, automatic metering is achieved through the counter, metering data can be accurately obtained, errors are not prone to occurring, the metering data obtained each time are distinguished by storing the metering data of the counter into the second storage data C2 when the motor rotates to the initial phase value for the last time and using the metering data of the counter as the first storage data C1, confusion is avoided, the analysis difficulty of follow-up steps is reduced, data confusion is avoided, in addition, the complexity of the metering data can be reduced when the counter is reset to zero after the metering data of the counter is obtained each time, and the metering data can be conveniently and directly used for follow-up processing.
In one embodiment of the present invention, the analysis adjusting module includes: a stability analysis unit and an analysis adjustment unit;
the stability analysis unit is used for judging whether the rotating speed of the motor is stable according to the counter data, and comprises: performing difference analysis on the first storage data C1 and the second storage data C2 to obtain difference data; determining judgment reference data according to the first storage data C1, and taking data obtained by right-shifting the first storage data C1 by seven bits as judgment reference data; the difference data is combined with the judgment reference data for judgment, when the difference data is smaller than the judgment reference data, the rotating speed of the motor reaches a stable state, the first storage data C1 at the moment is transmitted to the analysis control unit, when the difference data is not smaller than the judgment reference data, the rotating speed of the motor does not reach the stable state, at the moment, the metering data of a counter in the counting module is obtained again, the first storage data C1 and the second storage data C2 are updated, and whether the rotating speed of the motor is stable or not is judged according to the updated first storage data C1 and the updated second storage data C2;
and the analysis adjusting unit is used for adjusting the duty ratio of the PWM wave according to the first storage data C1 transmitted by the stability analyzing unit.
The analysis adjusting module in the above technical solution includes: a stability analysis unit and an analysis adjustment unit; judging whether the rotating speed of the motor is stable or not according to the counter data through a stability analysis unit, and when judging whether the rotating speed of the motor is stable or not according to the counter data, firstly, performing difference value analysis on the first storage data C1 and the second storage data C2 to obtain difference value data; then, determining judgment reference data according to the first storage data C1, and taking data obtained by shifting the first storage data C1 by seven bits to the right as the judgment reference data, wherein the reference data is specifically represented as C1/128; and then, the difference data is combined with the judgment reference data for judgment, when the difference data is smaller than the judgment reference data, the rotating speed of the motor reaches a stable state, the duty ratio of the PWM wave is adjusted according to the first storage data C1, when the difference data is not smaller than the judgment reference data, the rotating speed of the motor does not reach the stable state, at the moment, the metering data of the counter is obtained again, the first storage data C1 and the second storage data C2 are updated, and whether the rotating speed of the motor is stable or not is judged again according to the updated first storage data C1 and the second storage data C2 until the rotating speed of the motor reaches the stable state. The analysis adjusting unit adjusts the duty ratio of the PWM wave according to the first storage data C1 transmitted by the settling analyzing unit after stabilizing the first storage data C1 transmitted by the settling analyzing unit.
According to the technical scheme, the metering data of the counter is obtained again when the rotating speed of the motor does not reach the stable state, the first storage data C1 and the second storage data C2 are updated, whether the rotating speed of the motor is stable is judged again according to the updated first storage data C1 and the updated second storage data C2, whether the rotating speed of the motor reaches the stable state is automatically monitored, a CPU (central processing unit) is not needed, system (program) resources are saved, and the stable state of the rotating speed of the motor can be accurately determined.
In an embodiment of the invention, when the analysis and adjustment unit adjusts the duty ratio of the PWM wave according to the first storage data C1 transmitted by the stability analysis unit, the analysis and adjustment unit performs size determination on the first storage data C1 and the period, when the first storage data C1 is not greater than the period, analyzes whether a difference between the first storage data C1 and the period is greater than a preset value, when the difference between the first storage data C1 and the period is not greater than the preset value, increases the duty ratio of the PWM wave according to an increase step, when the first storage data C1 is greater than the period, analyzes whether the difference between the first storage data C1 and the period is greater than the preset value, when the difference between the first storage data C1 and the period is greater than the preset value, decreases the duty ratio of the PWM wave according to a decrease step, reacquires the new first storage data C1 after increasing the duty ratio of the PWM wave or decreasing the duty ratio of the PWM wave, and performs size determination on the new first storage data C1 and the period until the first storage data C1 is less than the period, and the motor requirement is satisfied.
In the above technical solution, when the analysis adjusting unit adjusts the duty ratio of the PWM wave according to the first storage data C1 transmitted by the stability analyzing unit, a size determination is performed on the first storage data C1 and a period, where the period is a period set before starting the motor, if the first storage data C1 is not greater than the period, it is analyzed whether a difference between the first storage data C1 and the period is greater than a preset value, when the first storage data C1 is not greater than the period and the difference between the first storage data C1 and the period is not greater than the preset value, the duty ratio of the PWM wave is increased according to the increasing step, when the first storage data C1 is greater than the period, it is analyzed whether the difference between the first storage data C1 and the period is greater than the preset value, when the first storage data C1 is greater than the period and the difference between the first storage data C1 and the period is greater than the preset value, the duty ratio of the PWM wave is decreased according to the decreasing step, a new first storage data C1 is reacquired after the duty ratio of the PWM wave is increased or the duty ratio is decreased, and the new first storage data C1 and the duty ratio of the PWM wave are determined until the period is less than the first storage data, and the period, and the motor cycle is determined until the first storage data C1 meets a requirement, and the motor. Wherein the increase step and the decrease step are 10%,5%,2%,1%,0.5%.
According to the technical scheme, the duty ratio of the PWM wave is gradually adjusted by increasing the duty ratio of the PWM wave step by step and reducing the duty ratio of the PWM wave step by step, so that resource waste caused by overlarge adjustment is avoided, or time waste caused by undersize adjustment is avoided, and the rotating speed of the motor can be adjusted by driving voltage through the PWM wave.
It will be appreciated by those skilled in the art that the first and second aspects of the invention are merely referred to in different stages of application.
Other embodiments of the disclosure will be apparent to those skilled in the art from consideration of the specification and practice of the disclosure disclosed herein. This application is intended to cover any variations, uses, or adaptations of the disclosure following, in general, the principles of the disclosure and including such departures from the present disclosure as come within known or customary practice within the art to which the disclosure pertains. It is intended that the specification and examples be considered as exemplary only, with a true scope and spirit of the disclosure being indicated by the following claims.
It will be understood that the present disclosure is not limited to the precise arrangements that have been described above and shown in the drawings, and that various modifications and changes may be made without departing from the scope thereof. The scope of the present disclosure is limited only by the appended claims.

Claims (10)

1. A motor control method, characterized by comprising:
setting starting preparation for a motor, and determining the rotation direction and the period of the motor;
starting the motor, setting output PWM waves according to the starting preparation, and acquiring an initial phase of the motor;
counting through a counter to obtain counter data;
and judging whether the rotating speed of the motor is stable or not according to the counter data, and adjusting the duty ratio of PWM waves according to the calculator data when the rotating speed of the motor is stable to realize the adjustment of the rotating speed of the motor.
2. The motor control method according to claim 1, wherein a hall sensor is used to sense a change in a magnetic field of the motor when the initial phase of the motor is obtained, so as to obtain sensor sensing data, and the initial phase of the motor is obtained by performing digital filtering on the sensor sensing data.
3. The motor control method according to claim 1, wherein when the counting is performed by the counter, the counter starts counting from zero, and when the motor rotates to an initial phase value again, the counting data of the counter at the time when the motor rotates to the initial phase value again is stored as second storage data C2, and the counting data of the counter at that time is used as first storage data C1, and the counter is cleared and the counting is started from zero again.
4. The motor control method according to claim 3, wherein determining whether the rotation speed of the motor is stable based on the counter data includes:
performing difference analysis on the first storage data C1 and the second storage data C2 to obtain difference data;
determining judgment reference data according to the first storage data C1, and taking data obtained by shifting the first storage data C1 by seven bits to the right as judgment reference data;
and combining the difference data with the judgment reference data for judgment, when the difference data is smaller than the judgment reference data, the rotating speed of the motor reaches a stable state, at the moment, adjusting the duty ratio of a PWM wave according to the first storage data C1, when the difference data is not smaller than the judgment reference data, the rotating speed of the motor does not reach the stable state, at the moment, obtaining the metering data of the counter again, updating the first storage data C1 and the second storage data C2, and then judging whether the rotating speed of the motor is stable again according to the updated first storage data C1 and the updated second storage data C2.
5. The motor control method according to claim 4, wherein when the duty ratio of the PWM wave is adjusted according to the first storage data C1, a size determination is performed for the first storage data C1 and the period, when the first storage data C1 is not greater than the period, it is analyzed whether a difference between the first storage data C1 and the period is greater than a preset value, when the difference between the first storage data C1 and the period is not greater than the preset value, the duty ratio of the PWM wave is increased in increments, when the first storage data C1 is greater than the period, it is analyzed whether the difference between the first storage data C1 and the period is greater than the preset value, when the difference between the first storage data C1 and the period is greater than the preset value, the duty ratio of the PWM wave is decreased in increments, a new first storage data C1 is reacquired after the duty ratio of the PWM wave is increased or the duty ratio of the PWM wave is decreased, and a size determination is performed for the new first storage data C1 and the period until the first storage data C1 is less than the period, and the motor period is less than the requirement.
6. A motor control system, comprising: the device comprises a preparation setting module, a starting acquisition module, a counting module and an analysis adjusting module;
the preparation setting module is used for carrying out starting preparation setting on the motor and determining the rotation direction and the period of the motor;
the starting acquisition module is used for starting the motor, enabling the motor to output PWM waves according to the starting preparation setting set by the preparation setting module, and acquiring the initial phase of the motor;
the counting module is used for counting the PWM waves output by the motor through a counter to obtain counter data;
and the analysis and adjustment module is used for judging whether the rotating speed of the motor is stable according to the counter data, and adjusting the duty ratio of PWM waves according to the calculator data when the rotating speed of the motor is stable, so that the rotating speed of the motor is adjusted.
7. The motor control system of claim 6 wherein the start acquisition module comprises: the device comprises a starting unit, an acquisition unit and a processing unit;
the starting unit is used for starting the motor;
the acquisition unit is used for sensing the magnetic field change of the motor by using the Hall sensor to obtain sensor sensing data;
and the processing unit is used for carrying out digital filtering processing on the sensor induction data obtained by the acquisition unit and determining the initial phase of the motor.
8. The motor control system according to claim 7, wherein when the counting module counts by a counter, the counter starts counting from zero, and when the motor rotates to an initial phase value again, the counting data of the counter last time the motor rotates to the initial phase value again is stored as second storage data C2, and the counting data of the counter at this time is taken as first storage data C1, and the counter is cleared and starts counting from zero again.
9. The motor control system of claim 6 wherein the analysis adjustment module comprises: a stability analysis unit and an analysis adjustment unit;
the stability analysis unit is used for judging whether the rotating speed of the motor is stable according to the counter data, and comprises: performing difference analysis on the first storage data C1 and the second storage data C2 to obtain difference data; determining judgment reference data according to the first storage data C1, and taking data obtained by shifting the first storage data C1 by seven bits to the right as judgment reference data; the difference data is combined with the judgment reference data to judge, when the difference data is smaller than the judgment reference data, the rotating speed of the motor reaches a stable state, the first storage data C1 at the moment is transmitted to the analysis control unit, when the difference data is not smaller than the judgment reference data, the rotating speed of the motor does not reach the stable state, the metering data of the counter in the counting module is obtained again at the moment, the first storage data C1 and the second storage data C2 are updated, and whether the rotating speed of the motor is stable or not is judged according to the updated first storage data C1 and the updated second storage data C2;
and the analysis adjusting unit is used for adjusting the duty ratio of the PWM wave according to the first storage data C1 transmitted by the stable analyzing unit.
10. The motor control system according to claim 6, wherein the analysis adjusting unit performs a size determination with respect to the first storage data C1 and the period when the duty ratio of the PWM wave is adjusted based on the first storage data C1 transmitted by the stability analyzing unit, analyzes whether a difference between the first storage data C1 and the period is greater than a preset value when the first storage data C1 is not greater than the period, increases the duty ratio of the PWM wave in increments when the difference between the first storage data C1 and the period is not greater than the preset value, analyzes whether the difference between the first storage data C1 and the period is greater than the preset value when the first storage data C1 is greater than the period, decreases the duty ratio of the PWM wave in increments when the difference between the first storage data C1 and the period is greater than the preset value, reacquires new first storage data C1 after increasing the duty ratio of the PWM wave or decreasing the duty ratio of the PWM wave, and performs a size determination with respect to the new first storage data C1 and the period until the storage data C1 is less than the first storage data period, and the motor cycle is equal to the first storage data requirement.
CN202211005641.7A 2022-08-22 2022-08-22 Motor control method and system Withdrawn CN115425874A (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN202211005641.7A CN115425874A (en) 2022-08-22 2022-08-22 Motor control method and system

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN202211005641.7A CN115425874A (en) 2022-08-22 2022-08-22 Motor control method and system

Publications (1)

Publication Number Publication Date
CN115425874A true CN115425874A (en) 2022-12-02

Family

ID=84197607

Family Applications (1)

Application Number Title Priority Date Filing Date
CN202211005641.7A Withdrawn CN115425874A (en) 2022-08-22 2022-08-22 Motor control method and system

Country Status (1)

Country Link
CN (1) CN115425874A (en)

Similar Documents

Publication Publication Date Title
US9647606B2 (en) Counter based circuit for measuring movement of an object
CN107834934B (en) Electric automobile and automatic correction method and system for initial position of rotary transformer of electric automobile
CN112310942B (en) Control method and electric pump
CN107147343A (en) Brushless electric machine Field orientable control drive system and control method
US6411080B1 (en) Signal processing method for a variable reluctance vehicle speed sensing mechanism
CN104883158A (en) Filtering method and filtering device for acceleration pedal signals of electric automobile
CN111308339A (en) Servo motor testing method, device and equipment and computer storage medium
CN115425874A (en) Motor control method and system
CN111380499B (en) Method and device for detecting rotation angle
CN113353053B (en) Hybrid power system and method for obtaining crank angle of engine in system
US7248990B2 (en) Method for measuring the speed of an electrical machine
CN1502167A (en) Apparatus and method for adjusting filter frequency in relation to sampling frequency
CN116400093A (en) Variable window speed measurement method with acceleration correction for orthogonal photoelectric encoder
CN111917347A (en) Method for eliminating influence of gear clearance error and related product
CN212875697U (en) Speed regulation control circuit and seat
CN115366694A (en) Vehicle torque output method and device, vehicle and storage medium
CN115378315A (en) Method and device for compensating error of reverse clearance of stepping motor, household appliance and medium
CN112751520B (en) Computer equipment, storage medium, and method, device and system for detecting state of servo motor
CN113472254A (en) Electronic oil pump motor control method and system integrating test optimization method
CN110086399B (en) Permanent magnet synchronous motor rotor position composite detection and starting operation method
CN112067991A (en) Motor locked-rotor detection method, detection device, terminal equipment and storage medium
CN114013447B (en) Method, device, equipment and storage medium for determining vehicle load
CN113726250B (en) Synchronous motor cogging torque calibration method and device and electronic equipment
CN117783986A (en) Zero voltage calibration method and device of current sensor and vehicle
CN117978006B (en) Motor control system and method

Legal Events

Date Code Title Description
PB01 Publication
PB01 Publication
SE01 Entry into force of request for substantive examination
SE01 Entry into force of request for substantive examination
WW01 Invention patent application withdrawn after publication

Application publication date: 20221202

WW01 Invention patent application withdrawn after publication