Stepping motor control method, electronic device, and storage medium

By controlling the level and duration of the winding magnetic field in the stepper motor, the problem of stepper motor step loss was solved, and stable operation and smooth rotation of the motor were achieved.

CN116599394BActive Publication Date: 2026-07-07BEIJING KUANGSHI TECHNOLOGY CO LTD

Patent Information

Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
BEIJING KUANGSHI TECHNOLOGY CO LTD
Filing Date
2023-03-03
Publication Date
2026-07-07

Smart Images

  • Figure CN116599394B_ABST
    Figure CN116599394B_ABST
Patent Text Reader

Abstract

Embodiments of the present application provide a kind of step motor control method, electronic equipment and storage medium.The method comprises: obtaining the control instruction of step motor;Corresponding control pulse signal is generated based on the control instruction, wherein, in the process of generating the control pulse signal, the level of the control pulse signal in each target jitter period or the length of at least part period in each target jitter period is controlled by the control instruction, so that the winding magnetic field of the step motor remains consistent in different target jitter periods or the change frequency of the winding magnetic field in each target jitter period is equal to target change frequency, the control pulse signal is used to control the current on each winding coil of the step motor to form the winding magnetic field;The control pulse signal is output to control the step motor to run.The scheme can prevent motor jitter, effectively avoid the occurrence of motor step loss phenomenon.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] This invention relates to the field of stepper motor technology, and more specifically to a stepper motor control method, electronic device, and storage medium. Background Technology

[0002] A stepper motor is an open-loop control motor that rotates at a fixed angular displacement based on electrical pulse signals. The stepper motor controller generates pulse signals with fixed timing logic through internal logic, triggering the motor winding magnetic field to change according to certain logic, thereby realizing the logical control of the motor rotor's direction change, speed adjustment, start-up, and stop. Due to its stable operation, stepper motors are widely used in smart manufacturing, robotics, smart warehousing, and smart healthcare.

[0003] However, stepper motors can experience step loss during operation. Many factors can cause this, such as excessive load resistance, incorrect driver control timing logic, irregular control pulses, and rotor vibration. Conventional solutions for stepper motor step loss primarily involve feedback compensation after step loss occurs. This is achieved by adding additional devices to monitor the motor and calculating appropriate compensation data, which is then converted into the corresponding number of compensated steps.

[0004] The above solution can only prevent motor step loss, and compensation after step loss is prone to errors. Summary of the Invention

[0005] The present invention was proposed in view of the above-mentioned problems. The present invention provides a stepper motor control method, an electronic device, and a storage medium.

[0006] According to one aspect of the present invention, a stepper motor control method is provided, comprising: acquiring a control command for a stepper motor; generating a corresponding control pulse signal based on the control command, wherein, during the generation of the control pulse signal, the control command controls the level of the control pulse signal in each target jitter period or the duration of at least a portion of each target jitter period, so that the winding magnetic field of the stepper motor remains consistent in different target jitter periods or the frequency of change of the winding magnetic field in each target jitter period is equal to the target frequency of change, the control pulse signal being used to control the current on each winding coil of the stepper motor to form the winding magnetic field; and outputting the control pulse signal to control the operation of the stepper motor.

[0007] For example, the control command includes a single-step operation control command, which is used to control the stepper motor to run in single steps. The target jitter period includes the period between every two adjacent pulse cycles, each pulse cycle corresponding to one step of the stepper motor. The stepper motor includes multiple winding coils, and the control pulse signal includes multiple coil pulse signals corresponding one-to-one with the multiple winding coils. Controlling the level of the control pulse signal in each target jitter period through the control command includes: between every two adjacent pulse cycles, resetting the level of the coil pulse signal corresponding to each of the multiple winding coils to a target level through the single-step operation control command. The target level is either a high level or a low level.

[0008] For example, the stepper motor includes multiple winding coils, and the control pulse signal includes multiple coil pulse signals corresponding one-to-one with the multiple winding coils. The step of resetting the level of the control pulse signal by the control command between every two adjacent pulse cycles includes: resetting the level of the coil pulse signal corresponding to each of the multiple winding coils to a target level by the control command between every two adjacent pulse cycles; wherein the target level is the level corresponding to the de-energized state of the corresponding winding coil.

[0009] For example, the control command includes a continuous operation control command, which controls the stepper motor to run continuously. The target jitter period includes a first jitter period and a second jitter period. The first jitter period includes each pulse cycle, and the second jitter period includes the period between each pulse cycle and the next pulse cycle. Each pulse cycle corresponds to one step of the stepper motor. Controlling the duration of at least a portion of the time within each target jitter period through the control command includes: controlling the duration of any current second jitter period in the control pulse signal to be equal to a first target value through the control command. The at least a portion of the time includes the second jitter period. The first target value is equal to the time interval between every two adjacent pulses in the first jitter period preceding the current second jitter period. For the current second jitter period, the target change frequency is equal to the pulse frequency in the first jitter period preceding the current second jitter period.

[0010] For example, the control command includes a speed adjustment command, the target jitter period includes a first jitter period, the first jitter period includes each pulse cycle, the speed adjustment command is used to control the stepper motor to adjust its operating speed, and the control command controls the duration of at least a portion of the time period within each target jitter period, including: controlling the duration of each pulse within each first jitter period to be adjusted from a second target value to a third target value, wherein the second target value is equal to the ratio of the first cycle duration to the number of pulses in each pulse cycle, the first cycle duration is the cycle duration corresponding to the operating speed before adjustment, the third target value is equal to the ratio of the second cycle duration to the number of pulses in each pulse cycle, the second cycle duration is the cycle duration corresponding to the operating speed after adjustment, for any first jitter period, the target change frequency is equal to the ratio of the number of pulses in each pulse cycle to the current cycle duration, and any cycle duration is inversely proportional to the corresponding operating speed.

[0011] For example, the speed adjustment command is an acceleration command, and the second target value is greater than the third target value.

