Stepping motor acceleration and deceleration curve parameter table generation method based on time prediction and multi-motor motion control method
Through time -based predicted methods to generate a step -to -motor to increase the deceleration parameter table, the problem of not considering the time changes of timer cycle in existing technologies has been solved, and more accurate control and lower energy consumption are achieved.
Patent Information
- Application Number
- CN202411315641.6
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2024-09-20
- Publication Date
- 2025-01-28
- Estimated Expiration
- 2044-09-20
AI Technical Summary
The prior art does not consider the timer period changes when generating the stepper motor acceleration and deceleration curve table, resulting in vibration or inaccurate positioning.
Based on time -based prediction, the step -to -computer deceleration parameter table is generated by setting a specific running time, considering the changes in the movement cycle of the step motor in the movement, and the error of the SIGMOID function defined the domain point point.
The smooth movement is achieved, reducing the heat and vibration, reducing the power driving power of the step motor, and improving the control accuracy of the motor.
Smart Images

Figure CN119382560A_ABST
Abstract
Description
Technical Field
[0001] The present invention relates to the field of control technology, and in particular to a method for generating a stepping motor acceleration and deceleration curve parameter table based on time prediction and a multi-motor motion control method. Background Art
[0002] In automation and precision machinery applications, stepper motors need to transition quickly and smoothly from one speed to another. In the control process of stepper motors, the table lookup method is often used to control their acceleration and deceleration. The acceleration and deceleration table represented by the "S" curve (also known as the Sigmoid curve) enables the stepper motor to achieve smooth movement, effectively reduces heat and vibration, reduces the stepper motor drive power, and improves the control accuracy of the motor. The main purpose of the S-curve acceleration and deceleration is to smoothly control the speed change of the motor in the acceleration and deceleration stages to avoid the impact on the system when starting or stopping directly. However, when generating the acceleration and deceleration curve table of the S-curve based on the table lookup method, a timer interrupt is usually used to obtain the speed value in the table. This method does not take into account that the step length (i.e., step angle or step distance) of the stepper motor is fixed, so after the timer updates the speed value, the timer period will also change, resulting in vibration or inaccurate positioning due to nonlinear problems in the acceleration and deceleration process. Summary of the invention
[0003] The present invention provides a method for generating a stepper motor acceleration and deceleration curve parameter table based on time prediction and a multi-motor control method. The method for generating a stepper motor acceleration and deceleration curve parameter table based on time prediction is used to solve the technical problem that the timer cycle change is not considered in the process of generating a stepper motor acceleration and deceleration table by the classic table lookup method, and the method for generating a stepper motor acceleration and deceleration parameter table is used to set a specific running time to adjust from one speed to another speed.
[0004] In a first aspect, the present invention provides a method for generating a stepping motor acceleration and deceleration curve parameter table based on time prediction, comprising:
[0005] S1: Get the stepper motor acceleration or deceleration running time T, the stepper motor differential mode microstepmode, and the microcontroller timer main frequency F freq , Stepper motor access speed pps in (i.e. initial speed), target speed pps during the stepper motor acceleration or deceleration process aim ;
[0006] S2: Obtain the domain of the Sigmoid function, and use the domain of the Sigmoid function, the access speed of the stepper motor, and the target speed of the stepper motor during acceleration or deceleration to calculate the compensation of the Sigmoid function to obtain the S-type acceleration curve model function of the stepper motor;
[0007] S3: Calculate the microstep running time of the microstep number k according to the current microstep number k and the stepper motor differential mode described in S1; wherein k∈(1,K), K is the total number of microsteps that the stepper motor needs to run from the access speed to the target speed;
[0008] S4: Add the microstep running time of the previous k-1 microsteps to the microstep running time of the microstep number k to obtain the time value of the time node of the current microstep number k, and determine whether the current microstep number k is K: if not, k=k+1, and return to S3; if so, based on all the microstep running time node values, obtain the microstep running time node value table and enter S5;
[0009] S5: Substitute the micro-step operation time node value table into the stepper motor S-type acceleration curve model function in S2 to obtain the stepper motor micro-step operation speed table; wherein the stepper motor micro-step speed table includes an acceleration data table and a deceleration data table;
[0010] S6: Generate the corresponding acceleration and deceleration curve parameter table (MCU automatic reload value) by combining the microstep speed table, the differential mode of the stepper motor and the main frequency of the MCU timer. The entire set of acceleration and deceleration curve parameter tables is the final output result, namely the stepper motor acceleration and deceleration curve parameter table (referred to as the stepper motor acceleration and deceleration table).
[0011] By writing the above stepper motor acceleration and deceleration curve parameter table (referred to as stepper motor acceleration and deceleration table) into a storage medium, the controller uses a table lookup method to fill in the timer automatic reload register in sequence, which is used to control the timer cycle, thereby generating a pulse signal according to the cycle; the stepper motor driver drives the stepper motor to rotate a microstep distance according to the pulse signal. By continuously filling in the timer automatic reload register in sequence using the table lookup method, the stepper motor is accurately adjusted from the access speed to the target speed (including acceleration and deceleration) within the specified time. This method takes into account the change of the motion cycle of the stepper motor during motion, corrects the error at the endpoint of the Sigmiod function definition domain, and solves the technical problems that the traditional table lookup method S-curve method does not consider the change of the microstep operation cycle, resulting in deformation of the acceleration table (causing torque waste) and the traditional table lookup method S-curve method does not consider the error caused by the model definition domain, etc., to achieve smooth motion, effectively reduce heat and vibration, reduce the stepper motor drive power, and improve the control accuracy of the motor.
[0012] Furthermore, the stepper motor S-type acceleration curve model function obtained by the compensation calculation in S2 is:
[0013]
[0014] Among them, PPS in PPS is the entry speed of the stepper motor;aim is the target speed of the stepper motor acceleration or deceleration process; t is the time variable; T is the set stepper motor acceleration or deceleration running time; Sigmoid (t) is the speed of the stepper motor at time t.
[0015] Furthermore, the microstep running time of the microstep number k in S3 is:
[0016]
[0017] Among them, t count (k) is the microstep operation time of the stepper motor in k microsteps; k represents the kth microstep time point; microstepmode is the stepper motor differential mode; Sigmoid (t)k-1 is the speed of the stepper motor at the k-1th microstep.
[0018] Furthermore, the time value of each microstep time node in S4 is:
[0019]
[0020] Among them, t sum (k) is the time value of the time node of the kth microstep.
[0021] Further, the micro-step operation time node value table in S4 includes an acceleration data table and a deceleration data table, wherein the micro-step operation time node value table is:
[0022]
[0023] Wherein, [TimesList] is the micro-step speed table of the stepping motor; [] represents the data structure of an array, linked list or other sequential structure in which the computer stores the speed table; [...] represents the expanded item of the above data structure;
[0024] The specific method of obtaining the acceleration data table is as follows: During the acceleration process, PPS aim >PPS in ,when When it is first satisfied, or the total running time t sum Generate and save acceleration data table when (K)>=T
[0025]
[0026] Wherein, [SigmoidPPSList] is the micro-step speed table of the stepping motor; [] represents the data structure of an array, linked list or other sequential structure in which the computer stores the speed table; [...] represents the expanded item of the above data structure;
[0027] The specific method of obtaining the deceleration data table is as follows: During the deceleration process, PPS aim <PPS in ,when When it is first satisfied, or the total running time t sum When (K)>=T, the recursive generation is terminated and the data table [SigmoidPPSList] of the deceleration process is saved:
[0028]
[0029] Wherein, [SigmoidPPSList] is the micro-step speed table of the stepping motor; [] represents the data structure of the array, linked list or other sequential structure of the computer storing the speed table; [...] represents the expansion item of the above data structure; ε = Sigmoid (0) -PPS in
[0030] Furthermore, the calculation formula of the MCU automatic reload value is:
[0031]
[0032] Among them, [Speedstables] is the stepper motor acceleration and deceleration curve parameter table (MCU automatic reload value table); F freq It indicates the main frequency of the microcontroller timer; microstepmodem indicates the differential mode of the stepper motor.
[0033] In a second aspect, the present invention provides a method for controlling linear motion of multiple stepper motors based on the method for generating a stepper motor acceleration and deceleration curve parameter table based on time prediction as described above, comprising:
[0034] Step 1: Taking the reference stepper motor as a reference, calculate the single-step transmission ratio of each stepper motor other than the reference stepper motor, where the calculation formula of the single-step transmission ratio is:
[0035]
[0036] Among them, p a is the single-step transmission ratio of stepper motor a; x1 is the step angle of the reference stepper motor; x a is the step angle of stepper motor a; y1 is the mechanical transmission ratio of the reference stepper motor; y a is the mechanical transmission ratio of stepper motor a; is the angle between the running direction f1 of the reference stepper motor and the projection f' of the speed vector synthesis direction f of all stepper motors on the running plane of the reference stepper motor and stepper motor a; is the angle between the running direction f2 of stepper motor a and the projection f' of the speed vector synthesis direction f of all stepper motors on the running plane of the reference stepper motor and stepper motor a;
[0037] Step 2: Set the acceleration or deceleration running time T of stepper motor a a Equal to the acceleration or deceleration running time T1 of the reference stepper motor; the entry speed PPS of stepper motor a ina Equal to the entry speed of the reference stepper motor multiplied by the single-step transmission ratio PPS in1 ×p a ; Target speed PPS of stepper motor a aima Equal to the target speed of the reference stepper motor multiplied by the single-step transmission ratio PPS aim1 ×p a ;
[0038] Step 3: Generate acceleration / deceleration curve parameter tables for the reference motor and each stepper motor other than the reference motor using the stepper motor acceleration / deceleration curve parameter table generation method based on time prediction as described above.
[0039] In a third aspect, the present invention provides a method for controlling the coaxial rotation motion of multiple stepper motors based on the method for generating a stepper motor acceleration and deceleration curve parameter table based on time prediction as described above, comprising:
[0040] Step 1: Taking the reference stepper motor as a reference, calculate the single-step transmission ratio of each stepper motor other than the reference stepper motor, where the calculation formula of the single-step transmission ratio is:
[0041]
[0042] Among them, p b is the single-step transmission ratio of stepper motor b; x1 is the step angle of the reference stepper motor; x b is the step angle of stepper motor b; y1 is the mechanical transmission ratio of the reference stepper motor; y b is the mechanical transmission ratio of stepper motor b;
[0043] Step 2: Set the acceleration or deceleration running time T of stepper motor b b Equal to the acceleration or deceleration running time T1 of the reference stepper motor; the entry speed PPS of stepper motor b inb Equal to the entry speed of the reference stepper motor multiplied by the single-step transmission ratio PPS in1 ×p b ; Target speed PPS of stepper motor b aimb Equal to the target speed of the reference stepper motor multiplied by the single-step transmission ratio PPS aim1 ×p b ;
[0044] Step 3: Generate acceleration / deceleration curve parameter tables for the reference motor and each stepper motor other than the reference motor using the stepper motor acceleration / deceleration curve parameter table generation method based on time prediction as described above.
[0045] Beneficial Effects
[0046] The present invention proposes a method for generating a stepper motor acceleration and deceleration curve parameter table based on time prediction and a multi-motor motion control method; wherein the method for generating a stepper motor acceleration and deceleration curve parameter table based on time prediction has the following advantages:
[0047] (1) The stepper motor acceleration and deceleration curve parameter table generated by the method proposed in the present invention can ensure that the speed follows the S-curve model when used for stepper motor speed control, thereby preventing the adverse consequences of speed table deformation. This avoids the problem that the motor may not be able to respond to each pulse signal in time due to speed table deformation, resulting in the rotor position being out of sync with the given signal, and causing stalling or loss of step.
[0048] (2) The stepper motor acceleration and deceleration curve parameter table generated by the method proposed in the present invention can accurately calculate the torque required for acceleration when used for stepper motor speed control, avoid energy waste, and ensure the load capacity of the motor during acceleration and deceleration. By reasonably designing the acceleration and deceleration curve, the motor speed can be changed smoothly, mechanical shock and vibration can be reduced, the stability of the system can be improved, and it can be ensured that the motor can maintain sufficient torque output in the entire speed range to avoid jumping and unstable operation.
[0049] In addition, since the stepper motor acceleration and deceleration curve parameter table generated by the method proposed in the present invention well maintains the S-curve model waveform, it can be used for multi-motor speed vector control under working conditions such as multiple stepper motor linear motion systems and multiple stepper motor coaxial rotation motion systems, ensuring that the multiple motors always maintain the correct vector direction when running. BRIEF DESCRIPTION OF THE DRAWINGS
[0050] In order to more clearly illustrate the embodiments of the present invention or the technical solutions in the prior art, the drawings required for use in the embodiments or the description of the prior art will be briefly introduced below. Obviously, the drawings described below are only some embodiments of the present invention. For ordinary technicians in this field, other drawings can be obtained based on these drawings without paying creative work.
[0051] Figure 1 It is a working principle diagram of the stepping motor provided by the present invention;
[0052] Figure 2This is a schematic diagram of the number of running steps of an "S" type function based on a table lookup method provided in an embodiment of the present invention, taking 1040 steps from 200 pps to 2000 pps as an example;
[0053] Figure 3 It is a speed diagram and a motor acceleration diagram provided by an embodiment of the present invention when an S-type accelerometer is used for operation without considering the change of the timer cycle; wherein (a) is a speed diagram when the S-type accelerometer is used, and (b) is a motor acceleration diagram using the accelerometer shown in (a);
[0054] Figure 4 The present invention provides a stepper motor acceleration and deceleration curve parameter table based on time prediction to generate a speed diagram and a motor acceleration diagram when the acceleration and deceleration table is running; wherein (a) is a speed diagram when the acceleration table is running using the method of the present invention, and (b) is a motor acceleration diagram using the acceleration table shown in (a);
[0055] Figure 5 It is a flow chart of a method for generating a Sigmoid function stepping motor acceleration and deceleration curve parameter table based on time prediction provided by an embodiment of the present invention;
[0056] Figure 6 It is a schematic diagram of the X and Y axis running directions of the classic gantry system provided by an embodiment of the present invention;
[0057] Figure 7 It is a schematic diagram of the X, Y and Z axis running directions of the speed vector synthesis control system of three motors provided in an embodiment of the present invention;
[0058] Figure 8 It is a schematic diagram of a card flipping mechanism provided in an embodiment of the present invention; wherein (a) is a stereoscopic diagram of a card flipping mechanism; wherein (b) is a projection diagram of one side of the first motor m1 of the card flipping mechanism; wherein (c) is a projection diagram of one side of the second motor m2 of the card flipping mechanism. DETAILED DESCRIPTION
[0059] To make the purpose, technical solution and advantages of the present invention clearer, the technical solution of the present invention will be described in detail below. Obviously, the described embodiments are only part of the embodiments of the present invention, rather than all the embodiments. Based on the embodiments of the present invention, all other implementation methods obtained by ordinary technicians in this field without creative work belong to the scope of protection of the present invention.
[0060] The stepper motor is an open-loop control element that converts electrical pulse signals into angular displacement or linear displacement. Its working principle is as follows: Figure 1As shown in the figure (taking a two-phase stepper motor as an example), for each input pulse signal, the rotor rotates an angle or moves forward one step, and the output angular displacement or linear displacement is proportional to the number of input pulses. The drive module converts the input signal into the drive signal of the stepper motor through the driver circuit of the stepper motor. Typical input signals of the drive module include PUL (input step control pulse signal), DIR (stepper motor movement direction control), and ENV (enable). The stepper motor driver circuit can use DRV8825, TMC2225 and its peripheral circuits, M332C stepper motor driver, etc.; the drive signal lines for driving the stepper motor include A+, A-, B+, B- (or ABCD). The drive modes of the stepper motor include full-step drive and micro-step drive (subdivision). In the full-step drive mode, for each input pulse signal, the rotor rotates a fixed angle (called "step angle") or moves forward a certain distance in the linear stepper motor. The distance of each step is fixed, and this distance is related to the structural parameters of the motor. Microstepping drive mode is a technology that subdivides the step size of a stepper motor, allowing the motor to rotate in smaller increments than full-stepping. In microstepping drive mode, the stepper motor driver or stepper motor driver chip achieves the effect of subdivision control by finely controlling the voltage and current; this technology uses current control to produce an intermediate magnetic field state between two full-step positions, allowing the motor to move more smoothly and achieve more precise positioning. When the number of differential steps set in the stepper motor driver circuit and the difference in circuit performance, the drive signal response presents different waveforms. For example, when the full-step drive mode is used, the sampling waveform is a square wave, and in the microstep drive mode, the sampling square wave is approximately a micro-sine waveform.
[0061] In the control process of stepper motors, a table lookup method is often used to control the acceleration and deceleration of stepper motors. Among them, the acceleration and deceleration table represented by the "Sigmoid curve" (also called the S-shaped curve) enables the stepper motor to achieve smooth movement, effectively reduces heat and vibration, reduces the driving power of the stepper motor, and improves the control accuracy of the stepper motor. The main purpose of the S-shaped curve acceleration and deceleration is to smoothly control the speed change of the motor in the acceleration and deceleration stages to avoid the impact on the system when starting or stopping directly. Then, when the acceleration and deceleration curve table of the S-shaped curve is generated based on the table lookup method, a timer interrupt is usually used to obtain the speed value in the table. This method does not take into account that the step length (that is, the step angle or step distance) of the stepper motor is fixed. When the timer updates the speed value, the period of the timer will also change accordingly, causing the actual speed-time waveform of the stepper motor to accelerate or decelerate to change, which increases the torque required for the operation of the stepper motor, that is, more energy is required to change the speed of the stepper motor. Such as Figure 2As shown in the figure, taking the commonly used "S" type (Sigmoid function) acceleration and deceleration algorithm as an example, the horizontal axis in the figure is the number of microsteps of the stepper motor, and the vertical axis is the speed of the stepper motor (unit: step / second-PPS); for the acceleration curve of 200 to 2000PPS, take the full execution of 1040 steps as an example. When the speed is 200PPS, the time for running one step is (1 step / 200 steps / second) 5ms, and when the speed is 2000PPS, the time for running one step is (1 step / 2000 steps / second) 0.5ms. The speed diagram and motor acceleration diagram when running with the S-type accelerometer without considering the change of the timer cycle are shown as follows Figure 3 To this end, in order to solve the technical problem that the change of the timer cycle is not considered in the process of generating the stepper motor acceleration and deceleration table by the classic table lookup method, this application proposes a method for generating a stepper motor acceleration and deceleration table by setting a specific running time to adjust from one speed to another, as follows:
[0062] Example 1
[0063] like Figure 5 As shown, this embodiment provides a method for generating a stepper motor acceleration and deceleration curve parameter table based on time prediction, comprising:
[0064] S1: Get the stepper motor acceleration or deceleration running time T, the stepper motor differential mode microstepmode (values are 1, 2, 4, 8, 16, 32, etc.), and the microcontroller timer main frequency F freq , the access speed PPS of the stepper motor in (i.e. the initial speed at the initial moment, unit: step / second), the target speed PPS of the stepper motor during acceleration or deceleration aim (Unit: steps / second).
[0065] S2: Take the domain of the Sigmoid function as the empirical value [-6,6], and use the domain of the Sigmoid function, the access speed of the stepper motor, and the target speed of the acceleration or deceleration process of the stepper motor to compensate the Sigmoid function (the typical acceleration curve equation of the stepper motor, that is, the Sigmoid curve) to obtain the S-type acceleration curve model function of the stepper motor.
[0066] The equation of the typical acceleration curve (Sigmoid curve) of the stepper motor is:
[0067]
[0068] Among them, Sigmoid (t) represents the speed function of the stepper motor (unit: step / second), t∈[0,T]; then The empirical value is taken here; T is the acceleration or deceleration running time of the stepper motor; Δ is the Sigmoid function in Take the infinite time function value and the Sigmoid function The difference of the function value when the value is -6 is used to compensate for the calculation of the initial speed PPS of the stepper motor in The difference (PPS) between the stepper motor and Sigmoid (0) at time 0 in -Sigmoid (0) | Δ=0 ), stepper motor target speed PPS aim The difference (PPS) between the speed Sigmoid (T) of the stepper motor at time T aim -Sigmoid (T) | Δ=0 ), the calculation of Δ takes into account the change of the motion cycle of the stepper motor during motion, and corrects the error at the endpoint of the Sigmiod function definition domain. After compensation calculation, the above equation obtains the Sigmoid function of the stepper motor time prediction, that is, the stepper motor S-type acceleration curve model function:
[0069]
[0070] Among them, PPS in PPS is the entry speed of the stepper motor (unit: step / second); aim is the target speed of the stepper motor acceleration or deceleration process (unit: step / second); t is the time variable; T is the set stepper motor acceleration or deceleration running time; Sigmoid (t) is the speed of the stepper motor at time t (unit: steps / second).
[0071] S3: Calculate the microstep running time of the microstep number k according to the current microstep number k and the stepper motor differential mode described in S1; wherein k∈(1,K), K is the total number of microsteps that the stepper motor needs to run from the access speed to the target speed.
[0072] Specifically, the microstep running time of microstep number k is:
[0073]
[0074] Among them, t count (k) is the microstep operation time of the stepper motor in k microsteps; k represents the kth microstep time point; microstepmode is the stepper motor differential mode; Sigmoid (t)k-1 is the speed of the stepper motor at the k-1th microstep.
[0075] S4: Add the microstep running time of the previous k-1 microsteps to the microstep running time of the microstep number k to obtain the time value of the time node of the current microstep number k, and determine whether the current microstep number k is K: if not, k=k+1, and return to S3; if so, based on all the microstep running time node values, obtain the microstep running time node value table and enter S5.
[0076] Specifically, the time value of each microstep time node is:
[0077]
[0078] Among them, t sum (k) is the time value of the time node of the kth microstep.
[0079] Since the micro-step cycle of the stepper motor is discrete, the formula for the time value of each micro-step time node can be approximately simplified to the following form:
[0080]
[0081] Among them, t sum (k) is the time value for each microstep time node; is the speed of the stepper motor at k microstep time points; n is the number of microsteps, used for microstep time accumulation and counting (used for counting in the formula, from n=0 to n=k-1); microstepmode is the stepper motor differential mode.
[0082] S5: Substitute the micro-step operation time node value table into the stepper motor S-type acceleration curve model function in S2 to solve in sequence to obtain the stepper motor micro-step operation speed table; wherein the stepper motor micro-step speed table includes an acceleration data table and a deceleration data table.
[0083] Specifically, the microstep running time node value table is:
[0084]
[0085] Wherein, [TimesList] is the micro-step speed table of the stepping motor; [] represents the data structure of an array, linked list or other sequential structure in which the computer stores the speed table; [...] represents the expanded item of the above data structure;
[0086] The specific method of obtaining the acceleration data table is as follows: During the acceleration process, PPS aim >PPS in ,when When it is first satisfied, or the total running time t sum Generate and save acceleration data table when (K)>=T
[0087]
[0088] Wherein, [SigmoidPPSList] is the micro-step speed table of the stepping motor; [] represents the data structure of the array, linked list or other sequential structure in which the computer stores the speed table; [...] represents the expansion item of the above data structure; ε = Sigmoid (0) -PPS in .
[0089] The specific method of obtaining the deceleration data table is as follows: During the deceleration process, PPS aim <PPS in ,when When it is first satisfied, or the total running time t sum When (K)>=t, the recursive generation is terminated and the data table [SigmoidPPSList] of the deceleration process is saved:
[0090]
[0091] Wherein, [SigmoidPPSList] is the micro-step speed table of the stepping motor; [] represents the data structure of the array, linked list or other sequential structure in which the computer stores the speed table; [...] represents the expansion item of the above data structure; ε = Sigmoid (0) -PPS in .
[0092] S6: Generate the corresponding acceleration and deceleration curve parameter table (MCU automatic reload value) by combining the microstep speed table, the differential mode of the stepper motor and the main frequency of the MCU timer. The entire set of acceleration and deceleration curve parameter tables is the final output result, namely the stepper motor acceleration and deceleration curve parameter table (referred to as the stepper motor acceleration and deceleration table).
[0093] Among them, the calculation formula of the microcontroller automatic reload value is:
[0094]
[0095] Among them, [Speedstables] is the stepper motor acceleration and deceleration curve parameter table (MCU automatic reload value table, pulse half cycle time, pulse duty cycle is 50%, used for table lookup method to fill in the MCU automatic reload register in sequence); F freqIndicates the main frequency of the microcontroller timer; microstepmode indicates the differential mode of the stepper motor. By writing the above stepper motor acceleration and deceleration curve parameter table (referred to as the stepper motor acceleration and deceleration table) into the storage medium, the controller uses the table lookup method to fill in the timer automatic reload register in sequence, so that the stepper motor can accurately adjust from the access speed to the target speed (including acceleration and deceleration) within the specified time, achieving smooth movement, effectively reducing heat and vibration, reducing the stepper motor drive power, and improving the motor control accuracy.
[0096] The speed diagram and motor acceleration diagram generated by the acceleration and deceleration table according to the method of this embodiment are as follows: Figure 4 As shown. Figure 3 Comparison shows that the torque required for using the undeformed "S-shaped acceleration curve" is much smaller than the torque of the deformed "S-shaped acceleration curve". Therefore, under the same conditions, the stepper motor using the acceleration and deceleration curve parameter table generated by this embodiment will lose less torque during the acceleration and deceleration process, that is, the load capacity during acceleration and deceleration is increased, or the acceleration and deceleration is completed with fewer steps, or the maximum acceleration speed is increased, etc.
[0097] Example 2
[0098] This embodiment provides a method for controlling linear motion of multiple stepper motors using the method for generating a stepper motor acceleration and deceleration curve parameter table based on time prediction as described above, including:
[0099] Step 1: Taking the reference stepper motor as a reference, calculate the single-step transmission ratio of each stepper motor other than the reference stepper motor, where the calculation formula of the single-step transmission ratio is:
[0100]
[0101] Among them, p a is the single-step transmission ratio of stepper motor a; x1 is the step angle of the reference stepper motor; x a is the step angle of stepper motor a; y1 is the mechanical transmission ratio of the reference stepper motor; y a is the mechanical transmission ratio of stepper motor a; is the angle between the running direction f1 of the reference stepper motor and the projection f' of the speed vector synthesis direction f of all stepper motors on the running plane of the reference stepper motor and stepper motor a; is the angle between the running direction f2 of stepper motor a and the projection f' of the speed vector synthesis direction f of all stepper motors on the running plane of the reference stepper motor and stepper motor a;
[0102] Step 2: Set the acceleration or deceleration running time T of stepper motor a aEqual to the acceleration or deceleration running time T1 of the reference stepper motor; the entry speed PPS of stepper motor a ina Equal to the entry speed of the reference stepper motor multiplied by the single-step transmission ratio PPS in1 ×p a ; Target speed PPS of stepper motor a aima Equal to the target speed of the reference stepper motor multiplied by the single-step transmission ratio PPS aim1 ×p a ;
[0103] Step 3: Generate acceleration / deceleration curve parameter tables for the reference motor and each stepper motor other than the reference motor using the stepper motor acceleration / deceleration curve parameter table generation method based on time prediction as described above.
[0104] In order to further illustrate the method, two stepper motors (a first motor m1 (same as the reference motor), a second motor m2 (same as the stepper motor a)) and a trolley mechanism c1 are used as examples to illustrate in detail:
[0105] like Figure 6 The figure shows a simplified diagram of the X and Y axis running directions of the classic gantry system: wherein f1 represents the running direction of the first motor m1, f2 represents the running direction of the second motor m2, and f represents the running direction of the gantry trolley mechanism c1.
[0106] The angle between the X and Y axis running directions is determined according to the actual implementation method, and the classic value is 90°. In order to realize the gantry trolley mechanism c1 running along the running direction f, the speed vector is decomposed from the f direction to the f1 and f2 directions to obtain the running speed of the first motor m1 and the second motor m2 in a proportional relationship, and the proportional coefficient is the single-step transmission ratio of the two (considering the step angle difference).
[0107] During operation, the access speed, target speed, and number of running steps of the first motor m1 and the second motor m2 are the same as the single-step transmission ratio; the running time of the first motor m1 and the second motor m2 is the same. Based on the above-proposed method for generating a stepper motor acceleration and deceleration curve parameter table based on time prediction, the stepper motor acceleration and deceleration curve parameter table of the first motor m1 and the second motor m2 is generated. If the step angle of the first motor m1 is x1, the step angle of the second motor m2 is x2, the mechanical transmission ratio of the first motor m1 is y1, and the mechanical transmission ratio of the second motor m2 is y2, the angle between the running direction f1 of the first motor m1 and the running direction f is The angle between the running direction f2 of the second motor m2 and the running direction f is The single-step transmission ratio Specifically:
[0108] Take the first motor m1 as the reference stepper motor and obtain the number of acceleration or deceleration steps of the first motor m1m1 , stepper motor acceleration or deceleration operation time unit nT, stepper motor differential mode microstepmode m1 , MCU timer main frequency F freq_m1 , Stepper motor access speed PPS in_m1 (i.e. the initial speed at the initial moment, unit: step / second), the target speed PPS of the stepper motor during acceleration or deceleration aim_m1 (Unit: step / second). And calculate the acceleration or deceleration parameter table of the first motor m1 [Speedstables m1 ];
[0109] Get the number of steps of acceleration or deceleration of the second motor m2 m2 , stepper motor acceleration or deceleration operation time unit nT, stepper motor differential mode microstepmode m2 , MCU timer main frequency F freq_m2 , Stepper motor access speed PPS in_m2 (i.e. the initial speed at the initial moment, unit: step / second), the target speed PPS of the stepper motor during acceleration or deceleration aim_m2 Calculate the acceleration or deceleration parameter table of the second motor m2 [Speedstables m2 ];
[0110] The number of acceleration or deceleration steps of the second motor m2 is ste[s m2 Equal to the number of acceleration or deceleration steps of the first motor m1 multiplied by the single-step transmission ratio steps m1 ×p; the access speed PPS of the second motor m2 in_m2 Equal to the access speed of the first motor m1 multiplied by the single-step transmission ratio PPS in_m1 ×p, the target speed PPS of the second motor m2 aim_m2 Equal to the target speed of the first motor m1 multiplied by the single-step transmission ratio PPS aim_m1 ×p. By converting the above stepper motor acceleration and deceleration curve parameter table ([Speedstables m1 ]、[Speedstables m2 ]) is written into the storage medium, and the controller uses the table lookup method to fill in the timer automatic reload register in sequence, controlling the first motor m1 and the second motor m2 to move simultaneously, solving the speed vector synthesis of two or more motors.
[0111] This embodiment can be extended to the speed vector synthesis of multiple motors, such as Figure 7As shown, taking the speed vector synthesis of three motors as an example, according to the method of this embodiment, a reference motor is selected as the first motor m1, which is used to obtain different single-step transmission ratios p1 and p2, and the corresponding stepping motor acceleration and deceleration curve parameter table ([Speedstables m1 ]、[Speedstables m2 ]). It is worth noting that Figure 7 As shown, when the single-step transmission ratio p1 of the stepper motor m2 is calculated using the first motor m1, the angle is the angle of the projection f' of the trolley direction f on the operating planes of the first motor m1 and the second motor m2; when the single-step transmission ratio p2 of the stepper motor m3 is calculated using the reference motor m1, the angle is the angle of the projection f" of the trolley direction f on the operating planes of the first motor m1 and the third motor m3.
[0112] Example 3
[0113] This embodiment provides a method for controlling the coaxial rotation motion of multiple stepper motors using the method for generating a stepper motor acceleration and deceleration curve parameter table based on time prediction as described above, including:
[0114] Step 1: Taking the reference stepper motor as a reference, calculate the single-step transmission ratio of each stepper motor other than the reference stepper motor, where the calculation formula of the single-step transmission ratio is:
[0115]
[0116] Among them, p b is the single-step transmission ratio of stepper motor b; x1 is the step angle of the reference stepper motor; x b is the step angle of stepper motor b; y1 is the mechanical transmission ratio of the reference stepper motor; y b is the mechanical transmission ratio of stepper motor b;
[0117] Step 2: Set the acceleration or deceleration running time T of stepper motor b b Equal to the acceleration or deceleration running time T1 of the reference stepper motor; the entry speed PPS of stepper motor b inb Equal to the entry speed of the reference stepper motor multiplied by the single-step transmission ratio PPS in1 ×p b ; Target speed PPS of stepper motor b aimb Equal to the target speed of the reference stepper motor multiplied by the single-step transmission ratio PPS aim1 ×p b ;
[0118] Step 3: Generate acceleration / deceleration curve parameter tables for the reference motor and each stepper motor other than the reference motor using the stepper motor acceleration / deceleration curve parameter table generation method based on time prediction as described above.
[0119] In order to further illustrate the method, a card flipping mechanism is taken as an example to be described in detail. Figure 7 As shown, it includes a first motor m1 (same as the reference motor described above), a second motor m2 (same as the stepping motor b described above), a flip mechanism 1, a card shifting gear 2 and a target card 3, m1-1 is the transmission shaft of the first motor m1, m2-1 is the transmission shaft of the second motor m2, 1-1 is a side projection of the first motor m1, and 1-2 is a side projection of the second motor m2:
[0120] In order to ensure that the card can be moved and functions such as card flipping can be realized, the transmission shafts of the first motor m1 and the second motor m2 are coaxial. When the first motor m1 drives the flipping mechanism to rotate, the second motor m2 remains stationary. If the operating speeds of the first motor m1 and the second motor m2 are proportional, the proportional coefficient is the transmission ratio of the two (taking into account the step angle difference).
[0121] During operation, the access speed, target speed, and number of running steps of the first motor m1 and the second motor m2 are the same as the transmission ratio; the running time of the first motor m1 and the second motor m2 is the same. Based on the time-predicted stepper motor acceleration and deceleration curve parameter table generation method proposed by the present invention, the stepper motor acceleration and deceleration curve parameter table of the first motor m1 and the second motor m2 is generated. Specifically:
[0122] If the step angle of the first motor m1 is x1, the step angle of the second motor m2 is x2, the mechanical transmission ratio of the first motor m1 is y1, and the mechanical transmission ratio of the second motor m2 is y2, then the single-step transmission ratio
[0123] Taking the first motor m1 as the reference, get the number of acceleration or deceleration steps of the first motor m1 m1 , stepper motor acceleration or deceleration operation time unit nT, stepper motor differential mode microstepmode m1 , MCU timer main frequency F freq_m1 , Stepper motor access speed PPS in_m1 (i.e. the initial speed at the initial moment, unit: step / second), the target speed PPS of the stepper motor during acceleration or deceleration aim_m1 (Unit: step / second). And calculate the acceleration or deceleration parameter table of the first motor m1 [Speedstables m1 ];
[0124] Get the number of steps of acceleration or deceleration of the second motor m2 m2 , stepper motor acceleration or deceleration operation time unit nT, stepper motor differential mode microstepmode m2, MCU timer main frequency F freq_m2 , the access speed PPS of the stepper motor in_m2 (i.e. the initial speed at the initial moment, unit: step / second), the target speed PPS of the stepper motor during acceleration or deceleration aim_m2 Calculate the acceleration or deceleration parameter table of the second motor m2 [Speedstables m2 ];
[0125] The number of steps for the acceleration or deceleration of the second motor m2 is steps m2 Equal to the number of acceleration or deceleration steps of the first motor m1 multiplied by the single-step transmission ratio steps m1 ×p; the access speed PPS of the second motor m2 in_m2 Equal to the access speed of the first motor m1 multiplied by the single-step transmission ratio PPS in_m1 ×p, the target speed PPS of the second motor m2 aim_m2 Equal to the target speed of the first motor m1 multiplied by the single-step transmission ratio PPS aim_m1 ×p.
[0126] By converting the above stepper motor acceleration and deceleration curve parameter table ([Speedstables m1 ]、[Speedstables m2 ]) is written into the storage medium, and the controller uses the table lookup method to fill in the timer automatic reload register in sequence, controlling the first motor m1 and the second motor m2 to move simultaneously, solving the problem of vector synthesis of the rotation speed of the two coaxial motors.
[0127] This embodiment can be extended to the speed vector synthesis of multiple motors, but the main working condition is a dual-motor type, and the calculation method is the calculation method of the dual motor in this embodiment, which will not be shown in detail.
[0128] It should be understood that in the embodiments of the present invention, the processor may be a central processing unit (CPU), and the processor may also be other general-purpose processors, digital signal processors (DSP), application-specific integrated circuits (ASIC), field-programmable gate arrays (FPGA) or other programmable logic devices, discrete gates or transistor logic devices, discrete hardware components, etc. A general-purpose processor may be a microprocessor or the processor may also be any conventional processor, etc. The memory may include a read-only memory and a random access memory, and provide instructions and data to the processor. A portion of the memory may also include a non-volatile random access memory. For example, the memory may also store information about the type of device.
[0129] The readable storage medium is a computer-readable storage medium, which may be an internal storage unit of the controller described in any of the foregoing embodiments, such as a hard disk or memory of the controller. The readable storage medium may also be an external storage device of the controller, such as a plug-in hard disk, a smart memory card (Smart Media Card, SMC), a secure digital (Secure Digital, SD) card, a flash card (Flash Card), etc. equipped on the controller. Furthermore, the readable storage medium may also include both an internal storage unit of the controller and an external storage device. The readable storage medium is used to store the computer program and other programs and data required by the controller. The readable storage medium may also be used to temporarily store data that has been output or is to be output.
[0130] Based on this understanding, the technical solution of the present invention, in essence or in other words, the part that contributes to the prior art, or all or part of the technical solution can be embodied in the form of a software product, which is stored in a storage medium and includes several instructions for enabling a computer device (which can be a personal computer, a server, or a network device, etc.) to perform all or part of the steps of the method described in each embodiment of the present invention. The aforementioned readable storage medium includes: U disk, mobile hard disk, read-only memory (ROM, Read-Only Memory), random access memory (RAM, Random Access Memory), disk or optical disk, etc., various media that can store program codes.
[0131] It can be understood that the same or similar parts of the above embodiments can be referenced to each other, and the contents not described in detail in some embodiments can refer to the same or similar contents in other embodiments.
[0132] Although the embodiments of the present invention have been shown and described above, it is to be understood that the above embodiments are exemplary and are not to be construed as limitations of the present invention. A person skilled in the art may change, modify, replace and vary the above embodiments within the scope of the present invention.
Claims
1. A method for generating a stepping motor acceleration and deceleration curve parameter table based on time prediction, characterized in that: include: S1: Get the acceleration or deceleration running time of the stepper motor, the differential mode of the stepper motor, the main frequency of the microcontroller timer, the target speed of the stepper motor acceleration or deceleration process, and the entry speed of the stepper motor, that is, the initial speed; S2: Obtain the domain of the Sigmoid function, and use the domain of the Sigmoid function, the access speed of the stepper motor, and the target speed of the stepper motor during acceleration or deceleration to calculate the compensation of the Sigmoid function to obtain the S-type acceleration curve model function of the stepper motor; S3: Calculate the microstep running time of the microstep number k according to the current microstep number k and the stepper motor differential mode described in S1; wherein k∈(1,K), K is the total number of microsteps that the stepper motor needs to run from the access speed to the target speed; S4: Add the microstep running time of the previous k-1 microsteps to the microstep running time of the microstep number k to obtain the time value of the time node of the current microstep number k, and determine whether the current microstep number k is K: if not, k=k+1, and return to S3; if so, based on all the microstep running time node values, obtain the microstep running time node value table and enter S5; S5: Substitute the micro-step operation time node value table into the stepper motor S-type acceleration curve model function in S2 to obtain the stepper motor micro-step operation speed table; wherein the stepper motor micro-step speed table includes an acceleration data table and a deceleration data table; S6: Generate a corresponding acceleration / deceleration curve parameter table by combining the microstep speed table, the differential mode of the stepper motor and the main frequency of the single-chip microcomputer timer. The entire set of acceleration / deceleration curve parameter tables is the final output result, i.e., the stepper motor acceleration / deceleration curve parameter table.
2. The method for generating a stepping motor acceleration and deceleration curve parameter table based on time prediction according to claim 1, characterized in that: The S-type acceleration curve model function of the stepper motor obtained by the compensation calculation in S2 is: Among them, PPS in PPS is the entry speed of the stepper motor; aim is the target speed of the stepper motor acceleration or deceleration process; t is the time variable; T is the set stepper motor acceleration or deceleration running time; Sigmoid (t) is the speed of the stepper motor at time t.
3. The method for generating a stepping motor acceleration and deceleration curve parameter table based on time prediction according to claim 1, characterized in that: The microstep running time of microstep number k in S3 is: Among them, t count (k) is the microstep operation time of the stepper motor in k microsteps; k represents the kth microstep time point; microstepmode is the stepper motor differential mode; Sigmoid (t)k-1 is the speed of the stepper motor at the k-1th microstep.
4. The method for generating a stepping motor acceleration and deceleration curve parameter table based on time prediction according to claim 1, characterized in that: The time value of each microstep time node in S4 is: Among them, t sum (k) is the time value of the kth microstep time node; microstepmode is the stepper motor differential mode.
5. The method for generating a stepping motor acceleration and deceleration curve parameter table based on time prediction according to claim 1, characterized in that: The micro-step running time node value table is: Wherein, [TimesList] is the micro-step speed table of the stepping motor; [] represents the data structure of an array, linked list or other sequential structure in which the computer stores the speed table; […] represents the expanded item of the above data structure; The specific method of obtaining the acceleration data table is as follows: During the acceleration process, PPS aim >PPS in ,when When it is first satisfied, or the total running time t sum (K)>=T generates and saves the acceleration data table [SigmoidPPSList]: Wherein, [SigmoidPPSList] is the micro-step speed table of the stepping motor; [] represents the data structure of an array, linked list or other sequential structure in which the computer stores the speed table; […] represents the expanded item of the above data structure; The specific method of obtaining the deceleration data table is as follows: During the deceleration process, PPS aim <PPS in ,when When it is first satisfied, or the total running time t sum When (K)>=T, the recursive generation is terminated and the data table [SigmoidPPSList] of the deceleration process is saved: Where [SigmoidPPSList] is the micro-step speed table of the stepper motor; [] represents the data structure of the array, linked list or other sequential structure of the computer storing the speed table; […] represents the expansion item of the above data structure; ε = Sigmoid (0) -PPS in .
6. The method for generating a stepping motor acceleration and deceleration curve parameter table based on time prediction according to claim 1, characterized in that: The calculation formula of the microcontroller automatic reload value is: Among them, [Speedstables] is the stepper motor acceleration and deceleration curve parameter table (MCU automatic reload value table); F freq Indicates the main frequency of the microcontroller timer; microstepmode indicates the differential mode of the stepper motor.
7. A method for controlling linear motion of multiple stepper motors based on the method according to any one of claims 1 to 6, characterized in that: include: Step 1: Taking the reference stepper motor as a reference, calculate the single-step transmission ratio of each stepper motor other than the reference stepper motor, where the calculation formula of the single-step transmission ratio is: Among them, p a is the single-step transmission ratio of stepper motor a; x1 is the step angle of the reference stepper motor; x a is the step angle of stepper motor a; y1 is the mechanical transmission ratio of the reference stepper motor; y a is the mechanical transmission ratio of stepper motor a; is the angle between the running direction f1 of the reference stepper motor and the projection f′ of the speed vector synthesis direction f of all stepper motors on the running plane of the reference stepper motor and stepper motor a; It is the angle between the running direction f2 of stepper motor a and the projection f′ of the speed vector synthesis direction f of all stepper motors on the running plane of the reference stepper motor and stepper motor a; Step 2: Set the acceleration or deceleration running time T of stepper motor a a Equal to the acceleration or deceleration running time T1 of the reference stepper motor; the entry speed PPS of stepper motor a ina Equal to the entry speed of the reference stepper motor multiplied by the single-step transmission ratio PPS in1 ×p a ; Target speed PPS of stepper motor a aima Equal to the target speed of the reference stepper motor multiplied by the single-step transmission ratio PPS aim1 ×p a ; Step 3: Generate an acceleration / deceleration curve parameter table of the reference motor and each stepper motor other than the reference motor using the method described in any one of claims 1 to 6.
8. A method for controlling the coaxial rotational motion of multiple stepper motors based on the method according to any one of claims 1 to 6, characterized in that: include: Step 1: Taking the reference stepper motor as a reference, calculate the single-step transmission ratio of each stepper motor other than the reference stepper motor, where the calculation formula of the single-step transmission ratio is: Among them, p b is the single-step transmission ratio of stepper motor b; x1 is the step angle of the reference stepper motor; x b is the step angle of stepper motor b; y1 is the mechanical transmission ratio of the reference stepper motor; y b is the mechanical transmission ratio of stepper motor b; Step 2: Set the acceleration or deceleration running time T of stepper motor b b Equal to the acceleration or deceleration running time T1 of the reference stepper motor; the entry speed PPS of stepper motor b inb Equal to the entry speed of the reference stepper motor multiplied by the single-step transmission ratio PPS in1 ×p b ; Target speed PPS of stepper motor b aimb Equal to the target speed of the reference stepper motor multiplied by the single-step transmission ratio PPS aim1 ×p b ; Step 3: Generate an acceleration / deceleration curve parameter table of the reference motor and each stepper motor other than the reference motor using the method described in any one of claims 1 to 6.
Citation Information
Patent Citations
Stepping motor acceleration and deceleration control method
CN106341063A
Control method and system of multiple stepping motors based on embedded processor
CN108923706A
Pulse generating circuit
JP1996263129A