Service Hotline: 13823761625

Support

Contact Us

You are here:Home >> Support >> Technology

Technology

Application of bipolar stepping motor in acceleration and deceleration process

Time:2022-04-10 Views:2229
Introduction

    For DC motors, the speed at which the motor drive shaft reaches a specified speed can be controlled by increasing the voltage (increasing the duty cycle if pulse width modulation is used). However, if it is a stepping motor, changing the voltage will not have any effect on the motor speed. Yes, changing the voltage can change the rate of winding current charge, so as to change the maximum speed of stepping motor, but the motor speed is determined by the rate of winding current switching or rectification.

    Can we assume that stepper motors are machines that do not require a controlled acceleration process? If so, can we give in to the motor at any target speed? The fact is that compared with other motor topologies, stepping motors need to be excited through acceleration and deceleration processes. Starting the stepping motor at any speed may have terrible consequences.

    In this paper, we assume that the reader is familiar with how to use the integrated micro stepping driver on the market to control the stepping motor. The output of the stepping driver (e.g. Ti drv8818, etc.) is directly proportional to the frequency of the square wave ("stepping input"). Each "step" pulse is equal to the step defined by the driver step logic (i.e. micro step). Therefore, changing the square wave frequency will also change the speed of the stepping motor accordingly.


    Figure 1 shows the traditional stepping rate / torque curve of a motor manufacturer, in which the starting frequency FS is an important parameter. We must know that to start this special motor normally, we must use a step rate less than FS. Starting the motor with a step rate greater than FS may stop the motor and lose synchronization. Once this happens, the motor rotation control will be seriously affected. On the surface, this is a serious problem, but it is easy to solve in practice. All you need to do is let the motor start at a step rate lower than FS, and then increase the speed until the target speed is reached. Following this principle, the stepper motor can be driven at a step rate far exceeding FS - as long as the speed remains below the torque / speed curve shown.


Fig. 1 torque / speed curve of bipolar constant current stepping motor


    It is also important that the motor cannot be stopped simply by stopping the "stepping" pulse. Instead, reduce the step rate from the target speed to a lower rate that will stop the motor without driveshaft inertia, which will cause redundant and useless steps. Remember that if a stepper motor is used in a positioning application, the motor drive shaft will lose positioning if the motor continues to rotate when it should stop. Since closed-loop position feedback is rarely used to drive stepper motors, it is important to ensure that only mandatory steps are performed.

Acceleration / deceleration process

    In order to accelerate the stepper motor from the starting speed to a desired target speed, it is only necessary to change the current speed at periodic intervals. Most engineers use microcontrollers to control stepping motors. The most common implementation is to use only two timers. The first is the step per second (SPS) timer, which is used to generate an accurate step rate timing function. The other is the acceleration timer, which is used to change the first timer periodically. Since the velocity is changed periodically, the time-dependent angular velocity (DV / DT) is obtained in essence. This process is called acceleration, that is, the change of velocity over time. Figure 2 shows an enlarged view of a typical microcontroller based acceleration distribution and describes the process of stepping motor accelerating to target speed.

    Fig. 2 enlarged view of typical acceleration process



    SPS is the number of steps per second we want to obtain, that is, the step rate at which the motor rotates. SPS timer must be programmed to send pulses at this rate. According to the oscillator frequency of the timer, the typical equation is:



    Including SPS_ timer_ Register is a 16 bit number that tells the timer how long it takes to generate subsequent "step" pulses, and timer_ Oscillator is a constant that represents the operating speed of the timer in megahertz.

    Store the equation as a function because it is often used. In order to understand its working process, we assume that the timer oscillator works at 8 MHz and the expected motor step rate is 200 SPS. According to this equation, the program code makes SPS_ timer_ The register value is equal to 40000. Then, the timer will generate a "step" pulse every 40000. This produces a timer type output of 200 pulses per second and a drive shaft rotation of 200 SPS.
    
    Each time this event occurs, an interrupt is generated and the timer is cleared. The timing of the rising edge of the "step" input is crucial to the accuracy of the micro step driver, but the falling edge will appear almost at any time as long as it is before the next rising edge of the "step".
    
    Two parameters are needed to define the acceleration curve: (1) SPS value change frequency; (2) The change degree of SPS value. The acceleration curve is directly proportional to these two parameters; That is to say, the more frequently the SPS value changes, the greater its value will be, and the greater the rise and fall of the acceleration curve will be. The acceleration timer controls these two parameters at the same time: the number of times the timer function works is the same as the number of changes of SPS value per second. In addition, the interrupt service program (ISR) of the timer periodically increases the current SPS by a predetermined factor to determine the new speed.

    Determine the acceleration rate using steps per second (spsps), or the number of times per second the current SPS rate changes. If the SPS value is changed by increasing 1, the ISR of the acceleration timer must be called (triggered) every time the acceleration rate is changed. For example, when the acceleration rate is 1000 spsps, the motor speed starts with 200 SPS and increases by 1 periodically until it reaches 1200 SPS. Then, the ISR of the acceleration timer needs to be called 1000 times.

    Another method is to halve the call frequency of the acceleration timer, and then increase the SPS periodically by 2. Compared with the previous example, the ISR of the acceleration timer was called only 500 times, but the motor still started with 200sps and reached 1200sps in 1 second. The difference between the two is more real-time availability, but at the cost of reduced resolution. In other words, in order to achieve the precise acceleration rate of 999 spsps, the first method must be used.

    There must be a trade-off between the two methods, because your choice determines what kind of motor working quality can be achieved. For example, if a lot of granularity is required to achieve all possible acceleration processes, the ISR of the acceleration timer needs to be called as much as possible.

    However, in the previous SPS timer equation, there is a division operation. Depending on the processor core used, this division operation may greatly limit the number of times ISR can be effectively called and correctly generate new SPS rate. When using Ti MSP430 ™ In the implementation of CPU running at 16 MHz, one division takes about 500 µ s. As a result, the maximum number of ISR calls per second is 2000. This limitation determines the size of the increment factor. When the acceleration rate is greater than 2000, an increment greater than 1 must be used.
 
  An acceleration rate calculation is performed shortly before the motor starts. The software responsible for the calculation determines the time interval and increment factor of the acceleration timer, and then configures each variable accordingly. Use these variables at the same time until the SPS rate is modified enough to reach the target speed. Once the target speed is reached, the acceleration stops.

    The deceleration process is basically the same as the acceleration process, except that the increment factor is negative rather than positive. In addition, a new target speed at which the motor can stop safely must be specified.

     Figure 3 shows an acceleration / deceleration process in which the acceleratio