[0012] For example, the speed adjustment command is a deceleration command, and the second target value is less than the third target value.

[0013] According to another aspect of the present invention, an electronic device is provided, including a processor and a memory, wherein the memory stores computer program instructions, which are executed by the processor to perform the stepper motor control method described above.

[0014] For example, the processor includes a main control chip and a motor control chip that are communicatively connected to each other. The main control chip is used to generate the control instructions; the motor control chip is used to generate the control pulse signal based on the control instructions and output the control pulse signal to the stepper motor.

[0015] For example, the device further includes the stepper motor, which is connected to the processor and is used to operate under the control of the control pulse signal output by the processor.

[0016] According to another aspect of the present invention, a storage medium is provided on which program instructions are stored, wherein the program instructions are used to execute the stepper motor control method described above when running.

[0017] According to the stepper motor control method, electronic device, and storage medium of the present invention, by controlling the level of the pulse signal during each target jitter period or the duration of at least a portion of each target jitter period, the magnitude and frequency of the stepper motor winding magnetic field can be controlled. This allows for the prevention of rotor jitter within the motor, and consequently, the prevention of motor jitter. This solution effectively prevents motor jitter and avoids the occurrence of motor step loss. Attached Figure Description

[0018] The above and other objects, features, and advantages of the present invention will become more apparent from the more detailed description of the embodiments of the invention in conjunction with the accompanying drawings. The drawings are provided to further illustrate the embodiments of the invention and form part of the specification. They are used together with the embodiments of the invention to explain the invention and do not constitute a limitation thereof. In the drawings, the same reference numerals generally represent the same parts or steps.

[0019] Figure 1 A schematic block diagram of an example electronic device for implementing a stepper motor control method according to an embodiment of the present invention is shown;

[0020] Figure 2 A schematic flowchart of a stepper motor control method according to an embodiment of this application is shown;

[0021] Figure 3 A timing diagram of a control pulse signal according to an embodiment of this application is shown;

[0022] Figure 4 A timing diagram of a control pulse signal according to another embodiment of this application is shown;

[0023] Figure 5 A timing diagram of a control pulse signal according to yet another embodiment of this application is shown;

[0024] Figure 6 A schematic block diagram of a stepper motor control device according to an embodiment of the present invention is shown;

[0025] Figure 7 A schematic block diagram of a stepper motor control system according to an embodiment of the present invention is shown; and

[0026] Figure 8 A schematic flowchart illustrating stepper motor control in an electronic device according to an embodiment of this application is shown. Detailed Implementation

[0027] In recent years, significant progress has been made in research on technologies based on artificial intelligence, such as computer vision, deep learning, machine learning, image processing, and image recognition. Artificial intelligence (AI) is an emerging science and technology that studies and develops theories, methods, technologies, and application systems to simulate and extend human intelligence. AI is a comprehensive discipline involving numerous technologies, including chips, big data, cloud computing, the Internet of Things, distributed storage, deep learning, machine learning, and neural networks. Computer vision, as an important branch of AI, specifically enables machines to recognize the world. Computer vision technologies typically include facial recognition, image processing, fingerprint recognition and anti-counterfeiting verification, biometric recognition, face detection, pedestrian detection, object detection, image processing, image recognition, image semantic understanding, image retrieval, text recognition, video processing, video content recognition, 3D reconstruction, virtual reality, augmented reality, simultaneous localization and mapping (SLAM), computational photography, and robot navigation and localization. With the research and advancement of artificial intelligence technology, this technology has been applied in numerous fields, such as urban management, traffic management, building management, park management, facial recognition access control, facial recognition attendance, logistics management, warehouse management, robotics, intelligent marketing, computational photography, mobile imaging, cloud services, smart homes, wearable devices, autonomous driving, autonomous driving, smart healthcare, facial payment, facial unlocking, fingerprint unlocking, identity verification, smart screens, smart TVs, cameras, mobile internet, live streaming, beauty filters, cosmetics, medical aesthetics, and intelligent temperature measurement.

[0028] To make the objectives, technical solutions, and advantages of this application more apparent, exemplary embodiments according to this application will be described in detail below with reference to the accompanying drawings. Obviously, the described embodiments are merely some embodiments of this application, and not all embodiments of this application. It should be understood that this application is not limited to the exemplary embodiments described herein. Based on the embodiments of this application described herein, all other embodiments obtained by those skilled in the art without inventive effort should fall within the protection scope of this application.

[0029] This application provides a stepper motor control method, electronic device, storage medium, and computer program product. The stepper motor control method according to this application can effectively prevent motor jitter, thereby preventing the motor from losing steps. The stepper motor control technology according to this application can be applied to any field involving stepper motors.

[0030] First, refer to Figure 1 This describes an example electronic device 100 for implementing a stepper motor control method according to embodiments of this application.

[0031] like Figure 1As shown, the electronic device 100 includes one or more processors 102 and one or more storage devices 104. Optionally, the electronic device 100 may also include input devices 106 and output devices 108, these components being interconnected via a bus system 110 and / or other forms of connection mechanisms (not shown). It should be noted that Figure 1 The components and structure of the electronic device 100 shown are merely exemplary and not limiting; the electronic device may also have other components and structures as needed.

[0032] The processor 102 may be implemented in at least one of the following hardware forms: digital signal processor (DSP), field-programmable gate array (FPGA), programmable logic array (PLA), and microprocessor. The processor 102 may be one or a combination of several of the following: central processing unit (CPU), graphics processing unit (GPU), application-specific integrated circuit (ASIC), or other processing units with data processing capabilities and / or instruction execution capabilities. It may also control other components in the electronic device 100 to perform the desired functions.

