A stepping motor current output control system and method
Through the stepper motor current output control system, combined with the ESP32 chip and H-bridge rectifier control chip, micro-step control of the stepper motor is achieved, which solves the noise and resonance problems and improves the control accuracy of the motor.
Patent Information
- Application Number
- CN202310095912.0
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2023-01-18
- Publication Date
- 2025-09-26
- Estimated Expiration
- 2043-01-18
AI Technical Summary
The existing full-step control method of stepper motors has noise and resonance problems, and the control accuracy is limited by the mechanical structure and cannot be improved at the software level.
A stepper motor current output control system is adopted, including a host computer, a main controller module, a motor drive module, and a magnetic encoder module. Current control is achieved through serial port or CAN bus communication. Combined with the ESP32 chip and the H-bridge rectifier control chip, positive and negative control of phase current and position compensation are performed to achieve micro-step control.
It significantly reduces the noise and resonance during motor movement and improves control accuracy. It is suitable for stepper motor drives in various occasions, especially improving the motor's motion control accuracy during low-speed movement.
Smart Images

Figure CN116111900B_ABST
Abstract
Description
Technical Field
[0001] The present invention relates to a stepper motor current output control system and method, belonging to the technical field of stepper motor drive control, specifically a stepper motor current output control method, and a stepper motor current output control method based on embedded development. Background Art
[0002] Stepper motors convert electrical pulse signals into discrete, uniform, and controllable mechanical motions, making them widely used across various industries. To control a two-phase hybrid stepper motor, phase currents are applied simultaneously to both stator phases, generating a magnetic field that provides the motor's torque. This magnetic field, in turn, generates a torque vector. When the stepper motor moves a full step, the torque vector generated by the phase currents rotates 90 degrees. Therefore, four full steps constitute a torque cycle, with the torque vector rotating 360 degrees. The control method that causes the stepper motor's torque vector to change by 90 electrical degrees is called full-step control. While simple, this control method has several drawbacks. During full-step control, the current in the stator coils undergoes sudden changes, which cause the coils to vibrate, generating noise during motor operation and resonance at low speeds. The control accuracy of full-step control depends on the motor's mechanical structure and cannot be improved at the software level.
[0003] To improve the control accuracy of stepper motors, reduce motor noise, and ensure stable operation, half-step and microstep control have emerged. By subdividing the stepper motor's full steps, the motor's motion accuracy is significantly improved. Therefore, how to better utilize microstep control technology to improve the performance of stepper motors is a pressing issue currently facing those skilled in the art. Summary of the Invention
[0004] The technical problem solved by the present invention is to overcome the deficiencies of the prior art and provide a stepping motor current output control system and method.
[0005] The technical solution of the present invention is:
[0006] A stepper motor current output control system, the control system includes a host computer, a main controller module, a motor drive module, and a magnetic encoder module;
[0007] The host computer is used to input the motor target current to the main controller module through serial communication or CAN bus communication;
[0008] The main controller module is used to receive the motor target current output by the host computer. The main controller module is also used to receive the compensation position information and measurement speed information output by the magnetic encoder module, and convert the received motor target current into a phase current control signal, and output the generated phase current control signal to the motor drive module;
[0009] The motor drive module is used to receive the phase current control signal output by the main controller module, and form a phase current according to the received phase current control signal and output it to the stepper motor;
[0010] The stepper motor is used to receive the phase current output by the motor drive module, and output actual position information and actual speed information to the magnetic encoder module according to the received phase current;
[0011] The magnetic encoder module is used to measure the position information and speed information of the stepper motor through the actual position information and actual speed information output by the stepper motor. The measured position information and speed information are referred to as measured position information and measured speed information. The magnetic encoder module compensates the measured position information according to the received measured speed information and outputs the compensated position information to the main controller module. At the same time, the measured speed information is directly output to the main controller module.
[0012] In the main controller module, the method for converting the received motor target current to generate the phase current control signal is as follows:
[0013]
[0014] Among them, the motor target current elec_ma∈(0,3300mA);
[0015] In the motor drive module, the phase current I is formed according to the received phase current control signal. a , I b The method is:
[0016]
[0017]
[0018] Among them, the AB two-phase shaping data DAC α DAC b The calculation rules are as follows:
[0019]
[0020] Where i is the target subdivision number, and the A phase shaping data is DAC a Corresponding to the subdivision number i, the B phase shaping data DAC b The corresponding subdivision number is i+256;
[0021] Phase current I a , I b The positive and negative control H-bridge circuit realizes the FOC control of the motor. The working modes of the H-bridge rectifier control chip include forward output, reverse output, brake and sleep. The specific mode switching is based on the following:
[0022] If I a >0, the driver chip 1 outputs in the positive direction; if I a <0, the driver chip 1 outputs in reverse; otherwise, the driver chip 1 goes into sleep mode;
[0023] If I b >0, the driver chip 2 outputs in the positive direction; if I b <0, the driver chip 2 outputs in reverse; otherwise, the driver chip 2 goes into sleep mode.
[0024] In the magnetic encoder module, the method for position compensation is: first calculate the compensation value D p :
[0025]
[0026] Among them, ω i To measure the speed information, the compensated position information after compensation is in To measure location information;
[0027] The main controller module uses the ESP32 chip, which outputs the phase current control signal to the motor drive module according to the control target, thereby controlling the rotation of the stepper motor.
[0028] A stepping motor current output control method, the method comprising the steps of:
[0029] In the first step, the host computer inputs the motor target current to the main controller module through serial communication or CAN bus communication;
[0030] In the second step, the main controller module converts the received motor target current to generate a phase current control signal, and outputs the generated phase current control signal to the motor drive module;
[0031] In the third step, the motor drive module generates a phase current according to the received phase current control signal and outputs it to the stepper motor;
[0032] In the fourth step, the stepper motor outputs the actual position information and actual speed information to the magnetic encoder module according to the received phase current;
[0033] In the fifth step, the magnetic encoder module measures the position information and speed information of the stepper motor through the actual position information and actual speed information output by the stepper motor. The measured position information and speed information are called measured position information and measured speed information. The magnetic encoder module compensates the measured position information according to the received measured speed information and outputs the compensated position information to the main controller module. At the same time, the measured speed information is directly output to the main controller module.
[0034] In the main controller module, the method for converting the received motor target current to generate the phase current control signal is as follows:
[0035]
[0036] Among them, the motor target current elec_ma∈(0,3300mA);
[0037] In the motor drive module, the phase current I is formed according to the received phase current control signal. a , I b The method is:
[0038]
[0039]
[0040] Among them, the AB two-phase shaping data DAC a DAC b The calculation rules are as follows:
[0041]
[0042] Where i is the target subdivision number, and the A phase shaping data is DAC a Corresponding to the subdivision number i, the B phase shaping data DAC b The corresponding subdivision number is i+256;
[0043] Phase current I a , I b The positive and negative control H-bridge circuit realizes the FOC control of the motor. The working modes of the H-bridge rectifier control chip include forward output, reverse output, brake and sleep. The specific mode switching is based on the following:
[0044] If I a >0, the driver chip 1 outputs in the positive direction; if I a <0, the driver chip 1 outputs in reverse; otherwise, the driver chip 1 goes into sleep mode;
[0045] If I b >0, the driver chip 2 outputs in the positive direction; if I b <0, the driver chip 2 outputs in reverse; otherwise, the driver chip 2 goes into sleep mode.
[0046] In the magnetic encoder module, the method for position compensation is: first calculate the compensation value D p :
[0047]
[0048] Among them, ω i To measure the speed information, the compensated position information after compensation is in To measure location information;
[0049] Beneficial effects
[0050] (1) The hardware circuit has extremely low power consumption and high energy conversion efficiency. The drive circuit is simple and reliable, and the power supply is also equipped with anti-reverse polarity and overcurrent protection, which can cope with various emergencies in actual applications without damaging the main control chip.
[0051] (2) The core chip combination is reliable and economical. The ESP32 chip has powerful performance and is widely used to develop complex applications. The TB67H450FNG brushed DC motor driver has a wide range of applications. It has a wide operating voltage range of 4.5V-44V, excellent low power consumption, and low output on-resistance.
[0052] (3) Two power supply modes: one is 5V power supply input from USB TYPE-C interface, the other is 12 or 24V power supply input from external source.
[0053] (4) Based on the subdivision drive technology of stepper motors, the present invention has developed a motor current output control system, including a control algorithm and a hardware circuit design. The hardware circuit of the present invention is applicable to most stepper motors on the market. In view of the defects existing in the traditional control method of stepper motors, a control scheme is provided, which can solve the problems such as noise generated by coil vibration and resonance when the motor is running at low speed, and significantly improve the motion control accuracy of the motor. It can be widely used in the stepper motor drive links of various occasions. The microstep control method can effectively reduce the noise during the movement of the motor and the resonance under low-speed movement, and ensure the smooth change of the two-phase excitation current of the motor. The microstep control method significantly improves the control and measurement accuracy of the stepper motor. The more subdivisions the motor has per full step, the higher the control accuracy. The problem of uncertainty in the control cycle time caused by external reasons is overcome by compensating the target subdivision number. BRIEF DESCRIPTION OF THE DRAWINGS
[0054] Figure 1 Schematic diagram of the method flow of the present invention;
[0055] Figure 2 Schematic diagram of the system composition of the present invention. DETAILED DESCRIPTION
[0056] In order to describe the objectives, technical solutions and advantages of this application more clearly and completely, further detailed description will be given below with reference to the accompanying drawings and embodiments.
[0057] The overall flow chart of the stepper motor current output control in this embodiment is as follows: Figure 1 As shown, the current output control method of the present invention is divided into two stages: system preparation and current output control.
[0058] During the system preparation phase, the current output control hardware system modules are initialized and input data for the current output control phase is obtained. This requires calibrating the magnetic encoder. Because the stepper motor driver board can have installation errors during installation, this calibration is required when the motor is first powered on to ensure accurate operation. The magnetic encoder obtains the precise motor position, and the relevant software modules calculate the input data for the current output function: the target subdivision number (divide) and the target current (elec_ma). After initializing all modules and ensuring the normal operation of the stepper motor driver system, the motor's current output control is performed.
[0059] The current output stage uses two TB67H450FNG PWM chopper-type brushed DC motor drivers to independently control the current in the two phase windings of the stepper motor. The torque vector generated by the two-phase currents controls the stepper motor's motion. The TB67H450FNG has a maximum output voltage of 50V and a maximum output current of 3.5A. It supports both PWM constant current drive and direct PWM drive, and supports four operating modes: forward, reverse, brake, and stop. The phase current control signal output by the ESP32 main control chipset passes through an operational amplifier and is then connected to the reference voltage pin of the motor driver chip. The motor position information is acquired from the encoder, and the motor speed control stage determines the target microstepping number and target current as inputs to the current output control stage. An output microstepping routine is designed to convert the input current parameters into the required DAC current absolute value. Since the main control chip outputs 8-bit DAC data, the current needs to be proportionally mapped to 8-bit DAC current data ranging from 0 to 255. The input subdivision number is then mapped to the sinusoidal ratio of phases A and B. In this embodiment, the mapping process uses a space-to-time conversion scheme to create an array pre-stored with 1024 output data points. The input target subdivision number is used as a pointer to the array for mapping and output, completing data shaping and ensuring data reading speed. Ultimately, the two-phase output current is obtained, and the motor FOC control is implemented based on the positive and negative control H-bridge. The H-bridge circuit chip TB67H450FNG used in this embodiment has four operating modes: forward output, reverse output, brake, and sleep. When the corresponding phase current is greater than 0, the chip is in forward output mode; when the phase current is less than 0, the chip is in reverse output mode; otherwise, the chip is in sleep mode.
[0060] Example
[0061] like Figure 1 and Figure 2 As shown, a stepper motor current output control system includes a host computer, a main controller module, a motor drive module, and a magnetic encoder module;
[0062] The host computer is used to input the motor target current to the main controller module through serial communication or CAN bus communication;
[0063] The main controller module is used to receive the motor target current output by the host computer. The main controller module is also used to receive the compensation position information and measurement speed information output by the magnetic encoder module, and convert the received motor target current into a phase current control signal, and output the generated phase current control signal to the motor drive module;
[0064] The motor drive module is used to receive the phase current control signal output by the main controller module, and form a phase current according to the received phase current control signal and output it to the stepper motor;
[0065] The stepper motor is used to receive the phase current output by the motor drive module, and output actual position information and actual speed information to the magnetic encoder module according to the received phase current;
[0066] The magnetic encoder module measures the position information and speed information of the stepper motor through the actual position information and actual speed information output by the stepper motor, and the measured position information and speed information are referred to as measured position information and measured speed information. The magnetic encoder module compensates the measured position information according to the received measured speed information and outputs the compensated position information to the main controller module, and at the same time directly outputs the measured speed information to the main controller module;
[0067] In the main controller module, the method for converting the received motor target current to generate the phase current control signal is as follows:
[0068]
[0069] Among them, the motor target current elec_ma∈(0,3300mA);
[0070] In the motor drive module, the phase current I is formed according to the received phase current control signal. a , I b The method is:
[0071]
[0072]
[0073] Among them, the AB two-phase shaping data DAC a DAC b The calculation rules are as follows:
[0074]
[0075] Where i is the target subdivision number, and the A phase shaping data is DAC a Corresponding to the subdivision number i, the B phase shaping data DAC b The corresponding subdivision number is i+256;
[0076] Phase current I a , I b The positive and negative control H-bridge circuit realizes the FOC control of the motor. The working modes of the H-bridge rectifier control chip include forward output, reverse output, brake and sleep. The specific mode switching is based on the following:
[0077] If I a >0, the driver chip 1 outputs in the positive direction; if I a<0, the driver chip 1 outputs in reverse; otherwise, the driver chip 1 goes into sleep mode;
[0078] If I b >0, the driver chip 2 outputs in the positive direction; if I b <0, the driver chip 2 outputs in reverse; otherwise, the driver chip 2 goes into sleep mode.
[0079] In the magnetic encoder module, the method for position compensation is: first calculate the compensation value D p :
[0080]
[0081] Among them, ω i To measure the speed information, the compensated position information after compensation is in To measure location information;
[0082] The main controller module uses the ESP32 chip, which outputs the phase current control signal to the motor drive module according to the control target, thereby controlling the rotation of the stepper motor.
[0083] A stepping motor current output control method, the method comprising the steps of:
[0084] In the first step, the host computer inputs the motor target current to the main controller module through serial communication or CAN bus communication;
[0085] In the second step, the main controller module converts the received motor target current to generate a phase current control signal, and outputs the generated phase current control signal to the motor drive module;
[0086] In the third step, the motor drive module generates a phase current according to the received phase current control signal and outputs it to the stepper motor;
[0087] In the fourth step, the stepper motor outputs the actual position information and actual speed information to the magnetic encoder module according to the received phase current;
[0088] In the fifth step, the magnetic encoder module measures the position information and speed information of the stepper motor through the actual position information and actual speed information output by the stepper motor. The measured position information and speed information are called measured position information and measured speed information. The magnetic encoder module compensates the measured position information according to the received measured speed information and outputs the compensated position information to the main controller module. At the same time, the measured speed information is directly output to the main controller module.
[0089] In the main controller module, the method for converting the received motor target current to generate the phase current control signal is as follows:
[0090]
[0091] Among them, the motor target current elec_ma∈(0,3300mA);
[0092] In the motor drive module, the phase current I is formed according to the received phase current control signal. a , I b The method is:
[0093]
[0094]
[0095] Among them, the AB two-phase shaping data DAC a DAC b The calculation rules are as follows:
[0096]
[0097] Where i is the target subdivision number, and the A phase shaping data is DAC a Corresponding to the subdivision number i, the B phase shaping data DAC b The corresponding subdivision number is i+256;
[0098] Phase current I a , I b The positive and negative control H-bridge circuit realizes the FOC control of the motor. The working modes of the H-bridge rectifier control chip include forward output, reverse output, brake and sleep. The specific mode switching is based on the following:
[0099] If I a >0, the driver chip 1 outputs in the positive direction; if I a <0, the driver chip 1 outputs in reverse; otherwise, the driver chip 1 goes into sleep mode;
[0100] If I b >0, the driver chip 2 outputs in the positive direction; if I b <0, the driver chip 2 outputs in reverse; otherwise, the driver chip 2 goes into sleep mode.
[0101] In the magnetic encoder module, the method for position compensation is: first calculate the compensation value D p :
[0102]
[0103] Among them, ω i To measure the speed information, the compensated position information after compensation is in To measure position information.
[0104] The above is a preferred embodiment of the present invention. It should be pointed out that for ordinary technicians in this technical field, several improvements and modifications can be made without departing from the principles of the present invention. These improvements and modifications are also considered to be within the scope of protection of the present invention.
Claims
1. A stepper motor current output control system, characterized by: The control system includes a host computer, a main controller module, a motor drive module, and a magnetic encoder module; The host computer is used to input the motor target current to the main controller module; The main controller module is used to receive the motor target current output by the host computer. The main controller module is also used to receive the compensation position information and measurement speed information output by the magnetic encoder module, convert the received motor target current into a phase current control signal, and output the generated phase current control signal to the motor drive module; The motor drive module is used to receive the phase current control signal output by the main controller module, and form a phase current according to the received phase current control signal and output it to the stepper motor; The stepper motor is used to receive the phase current output by the motor drive module, and output actual position information and actual speed information to the magnetic encoder module according to the received phase current; The magnetic encoder module is used to measure the position information and speed information of the stepper motor through the actual position information and actual speed information output by the stepper motor. The measured position information and speed information are referred to as measured position information and measured speed information. The magnetic encoder module compensates the measured position information according to the measured speed information and outputs the compensated position information to the main controller module. At the same time, the measured speed information is directly output to the main controller module. In the magnetic encoder module, the method for position compensation is: first calculate the compensation value D p : Among them, ω i To measure the speed information, the compensated position information after compensation is in To measure position information.
2. A stepper motor current output control system according to claim 1, characterized in that: The host computer is used to input the motor target current to the main controller module through serial communication or CAN bus communication.
3. A stepper motor current output control system according to claim 1 or 2, characterized in that: In the main controller module, the method for converting the received motor target current to generate the phase current control signal is as follows: Among them, the motor target current elec_ma∈(0,3300mA).
4. A stepper motor current output control system according to claim 3, characterized in that: In the motor drive module, the phase current I is formed according to the received phase current control signal. a , I b The method is: Among them, the AB two-phase shaping data DAC a DAC b The calculation method is as follows: Where i is the target subdivision number, and the A phase shaping data is DAC a Corresponding to the subdivision number i, the B phase shaping data DAC b The corresponding subdivision number is i+256.
5. A stepper motor current output control system according to claim 4, characterized in that: The phase current I a , I b The positive and negative control H-bridge circuit realizes the FOC control of the motor. The working modes of the H-bridge rectifier control chip include forward output, reverse output, brake and sleep. The specific mode switching is based on the following: If I a >0, the driver chip 1 outputs in the positive direction; if I a <0, the driver chip 1 outputs in reverse; otherwise, the driver chip 1 goes into sleep mode; If I b >0, the driver chip 2 outputs in the positive direction; if I b <0, the driver chip 2 outputs in reverse; otherwise, the driver chip 2 goes into sleep mode.
6. A stepper motor current output control method, characterized in that The steps of the method include: In the first step, the host computer inputs the motor target current to the main controller module through serial communication or CAN bus communication; In the second step, the main controller module converts the received motor target current to generate a phase current control signal, and outputs the generated phase current control signal to the motor drive module; In the third step, the motor drive module generates a phase current according to the received phase current control signal and outputs it to the stepper motor; In the fourth step, the stepper motor outputs the actual position information and actual speed information to the magnetic encoder module according to the received phase current; In the fifth step, the magnetic encoder module measures the position information and speed information of the stepper motor according to the actual position information and actual speed information output by the stepper motor. The measured position information and speed information are called measured position information and measured speed information. The magnetic encoder module compensates the measured position information according to the measured speed information and outputs the compensated position information to the main controller module. At the same time, the measured speed information is directly output to the main controller module. In the magnetic encoder module, the method for position compensation is: first calculate the compensation value D p : Among them, ω i To measure the speed information, the compensated position information after compensation is in To measure position information.
7. A stepper motor current output control method according to claim 6, characterized in that: In the main controller module, the method for converting the received motor target current to generate the phase current control signal is as follows: Among them, the motor target current elec_ma∈(0,3300mA); In the motor drive module, the phase current I is formed according to the received phase current control signal. a , I b The method is: Among them, the AB two-phase shaping data DAC a DAC b The calculation rules are as follows: Where i is the target subdivision number, and the A phase shaping data is DAC a Corresponding to the subdivision number i, the B phase shaping data DAC b The corresponding subdivision number is i+256; Phase current I a , I b The positive and negative control H-bridge circuit realizes the FOC control of the motor. The working modes of the H-bridge rectifier control chip include forward output, reverse output, brake and sleep. The specific mode switching is based on the following: If I a >0, the driver chip 1 outputs in the positive direction; if I a <0, the driver chip 1 outputs in reverse; otherwise, the driver chip 1 goes into sleep mode; If I b >0, the driver chip 2 outputs in the positive direction; if I b <0, the driver chip 2 outputs in reverse; otherwise, the driver chip 2 goes into sleep mode.
Citation Information
Patent Citations
Multi-shaft stepping motor controller system based on FPGA chip
CN107124125A
Heavy-load closed-loop driving system and method of two-phase hybrid type stepping motor
CN108448965A