If you’ve been around the Arduino ecosystem for any length of time, you’ve probably heard about stepper motors. We won’t go into the electromechanics of what makes them tick, but we’ll dive into what they are and some of the things you need to bear in mind when using steppers with your Arduino.
Stepper motors are pretty much designed for our digital age. What sets a stepper motor apart from other DC or AC motors is that they are controlled by sending them electrical pulses. Each pulse causes the motor to move a discrete distance known as a step. The motors in common usage typically move 200 steps per revolution. That works out to 1.8 degrees per step. Now, the step size can be changed depending on how the motor pulses are arranged, so it’s common to run these motors in half steps to achieve 0.9 degrees per step.
Stepper motors excel at positioning. Since they can be moved a fixed number of steps without any additional hardware, they make great positioners as long as you stay within the motor’s limits. Where the positioning can fail is when an external load that’s more than the stepper can hold is applied. Motors are rated by their holding or running torque, which is the amount of force at a certain distance from the center of the shaft. Holding torque is the torque that the motor provides at rest. It’s usually much higher than running torque, which is the torque provided as the motor is moving. Running torque typically drops off at higher speeds.
As your program sends steps to the motor, it’s normal to keep track of the number of steps, since that tells you exactly where the motor has moved to. If you apply force that exceeds the motor’s torque, then the shaft will move and the motors position will become unknown. So your software may believe that the motor is at position 1547 and perhaps this means it moved 203mm, but since the load was forcibly moved (perhaps it jammed), the real position may only be 194mm.
Since the motor’s position can be changed by external forces, it stands to reason that at startup, we don’t know what position it’s in at startup. To figure that out, we need to move to a known, or Home, position. It’s typical to have a sensor at the home position and a “flag” is attached either to the motor shaft or to the axis that drives the load. The home position is usually at the extreme end of motion. This means that although the motor may not know where it is, it will always know that direction Home is in. To home the system, we slowly move the motor in the home direction until the home sensor is activated by the flag. Home is normally the zero position, so we reset our axis position to zero at this point.
Common drive settings
Many manufacturers provide stepper motor drives to the Arduino community. The more sophisticated ones allow you to set the step size (full, half, etc). Some offer current feedback to run the motor at a fixed current. Limit switch inputs are another common feature.
Most Arduino motor tutorials tell you to run the motor at the voltage on its end plate. This is fine: it will make sure that the motor will never overheat, but it’s not the way to get the most performance out of the motor.
The primary limit on a stepper motor isn’t the voltage it’s run at, it’s the current allowed. You also need to consider temperature. Most medium size steppers are rated to run up to about 150 degrees F.
The stepper motor speed is directly proportional to the rate at which it receives the step pulses. Now, at a certain point, you’ll notice that the motor isn’t moving faster as your step rate increases. In a nutshell, this is because the voltage can’t get high enough to keep driving the motor faster. We can easily rectify this by increasing the voltage. Now, if we increase the voltage, we will increase the power that the motor dissipates and that increased power makes it hotter. Remember, we don’t want it to get too hot.
There are two main ways around this problem of wanting to apply a high voltage, but keep the power low. As we mentioned above, some motor drives have a feedback setting so they limit the current to the motor, alternately you can place a high power resistor in line with the motor power input and that will limit the current. The higher voltage applied will allow the motor to respond at higher step rates and provide greater running torque.
You may have heard of microstepping, where you can move a stepper a small fraction of a step. Quarter, eighth, or sixteenth or even finer steps are possible. However, it’s important to note that reducing the step size is typically done to achieve a smoother motion. The motor is not usually designed to be accurate at such small step sizes, so an eighth of a step will not necessarily move a consistent distance.