[0033] The storage device 104 may include one or more computer program products, which may include various forms of computer-readable storage media, such as volatile memory and / or non-volatile memory. The volatile memory may include, for example, random access memory (RAM) and / or cache memory. The non-volatile memory may include, for example, read-only memory (ROM), hard disk, flash memory, etc. One or more computer program instructions may be stored on the computer-readable storage medium, and the processor 102 may execute the program instructions to implement the client functions (implemented by the processor) in the embodiments of this application described below, and / or other desired functions. Various applications and various data may also be stored in the computer-readable storage medium, such as various data used and / or generated by the applications.

[0034] The input device 106 may be a device used by a user to input commands, and may include one or more of the following: keyboard, mouse, microphone, and touch screen.

[0035] The output device 108 can output various information (e.g., images and / or sound) to the outside (e.g., a user), and may include one or more of a display, speaker, etc. Optionally, the input device 106 and the output device 108 can be integrated together and implemented using the same interactive device (e.g., a touch screen).

[0036] For example, an example electronic device for implementing the stepper motor control method according to the embodiments of this application can be implemented on a device such as a personal computer, terminal device, time and attendance machine, panel display, camera, or remote server. The terminal device includes, but is not limited to, tablet computers, mobile phones, PDAs (Personal Digital Assistants), touchscreen all-in-one machines, wearable devices, etc.

[0037] Below, we will refer to Figure 2 A stepper motor control method according to an embodiment of this application is described. Figure 2 A schematic flowchart illustrating a stepper motor control method according to an embodiment of this application is shown. Figure 2 As shown, the stepper motor control method 200 includes the following steps S210, S220 and S230.

[0038] In step S210, the control command for the stepper motor is obtained.

[0039] For example, control commands may include one or more of the following: start command, stop command, reversing command, single-step operation command, continuous operation command, and speed control command. Different control commands correspond to different operating states of the stepper motor. For example, the single-step operation command corresponds to the single-step operation state of the stepper motor. The continuous operation command corresponds to the continuous operation state of the stepper motor. The speed control command corresponds to the speed control state of the stepper motor.

[0040] It is understood that control commands can be obtained from external sources or automatically generated by the device used to execute the stepper motor control method 200 (e.g., the electronic device 100 described above). For example, control commands can be directly generated by the operator. Figure 1 The input device shown is used for input. Alternatively, control commands can be automatically generated directly based on the operating status of the stepper motor.

[0041] In step S220, a corresponding control pulse signal is generated based on the control command. During the generation of the control pulse signal, the control command controls the level of the control pulse signal in each target jitter period or the duration of at least a portion of each target jitter period, so that the winding magnetic field of the stepper motor remains consistent in different target jitter periods or the frequency of change of the winding magnetic field in each target jitter period is equal to the target frequency of change. The control pulse signal is used to control the current on each winding coil of the stepper motor to form a winding magnetic field.

[0042] To prevent motor step loss, it's necessary to analyze the causes. Currently, when considering the causes of motor step loss, the main focus is on the influence of external factors, neglecting the impact of rotor vibration on the overall motor. When the magnetic field of the motor windings is unstable, the motor rotor is prone to vibration. The following example illustrates motor vibration caused by unstable winding magnetic fields.

[0043] For example, the target jitter period represents the period during which the stepper motor may jitter. It is understood that different operating states during stepper motor rotation can cause motor jitter. For instance, when the stepper motor is in single-step operation, its current motion state is affected by the termination state of the previous step. During single-step operation, the magnetic field of the windings changes multiple times in a fixed sequence (e.g., 8 times for a four-phase eight-step stepper motor). As long as the sequence of magnetic field changes is consistent within the cycle, the outer shaft of the stepper motor can rotate stably one step. Furthermore, the sequence of magnetic field changes in the coil windings differs within the cycle for different rotation directions of the stepper motor. During stepper motor rotation, the rotation direction may change at any time according to business needs. In stepper motor motion control, the magnetic field state of the windings is random before the start of each cycle. If the magnetic field of the stepper motor windings is not fixed, slight jitter will occur during the stepper motor's change of direction. In this situation, during the generation of control pulse signals, the level of each target jitter period can be optionally controlled by control commands to ensure that the winding magnetic field of the stepper motor remains consistent during different target jitter periods. This can effectively prevent the stepper motor from jittering during single-step operation.

[0044] For example, when a stepper motor is running continuously, there is a delay between every two steps. If the frequency of the motor winding magnetic field changes during this delay is inconsistent with the frequency of the motor winding magnetic field during each step, it may cause motor jitter. The greater the difference between the frequency of the motor winding magnetic field during this delay and the frequency of the motor winding magnetic field during each step, the more pronounced the jitter. Furthermore, when a stepper motor is in speed-adjusting mode, the motor speed is usually adjusted by directly increasing or decreasing the time interval between adjacent steps. As the time interval between adjacent steps changes, the stepper motor will exhibit a jerking sensation, causing overall jitter. To address these issues, during the generation of control pulse signals, control commands can be used to control the duration of at least a portion of each target jitter period. This ensures that the frequency of the winding magnetic field changes within each target jitter period equals the target frequency, preventing inconsistencies in the frequency of the motor winding magnetic field within the target jitter period and effectively preventing jitter during continuous stepper motor operation.

[0045] In step S230, a control pulse signal is output to control the operation of the stepper motor.

[0046] As described above, the control pulse signal is used to control the current in each winding coil of the stepper motor to form a winding magnetic field. The energization and de-energization of each winding coil can be controlled according to the level of each pulse in the control pulse signal, thereby controlling the stepper motor to operate in different operating states.

[0047] According to the above technical solution, by controlling the level of the pulse signal during each target jitter period or the duration of at least a portion of each target jitter period, the magnitude and frequency of the stepper motor winding magnetic field can be controlled. This allows for control of the magnitude and frequency of the winding magnetic field, preventing rotor jitter within the motor and thus preventing motor jitter. This solution effectively prevents motor jitter and avoids the occurrence of motor step loss.

