In this How-to guide, basic steps for the tuning of a stepper motor are explained. The main objective is to point out the main differences between tuning of a 'normal' actuator and a stepper actuator. Knowledge about tuning and how to use MotionLab is assumed or otherwise, you should check the following links first:
Used equipment for this tutorial:
- Ingenia Drive
- FW Version: 126.96.36.199 (first official stepper release)
- SW Version: Motionlab V2.10.2
Steppers and micro-steps explained
To better understand the concept of stepper motors, it is recommended to read some background material (google) about how steppers work. The most important part for now: steppers move from a stable point to a stable point (a step). So normally a current is being applied to one of the coils, resulting in a movement of the motor from one stable point to the next (making a full step). Our drives however also support micro stepping, meaning we virtually add more points. In the next picture, the coil current of one of the phases is shown for full steps (top) and for 1/4 steps (bottom). As it can be seen, with 1/4 steps, every step is represented by 4 extra steps.
Please keep in mind that with micro stepping enabled, the motor is able to provide less torque, since most of the times the motor is at 'unstable' positions.
With micro stepping enabled, the amplitude of the current is lower. We implemented the option to use 'Enhanced current mode', meaning that the current amplitude is being adapted to be of equal size regardless of the step size. This could be disabled/enabled by the user in the motor configuration page. Please keep in mind that this current enhanced mode is increasing the current (higher than the rated current), so when the current to drive the motor is close to the maximum current rating of the board, this might result in an over-current error.
Deciding motor topology
First of all the type of connection for the motor should be decided. A stepper can be connected with the phases in series or in parallel. In general:
A series-wired motor will deliver more stall torque, but torque drops quickly as velocity increases. A parallel-wired motor typically maintains its (lower than series) torque to a higher velocity. So if speed is most important, go for a parallel connection, if torque is most important, go for series.
Note that the wiring of a drive can be tricky, verify if the correct cables are being combined and are connected to the correct phase connections on your drive.
Fill in parameters in motion lab
Similar as for every other type of motor, you should set up all the settings for the motor in the actuator tab, and set the correct feedbacks.
Wiring verification in open-loop
In open-loop, using a small voltage (1-5% of rated voltage), the motor should be able to move. It is advised to change the step size to 'Full Steps' because then the steps are easier to see. Monitor the channels:
- Coil 1 (chart 1) = demanded value of current
- Current phase A (chart 1) = Actual value of current
- Coil 2 (chart 2)
- Current Phase B (chart 2)
Those currents should look similar as to the currents in the plot in the section 'steppers and microsteps explained'. If for example, the phase current drops halfway in the period, the motor phase is not connected correctly.
Current loop tuning
Once the open loop is verified, we are ready to start with the tuning of the current loop.
For the firmware and software versions used for this tutorial, the auto-tuning of the current loop is not implemented yet. So the loop has to be tuned manually.
During tuning of the current loop, the motor will not move, since we are not using any frequency commutation
When doing a maximum step in the torque, the current will be equal to the phase current as it set in the Actuator window
Step size 'Full Steps'
Tuning of the current loop should always be done with the full steps, since then we are applying the maximum current.
Set high torque slope
Since our target is to measure a step in the current/torque, we need a high (as high as possible) slope of torque being applied.
Monitor the torque demand and actual value
For the tuning, monitor the torque demand and torque actual value. The maximum step should be tuned (so from 0 to maximum value).
Now it is time to monitor the PI-values of the current controller, see the response of the torque and phase currents, and adjust until you reached your specs (overshoot, settling time etc.).
Please remember that you are not actually tuning the torque, but you are tuning the current in each phase of the motor. So if something unexpected happens, one can try to monitor the phase currents ('Coil 1' versus 'Current Phase A').
Tune the currents for enhanced current mode
If you are planning to use the stepper with micro steps and 'enhanced current mode' enabled, the steps in the phase currents will be higher than with full steps. So it is advised to check if the 'Current Phase A' is still able to follow the demanded current ( 'Coil 1' in the scope).
Note: when using micro-stepping without the 'enhanced current mode' enabled, you will notice that the actual torque is not able to reach the demanded torque, as expected.
After current tuning, the velocity loop should be tuned. Even though you want to use the motor in position mode, it is advised to first tune the velocity mode, so you can find out what is the maximum reachable speed by the motor.
Select the correct step size
For accurate control, it is advised to use micro stepping with a small as possible step size. In general, we suggest to start with the smallest step size (1/32) and if you are not able to stabilize your velocity loop, increase the step size.
Higher velocity can be reached with a higher step size, however, this also decreases the accuracy of the control.
Calculate the correct velocity and acceleration
For correctly controlling the velocity, the maximal velocity and acceleration should be reachable by the actuator. If you are trying to accelerate faster than possible, the motor will stop moving. In this case, the movement should be starting over. This because the commutation lost track of the movement, and should be started over again by slowly increasing the commutational frequency.
Tune the velocity loop
Now that the maximal reachable speeds are calculated, you can tune the motor using the standard methods for tuning a velocity loop. Monitor the actual velocity and the demanded velocity in one chart, the actual and demanded torques in another chart. Now try to reach the specs for the velocity that you need.
If your target velocity is not being reached, most likely the current is the limiting factor. If you increase the step size of the micro-stepping, you will be able to increase the velocity (you will need a new PID in order to reach your velocity though).