How is speed and position control achieved in stepper motors?

How are stepper motor speed and position controlled?
Hello everyone. In a pulse-controlled stepper system, pulse count commands position, pulse frequency commands speed, and DIR selects direction. The motion controller generates the commands; the stepper driver regulates motor phase currents. The motor's operating principle makes its rotor follow the resulting magnetic field. Generating the right command and having the load actually follow it are separate matters.
For an axis to execute a “move 40 mm” command correctly, its microstep setting, mechanical transmission, reference position and acceleration limits must agree. The stepper motor knowledge hub helps put the motor, driver and mechanics together.
Converting between pulses, revolutions and millimetres
Let θ be the full-step angle, M the microstep division, i the ratio of motor revolutions to screw revolutions, and L the screw travel per revolution. Direct coupling gives i = 1; three motor revolutions for one screw revolution gives i = 3. These calculations assume one input pulse per command increment and no electronic gearing.
Motor pulses/rev = (360 / θ) × M
Pulses/mm = motor pulses/rev × i / L
Move pulse count = distance (mm) × pulses/mm
Pulse frequency (Hz) = speed (mm/s) × pulses/mm
Motor speed (rpm) = 60 × frequency / motor pulses/rev
For a screw-based resolution calculation, use its travel per revolution — lead. On a multi-start screw, lead is not necessarily equal to the distance between adjacent threads. Include any gearbox or belt ratio. One motor revolution does not produce the same travel in every mechanism. If a calculation gives a fractional pulse, account for the controller's rounding rule and the resulting travel difference.
Worked example: Moving an axis 40 mm
Use a 1.8° motor at 1/16 microstepping, directly coupled to a screw that advances 5 mm per revolution. The target distance is 40 mm and the target speed is 20 mm/s. These are command calculations, not a guarantee of mechanical accuracy.
| Parameter | Value / calculation |
|---|---|
| Motor / microstepping | 1.8° / 1/16 |
| Screw travel per revolution | 5 mm/rev |
| Transmission ratio | 1:1 |
| Pulses per revolution | 200 × 16 = 3200 |
| Pulses per millimetre | 3200 / 5 = 640 |
| 40 mm move | 40 × 640 = 25,600 pulses |
| 20 mm/s travel speed | 20 × 640 = 12,800 Hz |
| Motor speed | 60 × 12,800 / 3200 = 240 rpm |
The 12.8 kHz value applies to the constant-speed section. Use a suitable ramp rather than applying that frequency immediately at startup. Changing the microstep setting from 1/16 to 1/32 doubles both pulse count and frequency for the same distance and speed. The pulses/mm setting must also be updated. An incorrect match between driver settings and controller scaling produces the wrong travel. Driving the same screw through a 3:1 reduction requires 38.4 kHz and a 720 rpm motor speed for 20 mm/s; the transmission ratio also changes speed and torque requirements.
Why do acceleration and stopping distance matter?
A trapezoidal speed profile has acceleration, constant-speed and deceleration sections. An S-curve can also smooth changes in acceleration. A short move may not have enough distance to reach the requested speed; the controller can instead generate a triangular profile with a lower peak speed.
For an ideal calculation, accelerate from zero to 20 mm/s at a constant 100 mm/s². Acceleration time = v / a = 0.2 s, and acceleration distance = v² / (2a) = 2 mm. Stopping at the same deceleration takes another 2 mm. That leaves 36 mm of the 40 mm move at constant speed, giving an ideal total of 0.2 + 36/20 + 0.2 = 2.2 s. Actual cycle time also depends on pulse generation, profile type and settling time.
The motor's available torque must support both load and acceleration at the operating speed. Holding torque is not the torque available at high speed. Excessive acceleration can cause lost steps and vibration. Increasing pulse frequency alone does not make a motor capable of running faster.
Absolute and relative position commands
An absolute position specifies a target relative to the defined origin. From 25 mm, “go to 40 mm” requires a 15 mm move, or 15 × 640 = 9600 pulses in the example. A relative position specifies an offset from the current position: “move +40 mm” from the same starting point produces a 65 mm target. Configure direction signs and axis limits correctly.
Homing: Is resetting the counter enough?
Homing relates the physical axis position to the controller's coordinate system. A common sequence approaches a reference sensor, moves away, then detects a specified sensor edge again at a lower speed. The reference coordinate and any offset are then assigned. Search direction, speed, sensor filtering and maximum search travel depend on the application.
A home sensor and an end-limit switch can serve different purposes. Resetting a counter while the axis position is unknown does not locate the physical origin. Incremental-feedback systems may need homing again after power loss; absolute measurement still requires a valid coordinate relationship and offset. Homing is not an uncontrolled collision with the mechanical end stop.
What changes with closed-loop control?
In open-loop control, the controller counts output pulses without directly measuring actual shaft position. An encoder-equipped stepper with a compatible driver can provide closed-loop control that compares commanded and measured position. Correction depends on the system: a driver may regulate current and motion, or report an alarm when a limit is exceeded. An encoder does not remove physical torque limits.
A motor-shaft encoder does not directly measure slipping in a coupling or belt further along the transmission. Screw backlash, compliance and load-induced deflection can also produce positioning errors. That makes mechanical inspection and maintenance essential. A smaller microstep gives finer command resolution, not necessarily matching physical positioning accuracy.
Control with a PLC or microcontroller
On a PLC, use a suitable PTO — pulse train output or motion module. Relay outputs are unsuitable for high-frequency STEP generation. A microcontroller can use a hardware timer to generate regular pulse intervals. With STEP/DIR control signals, input levels, pulse widths, and direction setup and hold times must meet the driver's specifications. The highest calculated frequency must remain within both the controller output and driver input limits.
Select supply voltage, phase current and the power supply for the operating requirements. Check motor and driver temperatures during extended cycling. Toggling an output in the normal PLC scan is not equivalent to a motion output that meets the required pulse frequency and timing.
Technical references: Oriental Motor — pulse and motion calculations; Beckhoff — homing; Siemens — PTO; Analog Devices — microstepping and accuracy.