[0048] For example, the control command includes a single-step operation control command, which controls the stepper motor to operate in single steps. The target jitter period includes the time interval between every two adjacent pulse cycles, with each pulse cycle corresponding to one step of the stepper motor. The stepper motor includes multiple winding coils, and the control pulse signal includes multiple coil pulse signals corresponding one-to-one with the multiple winding coils. The step of controlling the level of the control pulse signal within each target jitter period through the control command may include the following steps: Between every two adjacent pulse cycles, the single-step operation control command resets the level of the coil pulse signal corresponding to each of the multiple winding coils to a target level, which is either high or low.

[0049] For example, single-step operation of a stepper motor can include single-step operation in the same direction or single-step operation in different directions. For instance, a stepper motor can always operate in the forward direction. Alternatively, a stepper motor can operate in both forward and reverse directions. For example, the first step can be forward operation (i.e., rotating clockwise), and the second step can be reverse operation (i.e., rotating counterclockwise). The order of forward and reverse rotation of the stepper motor and the number of steps in the same direction each time can be fixed, such as alternating forward and reverse rotation, or it can be non-fixed.

[0050] For example, the level of the control pulse signal can be reset to a high or low level as needed. The level of the coil pulse signal corresponding to each winding coil in the stepper motor can be reset to the same level or to different levels. Taking a four-phase eight-step stepper motor as an example, the number of winding coils is four, and the level of the coil pulse signal corresponding to each of the four winding coils can all be reset to a high or low level. For example, the step angle of the four-phase eight-step stepper motor described herein can be, for example, 5.625 degrees, and the reduction ratio can be, for example, 64 / 1. For each pulse received, the rotor of the stepper motor rotates 5.625 degrees. The winding magnetic field changes 8 times, and the rotation shaft of the internal rotor drives the motor to rotate one step. Similarly, when the stepper motor receives 8 pulses (i.e., one pulse cycle), the rotor of the stepper motor rotates 8 steps, and the external motor rotates one step.

[0051] According to the above technical solution, by using single-step operation control commands to uniformly reset the level of each coil pulse signal to a high or low level, the winding magnetic field of the stepper motor before each step can be kept consistent and will not disturb the magnetic field during normal operation of the stepper motor. This ensures that the stepper motor's single-step rotation is unaffected by changes in the magnetic field, effectively preventing rotor jitter within the stepper motor. This solution can prevent motor jitter caused by rotor jitter, thereby preventing the stepper motor from losing steps.

[0052] For example, the target level is the level corresponding to the de-energized state of the corresponding winding coil.

[0053] It is understandable that the number of winding coils in a stepper motor is related to the number of phases of the stepper motor. For example, if the stepper motor is a four-phase motor, then the number of winding coils in the stepper motor is four; if the stepper motor is a five-phase motor, then the number of winding coils in the stepper motor is five.

[0054] In the embodiment where the stepper motor is a four-phase eight-step stepper motor, the coil pulse signals corresponding to the four winding coils can be reset to the level corresponding to the de-energized state of the corresponding winding coil. That is, if the level corresponding to the de-energized state of the winding coil is low, then the target level is low. The voltage levels of the coil pulse signals corresponding to each of the four winding coils can be reset to low level by control commands. When the coil pulse signal level is low, the winding coil is de-energized, and the current in the stepper motor is 0.

[0055] Figure 3A timing diagram of the control pulse signal according to an embodiment of this application is shown. As shown, the stepper motor is a four-phase eight-step motor, with four winding coils A1, A2, B1, and B2. Pulse periods E1 and E2 represent the first and second steps of the stepper motor's operation, respectively. The first step of the stepper motor is forward rotation, and the second step is reverse rotation. Between two adjacent pulse cycles corresponding to the first and second steps of the stepper motor's rotation, the level of the coil pulse signal corresponding to each of the four winding coils can be reset to the target level C1 via a control command. At this time, the stepper motor stops running. In this embodiment, the target level is a high level. That is, winding coils A1, A2, B1, and B2 are de-energized when the coil pulse signal level is high. After the second step is completed, the level of the coil pulse signal corresponding to each of the four winding coils is reset to the target level D1 again via a control command. The target level D1 is the same as the target level C1, both corresponding to the level of the de-energized winding coil.

[0056] According to the above technical solution, by resetting the level of the coil pulse signal corresponding to each of the multiple winding coils to the level corresponding to the power-off state, the stepper motor can stop working after each step, thus reducing energy consumption.

[0057] For example, the control command includes a continuous operation control command for controlling the stepper motor to run continuously. The target jitter period includes a first jitter period and a second jitter period. The first jitter period includes each pulse cycle, and the second jitter period includes the period between each pulse cycle and the next pulse cycle. Each pulse cycle corresponds to one step of the stepper motor. The step of controlling the duration of at least a portion of the period within each target jitter period by the control command may include the following steps: The control command controls the duration of any current second jitter period in the control pulse signal to be equal to a first target value, where at least a portion of the period includes the second jitter period. The first target value is equal to the time interval between every two adjacent pulses within the first jitter period preceding the current second jitter period. For the current second jitter period, the target change frequency is equal to the pulse frequency within the first jitter period preceding the current second jitter period.

[0058] During the control of a stepper motor's continuous unidirectional rotation, the timing of the 8 control pulses within a single cycle is highly stable. Since the continuous rotation of a stepper motor can be broken down into multiple single-step motion controls, the smoothness of the continuous rotation depends on the seamless connection of the control pulses between these single steps. If the delay between each step is too long during continuous rotation, the motor's rotation will exhibit stuttering. To achieve a certain level of smoothness in the continuous rotation of the stepper motor, all control pulses can be kept at the same frequency throughout the entire rotation process; that is, the control pulses of each cycle must be synchronized with the control pulses of each single step. This approach effectively improves the smoothness of the stepper motor's continuous rotation.