Fig. 3 acceleration / deceleration process



position control


    So far, operating the motor in the speed control loop seems very simple. The motor reaches a certain target speed and then receives a stop command at a certain time. However, what happens when a predetermined number of steps need to be performed within a predetermined period of time? The acceleration / deceleration process becomes more important than ever. In this operation control topology, it is very important that the motor stops after all planned steps are executed. The variable that specifies the number of steps is called number_ of_ steps。


    Wait for the motor to stop without the specified time. One way to achieve this goal is to test a program called steps_ to_ Stop variable programming to make it less than number_ of_ steps。 After that, the software monitors the steps_ to_ Stop to determine when you need to start slowing down. Acceleration will continue until the target speed is reached. After reaching the target speed, after reaching steps_ to_ The stepping motor is still allowed to run before the stop count (at the beginning of deceleration). For example, when running in 1000 steps, steps_ to_ Stop is set to 800. Therefore, the motor starts through an acceleration process and continues to run to step 800. At this time, the motor starts to slow down until it stops running.

    According to the configuration of all system variables, we need to study the following five cases (see Figure 4):
    
    Case 1: all steps end before the motor reaches the target speed.

    Case 2: all steps end when the motor reaches the target speed.

    
    Case 3: all steps end before the stop speed is reached.

    Case 4: all steps end when the stop speed is reached.

    Case 5: after reaching the stop speed, all steps end.

    Figure 4 5 acceleration / deceleration conditions


    It is ideal that the motor stops just when the stop speed is reached (case 4). It is acceptable for the motor to stop shortly before (case 3) or after (case 5) reaching the stop speed, depending on how many steps away from the ideal situation when these conditions occur. For example, if all steps end when the motor rotates too fast, the motor drive shaft may lose position due to moment of inertia. However, if the stop speed is reached before all steps are executed, the total time required to execute the motor motion control will be too long.

    Cases 1 and 2 are for illustrative purposes only and should not occur because the designer should always ensure that steps_ to_ Stop is less than number_ of_ steps。 After knowing all the possible situations, the designer can simply fine tune the system to obtain the best response.

    Another method that requires only a little fine-tuning is to divide the total number of steps into several percentages and assign them to a specific area of each acceleration / deceleration process. In the implementation of this algorithm, 20% of the total number of steps can be selected to accelerate the motor, 60% to make the motor run at a constant speed, and the remaining 20% to decelerate the motor (see Figure 5). If number_ of_ If the steps is 1000, the motor accelerates 200 steps at the preset acceleration, and then stops accelerating no matter what step rate it reaches. After that, 600 steps are performed at this rate, and the last 200 steps complete the whole deceleration process.

     Figure 5 percentage based acceleration / deceleration process



    Please note that when using this algorithm, assuming that the percentage is correctly selected, the stepping cannot be exhausted in the wrong part of the motor movement process. For the example shown in Fig. 5, since the acceleration and deceleration parts are well balanced, the motor is most likely to start and stop at the same speed. The disadvantage of this method is that it is difficult to ensure the target speed. If the target speed is less important, this algorithm can be used to ensure that the motor always stops at a safe speed.
     
    If the speed is slow, the only way to use this algorithm to accelerate the motor drive shaft is to increase the acceleration rate or increase the percentage of steps used in the acceleration / deceleration area. However, the designer must be careful not to let the motor running speed violate the motor torque / speed cur

 conclusion

    The acceleration and deceleration of bipolar stepping motor is the key part of the application design of all stepping motors. Although power stage control has been greatly simplified in the past decade, acceleration and deceleration process applications have not disappeared from the field of application processors. Due to the existence of various stepping motor solutions, it can correctly deal with some algorithms of stepping motor motion control, which is easier to code and fine tune. By correctly accelerating and decelerating the motor, the designer can ensure that the application runs efficiently and meets the requirements of various specifications.

    For details of the code structure of the acceleration / deceleration implementation, please refer to reference 1. This implementation revolves around a power stage similar to drv8818 and uses an MSP430 microcontroller.








    Disclaimer: This article is transferred from other platforms and does not represent the views and positions of this site. If there is infringement or objection, please contact us to delete. thank you!
    矽源特科技ChipSourceTek