This post reviews some of the important aspects that needs to be kept in mind in order to get the most out of a stepper motor that it is controlled using SDC (Smart Device Controller).
In order to ensure that no files are missing in our AS project, we should always use the Wizard from Automation Studio to add the X20SM.
Next, we define the current configuration for the stepper motor. The percentages will depend on the motor that is going to be used and unlike the servo motors (with EnDat encoders), the drive is unable to detect which motor is connected to it. Having a wrong parameter configuration would make the motor work with less torque than its nominal value (if they are too low) or damage it (if they are too high).
Keep in mind that unlike the servomotors, with the stepper motors we do not have a feedback about its current consumption. For that reason, the parameters must take into consideration the mechanics were the motor is coupled to.
A good starting point would be to define the “Maximum current” as the nominal value specified on the motor datasheet while the “Rated current” a value 20% lower than the maximum.
The image above shows an initial configuration for a stepper motor of 2.5A using an X20SM module that can provide up to 3A.
Configuration depending on the type of control:
If the motor does not have an encoder, we will only be able to control it using an open-loop control.
On the other hand, if an encoder is available we can choose to control it using an open-loop or a closed-loop type of control. For example, if we need precision (such as in a CNC application) it is better to use a close-loop type of control. Otherwise, if we only need to perform discrete movements from A to B, an open-loop control with position correction should be enough.
- Open loop control (without encoder):
The mode “Step counter” should be selected for that case. It will be using an internal counter for the X20SM module itself and it has a resolution of 2^8 for every “full-step”.
If we are using stepper motors from B&R, they all have a resolution of 1.8º for each step. That gives us a total of 200 steps for each 360º revolution. To get the “Encoder increments per rev”, we shall multiply the resolution of the step counter times the steps of the motor. This gives us a total of 51200 encoder increments per revolution.
For that case, in the task called “ncsdcctrlInit.st” we must make sure that the parameter DrvIf_Typ is configured as it is shown in the picture below.
- Closed loop control (with encoder):
The most common case is to use an ABR encoder to close the control loop. The default module configuration is considering this scenario.
The only parameter that we must remember to change is the “DrvIf_Typ” from the “ncsdcctrlInit.st”.
- Open loop control (with encoder):
In this case, we do not need to change anything. It is the default configuration when we add an axis using SDC.
IMPORTANT: Remember that the parameters regarding the axis configuration should match in the following 3 different files. In some AS versions if the user changes one of those parameters, it is automatically changed in all the different files. However, it is recommended to check that they match in all the files.
Init Parameter Table:
ACOPOS Parameter Table:
From that point, we could already go to the NC Test Window and start performing some movements. It is possible though that depending on the type of movement we get lag errors or the stepper motor could start making some noise. The reason for that is that some parameter has to be adjusted.
To adjust and improve the control with such type of motors we must consider the following 4 parameters: t_predict, t_jolt, current configuration and Kv of the position controller.
It has a strong influence in this type of systems and it is adjusted in the same way that it is done with the servomotors. The best way to find this value is to compare the difference between S_SET (set position) and S_ACT (actual position) when a movement is started. For that test, the parameters t_predict and t_total should be set to zero.
It must be calculated for both open and closed loop systems. However, its effect is bigger when we work with closed loop systems as for that case, we could get values for t_predict around 50 to 70ms.
After the t_predict has been adjusted, we can reduce the lag error even more with the t_jolt. With stepper motors, this value is normally between 0.02 to 0.1 seconds being always lower than 0.2 seconds. This will allow us to prevent negative lag errors and we will be able to work with higher accelerations.
Having the t_predict and the t_jolt adjusted, the lag error during the acceleration and deceleration phases will be largely reduced.
- Currents (Rated & Maximum current):
The value for the “Rated current” has an effect during the movements at constant speed while the “Maximum current” will affect the acceleration and deceleration phases. Depending on the mechanics, those parameters should be adjusted (always inside the max. current limits of the motor) so the lag error is the lowest possible and the motor does not warms up too much.
- Kv from the position controller (only when closed loop control is used):
It is recommended to start with very low kv values (with this type of systems it is relatively easy that they become unstable with high gains) and keep increasing it until we get an acceptable lag error value.
From our past experience, we know that the kv value will be between 3 to 10. It is also important to never add integral part when using stepper motors because it is often generating unstable controls (by default, those type of systems are already using an integral part to generate the SetPos values).
I hope you find this information usefull. I will be happy to hear your feedback!