[0059] As described above, the first jitter period includes each pulse cycle. That is, the pulse cycle corresponding to each step the stepper motor takes is the first jitter period. The second jitter period includes the period between each pulse cycle and the next pulse cycle. That is, if the stepper motor takes three steps, the period between the pulse cycle corresponding to the first step and the pulse cycle corresponding to the second step, and the period between the pulse cycle corresponding to the second step and the pulse cycle corresponding to the third step, are all the second jitter periods. According to the above embodiment, when the stepper motor is running continuously, there is a delay between every two steps. If the duration of this delay is inconsistent with the time interval between every two adjacent pulses in the previous pulse cycle, it may cause motor jitter. This delay duration is the second jitter period. The previous pulse cycle is the first jitter period located before the current second jitter period.

[0060] In one embodiment, if the stepper motor continuously operates for two steps, that is, it continuously operates for two pulse cycles, the time interval between the two pulse cycles is the second jitter period. Both pulse cycles are the first jitter period. If the time interval between any two adjacent pulses within the first pulse cycle is t1, the duration of the second jitter period can be controlled to be equal to t1 by a control command. In one example, the time interval between any two adjacent pulses is 0, that is, the pulses are closely adjacent, so the duration of the second jitter period can also be equal to 0. In this way, during the continuous unidirectional rotation of the stepper motor, the frequency of the control pulse signal of the stepper motor changes between each cycle and the frequency of each pulse within the cycle remains consistent, ensuring that the frequency of all pulse signals of the stepper motor remains consistent throughout the entire movement.

[0061] Figure 4 A timing diagram of a control pulse signal according to an embodiment of this application is shown. Figure 4As shown, the stepper motor is a four-phase, eight-step stepper motor with four winding coils A1, A2, B1, and B2. The stepper motor runs continuously for two pulse cycles, E3 and E4, with a time interval of t2 between any two adjacent pulses within each pulse cycle. C2 indicates the time interval between the two pulse cycles, i.e., the location of the second jitter period. Let the duration of the second jitter period be t3. The control pulse signal t3 can be controlled to equal t2 using control commands. For example, if t2 = 0.3s, then t3 can be controlled to equal 0.3s.

[0062] In one embodiment, after continuous operation is completed, the level of the coil pulse signal corresponding to each winding coil can be reset to the target level, thereby preventing the winding magnetic field during the next stepper motor operation from being interfered with by the winding magnetic field corresponding to the end of the current stepper motor operation. Figure 4 Taking the illustrated embodiment as an example, after the pulse cycle E4 ends, the level of the coil pulse signal corresponding to each of the four winding coils can be reset to the target level D2 via a control command. The target level D2 can be the same as the target level D1 and target level C1 in the above embodiment, so that the current in the stepper motor is 0, reducing energy consumption.

[0063] According to the above technical solution, by controlling the duration of the second jitter period to be equal to the first target value, the time interval between two consecutive pulse cycles of the stepper motor can be kept consistent with the time interval between two adjacent pulses within the pulse cycle, thereby effectively avoiding motor jitter.

[0064] For example, the control command includes a speed adjustment command, the target jitter period includes a first jitter period, the first jitter period includes each pulse cycle, and the speed adjustment command is used to control the stepper motor to adjust its operating speed. Controlling the duration of at least a portion of each target jitter period through the control command can specifically include the following steps: The control command controls the duration of each pulse within each first jitter period to be adjusted from a second target value to a third target value. Wherein, the second target value is equal to the ratio of the first cycle duration to the number of pulses in each pulse cycle, the first cycle duration is the cycle duration corresponding to the operating speed before adjustment, the third target value is equal to the ratio of the second cycle duration to the number of pulses in each pulse cycle, the second cycle duration is the cycle duration corresponding to the operating speed after adjustment, for any first jitter period, the target change frequency is equal to the ratio of the number of pulses in each pulse cycle to the current cycle duration, and any cycle duration is inversely proportional to the corresponding operating speed.

[0065] It's understandable that the duration of each pulse in a pulse cycle is equal. The ratio of the cycle length to the number of pulses in each pulse cycle is the duration of any single pulse in that cycle. For example, if a pulse cycle lasts 4 seconds and contains 8 pulses, then the duration of one pulse is 0.5 seconds. Each operating speed of the motor corresponds to a cycle length, and this cycle length is inversely proportional to the corresponding operating speed. When adjusting the speed, the cycle length can be adjusted inversely proportional to the speed adjustment. Adjusting the cycle length will change the duration of each pulse accordingly. Therefore, to decrease the motor speed, the duration of each pulse can be increased, and vice versa.

[0066] The target frequency change is equal to the ratio of the number of pulses in each pulse cycle to the current cycle duration. This ratio is the pulse frequency within the current pulse cycle, which can be expressed as the number of pulses per unit time. When the duration of each pulse changes during the first jitter period, the number of pulses per unit time also changes accordingly. Therefore, the pulse frequency can be adjusted by changing the duration of each pulse. It should be noted that the current cycle duration refers to the cycle duration at the current operating speed. Before adjusting the operating speed, the current cycle duration is inversely proportional to the operating speed before adjustment; after adjusting the operating speed, the current cycle duration is inversely proportional to the operating speed after adjustment.

[0067] For example, the speed control command can be an acceleration command. The second target value is greater than the third target value. In one embodiment, for a four-phase eight-beat stepper motor, the cycle length corresponding to the operating speed before adjustment is 2s, and the cycle length corresponding to the operating speed after adjustment is 1.6s. Therefore, the second target value is 0.25s, and the third target value is 0.2s. The target change frequency before adjustment is 4Hz, and the target change frequency after adjustment is 5Hz. The above technical solution, by shortening the second target value to the third target value, can increase the target change frequency within a single pulse cycle, thereby accelerating the change speed of the winding magnetic field, and thus increasing the operating speed of the stepper motor.

[0068] For example, the speed control command can be a deceleration command. The second target value is less than the third target value. In one embodiment, the stepper motor is a four-phase eight-step stepper motor. The cycle length corresponding to the operating speed before adjustment is 2s, and the cycle length corresponding to the operating speed after adjustment is 4s. Then the second target value is 0.25s, and the third target value is 0.5s. The target change frequency before adjustment is 4Hz, and the target change frequency after adjustment is 2Hz. The above technical solution, by extending the duration of a single pulse, can reduce the target change frequency within a single pulse cycle, thereby reducing the rate of change of the winding magnetic field and achieving a reduction in the stepper motor's operating speed. This solution can alleviate the jerking sensation during the stepper motor's deceleration process and prevent motor vibration.

[0069] Figure 5 A timing diagram of a control pulse signal according to an embodiment of this application is shown. Figure 5 As shown, the stepper motor is a four-phase, eight-step stepper motor, with four winding coils labeled A1, A2, B1, and B2. E5 represents the pulse period before the stepper motor's operating speed is adjusted, and E6 represents the pulse period after the stepper motor's operating speed is adjusted. When it is necessary to control the stepper motor to decelerate, the duration of each pulse within the pulse period can be increased from the second target value t4 to the third target value t5 via control commands. The duration of the adjusted pulse period is correspondingly increased. Figure 5 The time increase at point C3 is the increase in the pulse period after deceleration. The time increase at C3 is T = n × (t5 - t4), where n represents the number of pulses in one pulse period. In this embodiment, n = 8. Taking the embodiment with the second target value of 0.25s and the third target value of 0.5s as an example, the time increase at C3 is T = 8 × (0.5 - 0.25) = 2s.

[0070] It is understood that the speed adjustment process of a stepper motor can be performed during continuous operation. That is, the stepper motor can be accelerated or decelerated during continuous operation. In one embodiment, the motor can be continuously controlled by controlling the duration of any current second jitter period in the control pulse signal to be equal to a first target value, thereby achieving speed adjustment during smooth operation of the stepper motor. In other words, the above-mentioned scheme of adjusting the duration of each pulse to achieve speed adjustment and the above-mentioned scheme of making the duration of the second jitter period equal to the time interval between any two adjacent pulses can be implemented simultaneously. That is, the duration of each pulse can be adjusted to increase or decrease the running speed while keeping the duration of the second jitter period equal to the time interval between any two adjacent pulses. The control methods during continuous operation and speed adjustment of the stepper motor have been described in detail in the above embodiments, and will not be repeated here for the sake of brevity.

[0071] According to the above technical solution, the duration of the entire first jitter period can be controlled by adjusting the duration of a single pulse within the first jitter period. This solution features flexible speed settings and a wide speed range, ensuring the stability of the winding magnetic field transformation between each stepper motor step, thereby avoiding motor jitter and preventing step loss.

[0072] For example, the stepper motor control method according to the embodiments of this application can be implemented in a device, apparatus or system having a memory and a processor.

[0073] According to another aspect of this application, a stepper motor control device is provided. Figure 4 A schematic block diagram of a stepper motor control device 600 according to an embodiment of this application is shown.

[0074] like Figure 6 As shown, the stepper motor control device 600 according to an embodiment of this application includes an acquisition module 610, a generation module 620, and an output module 630. Each module can respectively perform the functions described above. Figure 2 The steps of the stepper motor control method are described below. Only the main functions of each component of the stepper motor control device 600 are described below, omitting the details already described above.

[0075] The acquisition module 610 is used to acquire control commands from the stepper motor. The acquisition module 610 can be... Figure 1 The processor 102 in the illustrated electronic device executes program instructions stored in the storage device 104 to achieve this.

[0076] The generation module 620 is used to generate corresponding control pulse signals based on control commands. During the generation of control pulse signals, the control commands control the level of the control pulse signals within each target jitter period or the duration of at least a portion of each target jitter period, so that the winding magnetic field of the stepper motor remains consistent across different target jitter periods or the frequency of change of the winding magnetic field within each target jitter period equals the target frequency of change. The control pulse signals are used to control the current in each winding coil of the stepper motor to form the winding magnetic field. The generation module 620 can be... Figure 1 The processor 102 in the illustrated electronic device executes program instructions stored in the storage device 104 to achieve this.

[0077] Output module 630 is used to output control pulse signals to control the operation of the stepper motor. Output module 630 can be... Figure 1 The processor 102 in the illustrated electronic device executes program instructions stored in the storage device 104 to achieve this.

[0078] Figure 7A schematic block diagram of an electronic device 700 according to an embodiment of this application is shown. The electronic device 700 includes a memory 710 and a processor 720.

[0079] The memory 710 stores computer program instructions for implementing corresponding steps in the stepper motor control method according to embodiments of the present application.

[0080] The processor 720 is used to run computer program instructions stored in the memory 710 to perform corresponding steps of the stepper motor control method according to the embodiments of this application.

[0081] In one embodiment, the computer program instructions, when executed by the processor 720, are used to perform the following steps: acquiring control instructions for the stepper motor; generating corresponding control pulse signals based on the control instructions, wherein, during the generation of the control pulse signals, the control instructions control the level of the control pulse signals within each target jitter period or the duration of at least a portion of each target jitter period, so that the winding magnetic field of the stepper motor remains consistent across different target jitter periods or the frequency of change of the winding magnetic field within each target jitter period equals the target frequency of change; the control pulse signals are used to control the current in each winding coil of the stepper motor to form a winding magnetic field; and outputting control pulse signals to control the operation of the stepper motor.

[0082] For example, the processor 720 includes a main control chip and a motor control chip that are communicatively connected to each other. The main control chip is used to generate control commands.

[0083] The motor control chip is used to generate control pulse signals based on control commands and output the control pulse signals to the stepper motor.

[0084] For example, both the main control chip and the motor control chip can be implemented using processor chips such as microcontrollers, microprocessors, digital signal processors (DSPs), field-programmable gate arrays (FPGAs), programmable logic arrays (PLAs), and application-specific integrated circuits (ASICs) and their peripheral circuits. In one embodiment, the main control chip and the motor control chip can communicate through any existing or future communication bus. For example, the communication bus can be an Inter-Integrated Circuit (IIC) bus. 2 C), Serial Peripheral Interface (SPI), Controller Area Network (CAN), etc. In a specific embodiment of this application, the main control chip and the motor control chip adopt I... 2 Communication is achieved via the C bus.

[0085] For example, the memory 710 can be a read-only memory (ROM), random access memory (RAM), programmable read-only memory (PROM), erasable programmable read-only memory (EPROM), one-time programmable read-only memory (OTPROM), or electronically eraseable rewritable read-only memory.

[0086] (Electrically-Erasable Programmable Read-Only Memory, EEPROM), flash memory, etc. The memory described in the embodiments of this application is intended to include, but is not limited to, these and any other suitable types of memory. In one specific embodiment, the memory may be flash memory, which stores program instructions that, when run by a computer or processor, are used to execute the corresponding steps of the stepper motor control method of the embodiments of this application.

[0087] For example, the electronic device 700 also includes a stepper motor connected to the processor 720 for operation under the control of control pulse signals output by the processor 720.

[0088] Figure 8 A schematic flowchart illustrating stepper motor control using an electronic device according to an embodiment of this application is shown. Figure 8 As shown, when the stepper motor starts working, the main control chip sends a control command to the motor control chip. The motor control chip receives the control command and converts it into a control pulse signal. Subsequently, under the control of the control pulse signal, the stepper motor rotates.

[0089] Furthermore, according to embodiments of this application, a storage medium is also provided, on which program instructions are stored. When the program instructions are run by a computer or processor, they are used to execute corresponding steps of the stepper motor control method of this application embodiment and to implement corresponding modules in the stepper motor control device according to embodiments of this application. The storage medium may include, for example, a read-only memory (ROM), a random access memory (RAM), a programmable read-only memory (PROM), an erasable programmable read-only memory (EPROM), a one-time programmable read-only memory (OTPROM), or an electronically erasable rewritable read-only memory.

[0090] The storage medium may be an electrically-Erasable Programmable Read-Only Memory (EEPROM), flash memory, or any combination thereof. In one specific embodiment, the storage medium may be a flash memory that stores program instructions, which, when executed by a computer or processor, are used to perform the corresponding steps of the stepper motor control method of this application.

[0091] In one embodiment, when the program instructions are executed by a computer or processor, the computer or processor may implement the various functional modules of the stepper motor control device according to the embodiments of this application, and / or may execute the stepper motor control method according to the embodiments of this application.

[0092] In one embodiment, the program instructions, when executed, perform the following steps: Acquire control instructions for the stepper motor; Generate corresponding control pulse signals based on the control instructions, wherein, during the generation of the control pulse signals, the control instructions control the level of the control pulse signals within each target jitter period or the duration of at least a portion of each target jitter period, so that the winding magnetic field of the stepper motor remains consistent across different target jitter periods or the frequency of change of the winding magnetic field within each target jitter period equals the target frequency of change; the control pulse signals are used to control the current in each winding coil of the stepper motor to form a winding magnetic field; Output control pulse signals to control the operation of the stepper motor.

[0093] Furthermore, according to an embodiment of this application, a computer program product is also provided, which includes a computer program that, when running, is used to execute the aforementioned stepper motor control method 200.

[0094] Each module in the electronic device according to the embodiments of this application can be implemented by the processor of the electronic device implementing stepper motor control according to the embodiments of this application running computer program instructions stored in the memory, or by computer instructions stored in a computer-readable storage medium of the computer program product according to the embodiments of this application being implemented by a computer running.

[0095] Furthermore, according to an embodiment of this application, a computer program is also provided, which, when running, is used to execute the above-described stepper motor control method 200.

[0096] Although exemplary embodiments have been described herein with reference to the accompanying drawings, it should be understood that the above exemplary embodiments are merely illustrative and are not intended to limit the scope of this application. Various changes and modifications can be made therein by those skilled in the art without departing from the scope and spirit of this application. All such changes and modifications are intended to be included within the scope of this application as claimed in the appended claims.

[0097] Those skilled in the art will recognize that the units and algorithm steps of the various examples described in conjunction with the embodiments disclosed herein can be implemented in electronic hardware, or a combination of computer software and electronic hardware. Whether these functions are implemented in hardware or software depends on the specific application and design constraints of the technical solution. Those skilled in the art can use different methods to implement the described functions for each specific application, but such implementation should not be considered beyond the scope of this application.

[0098] In the several embodiments provided in this application, it should be understood that the disclosed devices and methods can be implemented in other ways. For example, the device embodiments described above are merely illustrative. For instance, the division of units is only a logical functional division, and in actual implementation, there may be other division methods. For example, multiple units or components may be combined or integrated into another device, or some features may be ignored or not executed.

[0099] Numerous specific details are set forth in the specification provided herein. However, it will be understood that embodiments of this application may be practiced without these specific details. In some instances, well-known methods, structures, and techniques have not been shown in detail so as not to obscure the understanding of this specification.

[0100] Similarly, it should be understood that, in order to simplify this application and aid in understanding one or more aspects of the application, various features of this application may sometimes be grouped together in a single embodiment, figure, or description thereof in the description of exemplary embodiments of this application. However, this approach should not be construed as reflecting an intention that the claimed application requires more features than are expressly recited in each claim. Rather, as reflected in the corresponding claims, the point of application is that the corresponding technical problem can be solved with fewer features than all of a single disclosed embodiment. Therefore, the claims following the detailed description are hereby expressly incorporated into that detailed description, wherein each claim itself is a separate embodiment of this application.

[0101] Those skilled in the art will understand that, apart from the mutual exclusion of features, all features disclosed in this specification (including the accompanying claims, abstract, and drawings) and all processes or units of any method or apparatus so disclosed can be combined in any combination. Unless otherwise expressly stated, each feature disclosed in this specification (including the accompanying claims, abstract, and drawings) may be replaced by an alternative feature that serves the same, equivalent, or similar purpose.

[0102] Furthermore, those skilled in the art will understand that although some embodiments herein include certain features included in other embodiments but not others, combinations of features from different embodiments are intended to be within the scope of this application and form different embodiments. For example, in the claims, any of the claimed embodiments can be used in any combination.

[0103] The various component embodiments of this application can be implemented in hardware, or as software modules running on one or more processors, or a combination thereof. Those skilled in the art will understand that microprocessors or digital signal processors (DSPs) can be used in practice to implement some or all of the functions of some modules in the stepper motor control device according to the embodiments of this application. This application can also be implemented as a device program (e.g., a computer program and computer program product) for performing part or all of the methods described herein. Such an implementation of this application can be stored on a computer-readable medium, or can take the form of one or more signals. Such signals can be downloaded from an Internet website, provided on a carrier signal, or provided in any other form.

[0104] It should be noted that the above embodiments are illustrative of this application and not restrictive, and that those skilled in the art can devise alternative embodiments without departing from the scope of the appended claims. In the claims, any reference signs placed between parentheses should not be construed as limiting the claims. The word "comprising" does not exclude the presence of elements or steps not listed in the claims. The word "a" or "an" preceding an element does not exclude the presence of a plurality of such elements. This application can be implemented by means of hardware comprising several different elements and by means of a suitably programmed computer. In the unit claims enumerating several means, several of these means may be embodied by the same item of hardware. The use of the words first, second, and third, etc., does not indicate any order. These words can be interpreted as names.

[0105] The above are merely specific embodiments or descriptions of specific embodiments of this application. The scope of protection of this application is not limited thereto. Any variations or substitutions that can be easily conceived by those skilled in the art within the scope of the technology disclosed in this application should be included within the scope of protection of this application. The scope of protection of this application shall be determined by the scope of the claims.

Claims

1. A stepper motor control method, comprising: Obtain control commands from the stepper motor; Based on the control instructions, corresponding control pulse signals are generated. The control instructions include single-step operation control instructions, which control the stepper motor to operate in single steps. The corresponding target jitter period includes the time interval between two adjacent pulse cycles. Each pulse cycle corresponds to one step of the stepper motor. The control instructions control the level of the control pulse signal within each target jitter period to ensure that the winding magnetic field of the stepper motor remains consistent across different target jitter periods. Alternatively, the control instructions include continuous operation control instructions, which control the stepper motor to operate continuously. The corresponding target jitter periods include a first jitter period and a second jitter period. The first jitter period includes each pulse cycle, and the second jitter period includes the time interval between each pulse cycle and the next pulse cycle. Each pulse cycle corresponds to one step of the stepper motor. The control instructions control the duration of at least a portion of each target jitter period to ensure that the frequency of change of the winding magnetic field within each target jitter period equals the target frequency of change. The control pulse signals are used to control the current in each winding coil of the stepper motor to form the winding magnetic field. The control pulse signal is output to control the operation of the stepper motor.

2. The method as described in claim 1, wherein, The stepper motor includes multiple winding coils, and the control pulse signal includes multiple coil pulse signals corresponding one-to-one with the multiple winding coils. The control command controls the level of the control pulse signal during each target jitter period, including: Between every two adjacent pulse cycles, the single-step operation control command resets the level of the coil pulse signal corresponding to each of the plurality of winding coils to a target level, which is either a high level or a low level.

3. The method as described in claim 2, wherein, The target level is the level corresponding to the de-energized state of the corresponding winding coil.

4. The method of claim 1, wherein, The control commands control the duration of at least a portion of each target jitter period, including: The control command controls the duration of any current second jitter period in the control pulse signal to be equal to the first target value, wherein at least a portion of the period includes the second jitter period; Wherein, the first target value is equal to the time interval between every two adjacent pulses in the first jitter period before the current second jitter period, and for the current second jitter period, the target change frequency is equal to the pulse frequency in the first jitter period before the current second jitter period.

5. The method as described in claim 1 or 4, wherein, The control command includes a speed adjustment command, the target jitter period includes a first jitter period, the first jitter period includes each pulse cycle, the speed adjustment command is used to control the stepper motor to adjust its operating speed, and the control command controls the duration of at least a portion of each target jitter period, including: The control command adjusts the duration of each pulse within each first jitter period from a second target value to a third target value. Wherein, the second target value is equal to the ratio of the first cycle duration to the number of pulses in each pulse cycle, the first cycle duration is the cycle duration corresponding to the operating speed before adjustment, the third target value is equal to the ratio of the second cycle duration to the number of pulses in each pulse cycle, the second cycle duration is the cycle duration corresponding to the operating speed after adjustment, for any first jitter period, the target change frequency is equal to the ratio of the number of pulses in each pulse cycle to the current cycle duration, and any cycle duration is inversely proportional to the corresponding operating speed.

6. The method of claim 5, wherein, The speed control command is an acceleration command, and the second target value is greater than the third target value.

7. The method of claim 5, wherein, The speed control command is a deceleration command, and the second target value is less than the third target value.

8. An electronic device comprising a processor and a memory, wherein, The memory stores computer program instructions, which, when executed by the processor, are used to perform the stepper motor control method as described in any one of claims 1 to 7.

9. The device as claimed in claim 8, wherein, The processor includes a main control chip and a motor control chip that are interconnected. The main control chip is used to generate the control commands; The motor control chip is used to generate the control pulse signal based on the control command and output the control pulse signal to the stepper motor.

10. The device as claimed in claim 8, wherein, The device also includes the stepper motor, which is connected to the processor and is used to operate under the control of the control pulse signal output by the processor.

11. A storage medium on which program instructions are stored, wherein, The program instructions are used to execute the stepper motor control method as described in any one of claims 1 to 7 when the program is run.