7  Stepper Motors

actuators
stepper
motors

7.1 Start With the Story

Imagine a feeder that must move a gate exactly 12 millimetres, then return to the same home point every time. The actuator story is not “make the shaft spin”; it is “count motion, avoid missed steps, hold position, and recover if the load slips.”

Stepper motors fit that story when discrete movement and repeatability matter. The driver current, acceleration ramp, homing method, torque margin, and missed-step evidence are part of the actuator, not optional extras.

In 60 Seconds

Stepper motors move in precise discrete steps (typically 1.8 degrees per step) and provide open-loop position control without feedback sensors. They excel in applications requiring exact positioning like 3D printers and CNC machines, but need acceleration profiles to prevent missed steps and draw continuous holding current even when stationary.

Key Concepts
  • Stepper Motor Operation: A brushless DC motor that moves in discrete angular steps by sequentially energizing coils; each step is a fixed angle (0.9, 1.8, or 3.6 degrees typically); enables precise open-loop position control without a position sensor
  • Step Modes: Full step (one coil at a time): maximum torque, coarser resolution; half step (alternating one and two coils): smoother motion, 2x resolution; microstepping (variable current in adjacent coils): very smooth motion, up to 256x resolution per full step
  • Stepper Motor Driver IC: Dedicated ICs (A4988, DRV8825, TMC2208) that handle the coil energization sequence, current limiting, and microstepping; accept simple STEP/DIR logic signals from the MCU, simplifying firmware to just controlling pulse rate and direction
  • H-Bridge Driver Boundary: Bipolar steppers need bridge switches that reverse current through each coil; older dual H-bridge chips such as L293D expose the coil-pair logic directly, while modern chopper drivers hide that switching behind STEP/DIR pins
  • Holding Torque: The torque a stepper motor exerts when powered but stationary to resist external forces trying to move the shaft; enables passive position holding without a brake; drops significantly when power is removed (detent torque is much lower)
  • Steps Per Revolution: The number of full steps to complete one full rotation; a standard 200-step motor (1.8 degree per step) needs 200 steps for 360 degrees; with 16x microstepping, this becomes 3200 microsteps per revolution
  • Resonance and Mid-Frequency Instability: At certain speeds, the step frequency matches the rotor’s natural mechanical resonance frequency, causing vibration, noise, and missed steps; mitigated by microstepping, mechanical damping, or driving through the resonant speed range quickly
  • Reference Current (Vref) Setting: Stepper drivers like A4988 and DRV8825 require setting the maximum coil current via a potentiometer (Vref); incorrect Vref causes overheating (too high) or insufficient torque and missed steps (too low); calculate from motor’s rated current per phase
  • Acceleration Profiles: Ramping step frequency from low to high (acceleration) and high to low (deceleration) prevents step loss at high speeds; the maximum speed without losing steps depends on load, current setting, and supply voltage; libraries like AccelStepper implement S-curve profiles automatically

Phoebe the physics guide

Phoebe’s Why

A driver like the A4988 or DRV8825 does not command a coil directly by angle – it commands a coil current, and it checks that current with a plain resistor and Ohm’s law: the sense resistor turns amps into a voltage the chopper circuit can compare against a reference. That reference itself comes from a voltage divider (the Vref pot). Microstepping is what happens when that current reference is stepped through a table of values that approximate a sine wave instead of switching full-on or full-off – it is literally sampling and quantizing a continuous current waveform into \(N\) discrete levels per quarter cycle, the same “how many steps represent the smooth original” question a Nyquist-and-quantization page asks of a voltage. And because a sine curve is steepest near zero and flattest near its peak, those quantization steps are not even in size – equal angle steps near the zero crossing produce far bigger current jumps than equal angle steps near full current, which is exactly why low microstep counts feel roughest near a coil’s zero crossing.

The Derivation

Ohm’s law across the driver’s current-sense resistor:

\[V_{sense} = I_{coil}\times R_{sense}\]

The reference voltage set by the driver’s Vref potentiometer divider:

\[V_{ref} = V_{supply}\times\frac{R_2}{R_1+R_2}\]

Microstepping quantizes one quarter of a sine cycle into \(N\) current levels:

\[I_k = I_{trip}\times\sin\!\left(\frac{k\pi}{2N}\right), \quad k = 0,1,\dots,N\]

The coil is inductive, not capacitive, so the relevant circuit time constant is \(L/R\), not \(RC\) – a first-order current rise toward a new commanded level:

\[i(t) = I_{target}\left(1-e^{-tR/L}\right)\]

Worked Numbers: This Chapter’s 1/16 Microstepping

  • Current-sense voltage (catalog-typical \(R_{sense}=0.1\ \Omega\), \(I_{trip}=1.5\) A within this chapter’s 1.2–2.0 A range): \(V_{sense} = 1.5\times0.1\) \(= 0.150\) V
  • This chapter’s own 1/16 microstepping (200 \(\to\) 3,200 steps/rev, so \(N=16\) microsteps per quarter cycle): each microstep is \(90^\circ/16\) \(= 5.625^\circ\) of electrical angle
  • Non-uniform quantization: the first microstep (\(k=0\to1\)) jumps \(I_1-I_0 = 1.5\sin(5.625^\circ)\) \(= 0.147\) A; the last microstep (\(k=15\to16\), near the sine peak) jumps only \(1.5-1.5\sin(84.4^\circ)\) \(= 0.007\) A – the first step is about \(20.4\times\) larger than the last, even though every step covers the same \(5.625^\circ\)
  • Coil L/R lag versus this chapter’s own 800 steps/s: catalog-typical NEMA 17 values \(R=1.5\ \Omega\), \(L=2.5\) mH give \(\tau=L/R\) \(= 1.67\) ms, longer than the \(1/800\) \(= 1.25\) ms full-step period this chapter already uses for its 50 mm travel-time example. Solving \(i(t)/I_{target}=1-e^{-t/\tau}\) at \(t=1.25\) ms gives only \(52.8\%\) of target current reached before the next full step commands a new value – the physical reason stepper torque falls off at speed

Learning Objectives

After completing this chapter, you will be able to:

  • Describe stepper motor construction and differentiate full-step, half-step, and microstepping sequences
  • Control stepper motors with ULN2003 and A4988/DRV8825 drivers
  • Implement acceleration profiles to prevent missed steps
  • Apply the AccelStepper library to generate smooth trapezoidal motion profiles
  • Configure microstepping for increased resolution
  • Calculate torque, resolution, and travel time when sizing stepper motors for precision applications

A stepper motor moves in tiny, precise clicks – like the second hand on a clock ticking from one mark to the next. Each electrical pulse makes the motor rotate by exactly one small step (often just 1.8 degrees). By counting these steps, you always know exactly where the motor is positioned without needing any additional sensors. This is why stepper motors are used in 3D printers and CNC machines where precise movement is essential.

Chapter Roadmap

This chapter has four connected stops:

  1. First you build the mental model: discrete steps, open-loop counting, construction, and driver role.
  2. Then you turn that model into control wiring: ULN2003 sequences and STEP/DIR driver control.
  3. Next you size a real motion: microstepping, torque margin, current limits, and acceleration profiles.
  4. Finally you test the failure modes: missed steps, overheating, precision limits, and the evidence needed before trusting the axis.

Checkpoints recap the main decisions. Deep dives, calculators, and labs are optional breathers for testing the numbers.

7.2 Stepper Motor Fundamentals

Stepper motors move in discrete steps, providing precise position control without feedback sensors (open-loop control).

How It Works: Stepper Motor Step-by-Step Operation

Think of a stepper motor like a clock’s second hand that can only move to specific tick marks. Here’s what happens with each electrical pulse:

Step 1: Energize First Coil - Electricity flows through coil A, creating a magnetic field that pulls the rotor’s permanent magnet teeth to align with coil A’s poles. The rotor snaps to position 0°.

Step 2: Switch to Next Coil - Coil A turns off, coil B turns on. The magnetic field shifts 90°, and the rotor follows, snapping to position 90° (or 1.8° for a 200-step motor).

Step 3: Continue the Sequence - By energizing coils in order (A → B → C → D → A…), the rotor steps around the circle precisely. Each pulse = one fixed angular movement.

Real-World Analogy: Imagine a gear with 200 teeth locked between 4 electromagnets positioned around a circle. Turn on the north electromagnet, and the gear’s nearest tooth snaps to it. Turn off north, turn on east – the gear rotates exactly one tooth. No encoder needed; you count pulses and know the exact position.

Why No Feedback Needed? Each step is mechanically fixed by the motor’s tooth count and coil positions. Send 100 pulses → rotor moves exactly 100 steps (unless it skips due to overload).

Characteristics:

  • Precise angular positioning (typically 1.8 deg/step = 200 steps/rev)
  • Open-loop control (no encoder needed)
  • High holding torque at standstill
  • Step-by-step movement (can be jerky at low speeds)
  • Higher power consumption than servos

7.2.1 Construction And Motor-Type Selection

Do not select a stepper from the package photo alone. The useful design question is whether the physical job needs counted position, continuous speed, integrated feedback, or a simple angle command, then whether the motor, driver, supply, wiring, and software can carry the required torque.

A small permanent-magnet stepper exposes the same construction ideas that appear in larger hybrid steppers: rotor cups or toothed rotor poles attached to a permanent-magnet shaft, stator coils and poles around that rotor, shaft bearings that keep the rotor aligned, and a housing plus wire harness that bring the coil phases to the driver. The driver board is not optional decoration; it translates low-power controller signals into the coil current sequence that makes the rotor align one step at a time.

Use this comparison as a first-pass selection record before choosing a part:

Candidate Typical fit Selection caution
Stepper motor Low-cost counted positioning, high repeatability, and holding torque where medium speed is acceptable. Needs a driver, current setting, acceleration ramp, and homing or feedback when missed steps matter.
DC motor Low-cost, high-speed continuous rotation for fans, wheels, pumps, and simple mechanisms. Without an encoder or process feedback it gives speed effort, not position proof.
DC motor with encoder Higher-speed motion where actual speed, distance, or position must be measured. The motor driver may stay simple, but encoder wiring, evidence handling, and control software become part of the design.
Servo motor Compact angle control with built-in feedback for moderate speed and torque jobs. Rotation range, stall torque, supply current, mounting, and end stops must match the linkage.

For all four choices, check supply voltage, running and startup current, torque margin, driver rating, mechanical stops, and the evidence that proves the output moved as intended.

A NEMA 17 stepper with 200 steps/revolution moves \(\theta = 360° / 200 = 1.8°\) per step. With a lead screw (2mm pitch), one full rotation moves the carriage \(d = 2\) mm, so each step moves \(d_{step} = 2/200 = 0.01\) mm = 10 micrometers. At 1/16 microstepping (3200 steps/rev), resolution becomes \(0.01 / 16 = 0.000625\) mm = 0.625 micrometers per microstep. To move 50mm requires \(n = 50 / 0.01 = 5000\) full steps. At 800 steps/s, travel time is \(t = 5000/800 = 6.25\) s.

Motor MaxCheckpoint: Counted Motion

You now know:

  • A common stepper gives 200 full steps per revolution, so one full step is 1.8 degrees.
  • With a 2 mm lead screw, one 200-step revolution moves 2 mm, so one full step moves 0.01 mm.
  • At 1/16 microstepping, the same 200-step motor exposes 3200 commanded microsteps per revolution, but torque margin still decides whether the load actually follows.

The counting math is only useful if the electronics can reverse and limit coil current correctly. The next section makes that driver boundary explicit.

7.2.2 H-Bridge Driver Boundary

A stepper driver is the power spine between the microcontroller and the motor coils. The controller pins are only logic signals; the driver contains transistor switches that route real coil current from the motor supply. Current through a coil creates a magnetic field, and changing the current path changes the field that pulls the rotor toward the next aligned position.

For a bipolar stepper, think of the driver as two H-bridges: one bridge for coil X and one bridge for coil Y. Driving one diagonal switch pair sends current through a coil in one direction; driving the opposite diagonal pair reverses that current and swaps the coil’s north/south polarity. That is the physical reason a sequence of logic states makes the rotor rotate instead of merely energizing a random winding.

Older dual H-bridge chips make that boundary visible. On an L293D-style part, VCC1 powers the logic side, VCC2 powers the motor side, EN-1,2 and EN-3,4 enable the two bridge channels, and the outputs connect to coil X and coil Y. The controller must share ground with the driver logic, but it must not supply the motor current directly.

One simple full-step bridge sequence can be recorded like this:

Step X Xbar Y Ybar Physical result
1 0 1 0 1 Coil X and coil Y are driven in their first polarity pair.
2 1 0 0 1 Coil X reverses while coil Y stays in the first polarity.
3 1 0 1 0 Coil Y reverses, advancing the magnetic alignment again.
4 0 1 1 0 Coil X reverses back while coil Y holds the second polarity.

Different driver boards rename the pins, but the review question is the same: which device owns coil current, which supply powers the motor, which logic pins choose bridge polarity, and what proof shows the sequence rotates the shaft without overheating the driver.

7.2.3 Step Sequences

Full-Step Sequence (28BYJ-48 with ULN2003):

Step IN1 IN2 IN3 IN4
1 1 0 0 0
2 0 1 0 0
3 0 0 1 0
4 0 0 0 1

Half-Step Sequence (smoother, double resolution):

Step IN1 IN2 IN3 IN4
1 1 0 0 0
2 1 1 0 0
3 0 1 0 0
4 0 1 1 0
5 0 0 1 0
6 0 0 1 1
7 0 0 0 1
8 1 0 0 1

You have now seen the coil sequence directly. The next two examples show how that same idea appears in the small 28BYJ-48 hobby motor and the higher-current NEMA 17 driver stack.

7.3 28BYJ-48 with ULN2003

The 28BYJ-48 is a popular small stepper for hobby projects.

Specifications:

  • Steps per revolution: 2048 (with 64:1 gearbox)
  • Operating voltage: 5V DC
  • Current: 200-300mA
  • Step angle: 5.625 deg/64 = 0.18 deg effective
#include <AccelStepper.h>

// 28BYJ-48 with 64:1 gearbox = 2048 steps per revolution
AccelStepper stepper(AccelStepper::HALF4WIRE, 19, 5, 18, 17);
const int STEPS_PER_REV = 2048;

void setup() {
  Serial.begin(115200);
  stepper.setMaxSpeed(1000);       // Steps per second
  stepper.setAcceleration(500);    // Steps per second^2
  Serial.println("Commands: 0-360 = angle, h = home, f = full rotation");
}

void loop() {
  if (Serial.available()) {
    String input = Serial.readStringUntil('\n');
    input.trim();

    if (input == "h") {
      stepper.moveTo(0);                                  // Home
    } else if (input == "f") {
      stepper.move(STEPS_PER_REV);                        // Full rotation
    } else {
      int angle = input.toInt();
      if (angle >= 0 && angle <= 360) {
        stepper.moveTo((long)angle * STEPS_PER_REV / 360);  // Go to angle
        Serial.printf("Moving to %d degrees\n", angle);
      }
    }
  }
  stepper.run();  // Must be called frequently — handles acceleration
}

7.4 NEMA 17 with A4988/DRV8825

For higher performance, NEMA 17 steppers with A4988 or DRV8825 drivers are the standard choice.

NEMA 17 Specifications:

  • Steps per revolution: 200 (1.8 deg/step)
  • Holding torque: 40+ kg-cm
  • Operating current: 1.2-2.0A per phase
  • Voltage: 12-24V

A4988 Driver Features:

  • Microstepping: 1, 1/2, 1/4, 1/8, 1/16
  • Current limit adjustment
  • Sleep mode for power saving
  • Step/direction interface

Microstepping Settings:

MS1 MS2 MS3 Resolution Steps/Rev
0 0 0 Full step 200
1 0 0 1/2 step 400
0 1 0 1/4 step 800
1 1 0 1/8 step 1600
1 1 1 1/16 step 3200
#include <AccelStepper.h>

#define STEP_PIN 25
#define DIR_PIN 26
#define ENABLE_PIN 27

// NEMA 17 with 1/16 microstepping = 3200 steps per revolution
AccelStepper stepper(AccelStepper::DRIVER, STEP_PIN, DIR_PIN);

const int STEPS_PER_REV = 3200;

void setup() {
  Serial.begin(115200);

  pinMode(ENABLE_PIN, OUTPUT);
  digitalWrite(ENABLE_PIN, LOW);  // Enable driver (active LOW)

  stepper.setMaxSpeed(3000);      // Steps per second
  stepper.setAcceleration(1000);  // Steps per second^2

  Serial.println("NEMA 17 Stepper Ready");
}

void loop() {
  if (Serial.available()) {
    char cmd = Serial.read();

    switch(cmd) {
      case 'f':  // Forward one revolution
        stepper.move(STEPS_PER_REV);
        break;
      case 'b':  // Backward one revolution
        stepper.move(-STEPS_PER_REV);
        break;
      case 'h':  // Home position
        stepper.moveTo(0);
        break;
      case 's':  // Stop
        stepper.stop();
        break;
      case 'd':  // Disable (power saving)
        digitalWrite(ENABLE_PIN, HIGH);
        break;
      case 'e':  // Enable
        digitalWrite(ENABLE_PIN, LOW);
        break;
    }
  }

  stepper.run();
}

Motor MaxCheckpoint: Driver Choice

You now know:

  • A 28BYJ-48 with its 64:1 gearbox uses 2048 steps per revolution, so a 90-degree move is 512 steps.
  • ULN2003-style boards expose the coil sequence; A4988 and DRV8825 boards hide it behind STEP, DIR, and current-limit settings.
  • A NEMA 17 at 1/16 microstepping changes a 200-step revolution into 3200 commanded microsteps, but the current limit and supply voltage still set the usable torque.

7.5 Acceleration Profiles

Why Acceleration Matters

Steppers cannot instantly change speed. Attempting to start at full speed causes missed steps because the rotor can’t keep up with the magnetic field changes.

Trapezoidal velocity profile:

  1. Acceleration phase: Gradually increase speed
  2. Constant velocity: Maintain max speed during travel
  3. Deceleration: Gradually decrease speed to prevent overshoot

The AccelStepper library handles this automatically!

Worked Example: Sizing a Stepper for a Linear Actuator

Scenario: You need to move a 3D printer’s Z-axis platform weighing 2 kg through 200 mm of travel using a lead screw with 8 mm pitch (one revolution = 8 mm linear travel).

Step 1 – Calculate required revolutions:

  • Total travel: 200 mm
  • Lead screw pitch: 8 mm/rev
  • Revolutions needed: 200 / 8 = 25 revolutions

Step 2 – Calculate required steps (NEMA 17 at 1/16 microstepping):

  • Steps per revolution: 200 full steps x 16 microsteps = 3,200
  • Total steps: 25 x 3,200 = 80,000 steps

Step 3 – Calculate linear resolution:

  • Resolution per microstep: 8 mm / 3,200 = 0.0025 mm (2.5 micrometers)
  • This exceeds typical 3D printing needs (50-100 micrometers per layer)

Step 4 – Calculate required torque:

  • Force to lift 2 kg: F = m x g = 2 x 9.81 = 19.62 N
  • Lead screw torque: T = F x pitch / (2 x pi x efficiency)
  • Assuming 40% efficiency: T = 19.62 x 0.008 / (2 x 3.14159 x 0.4) = 0.0625 Nm = 6.25 Ncm
  • With 2x safety margin: 12.5 Ncm – a standard NEMA 17 (40+ Ncm) has ample torque

Step 5 – Estimate travel time at 1,000 steps/sec max speed with 500 steps/sec2 acceleration:

  • Acceleration time to max speed: t_accel = v_max / a = 1000 / 500 = 2 seconds
  • Acceleration distance: s_accel = 1/2 × a × t2 = 0.5 x 500 x 4 = 1,000 steps
  • Deceleration distance: s_decel = 1,000 steps (same)
  • Constant-speed distance: 80,000 - 2,000 = 78,000 steps
  • Constant-speed time: t_const = 78,000 / 1000 = 78 seconds
  • Total time: 2 seconds (accel) + 78 seconds (constant) + 2 seconds (decel) = 82 seconds for 200 mm travel
Connection: Stepper Motors and PID Control

Stepper motors provide open-loop positioning, but many IoT applications combine them with closed-loop PID controllers for higher reliability. When a stepper drives a process variable (temperature via a mixing valve, flow rate via a metering pump), the PID controller commands position changes while the stepper executes them precisely. See PID Control Fundamentals for the control theory behind this pairing.

// Manual trapezoidal profile (if not using AccelStepper)
void moveWithAcceleration(int targetSteps, int maxSpeed, int acceleration) {
  int currentSpeed = 0;
  int position = 0;
  int direction = (targetSteps > 0) ? 1 : -1;
  targetSteps = abs(targetSteps);

  // Calculate distances for accel/decel phases
  int accelSteps = (maxSpeed * maxSpeed) / (2 * acceleration);
  int decelSteps = accelSteps;
  int constSteps = targetSteps - accelSteps - decelSteps;

  if (constSteps < 0) {
    // Can't reach max speed, use triangular profile
    accelSteps = targetSteps / 2;
    decelSteps = targetSteps - accelSteps;
    constSteps = 0;
    maxSpeed = sqrt(2 * acceleration * accelSteps);
  }

  // Acceleration phase
  for (int i = 1; i <= accelSteps; i++) {
    currentSpeed = sqrt(2 * acceleration * i);
    step(direction);
    delayMicroseconds(1000000 / currentSpeed);
  }

  // Constant speed phase
  for (int i = 0; i < constSteps; i++) {
    step(direction);
    delayMicroseconds(1000000 / maxSpeed);
  }

  // Deceleration phase
  for (int i = decelSteps; i > 0; i--) {
    currentSpeed = sqrt(2 * acceleration * i);
    step(direction);
    delayMicroseconds(1000000 / currentSpeed);
  }
}

Motor MaxCheckpoint: Motion Budget

You now know:

  • The worked Z-axis example needs 25 revolutions, or 80,000 microsteps, to move 200 mm with an 8 mm lead screw at 1/16 microstepping.
  • Its torque estimate uses the chapter’s 2 kg load, 40% screw efficiency, and 2x safety margin to reach 12.5 Ncm, below the standard NEMA 17 value of 40+ Ncm.
  • The 1,000 steps/s and 500 steps/s^2 profile gives 82 seconds for the 200 mm move, so travel time is part of the actuator evidence.

Sizing the move is not the finish line. The same current and speed choices create the common failure modes that follow.

7.6 Common Pitfalls

Pitfall: Undersized Current Limiting for Stepper Motors

The Mistake: Setting the stepper driver current limit to the motor’s rated current (e.g., 2.0A) without considering that stepper motors are rated for maximum holding torque at stall, not continuous operation.

Why It Happens: Datasheets list “rated current per phase” which represents the maximum the motor can handle when stationary with proper heat sinking.

The Fix: Start with 70-80% of rated current (e.g., 1.4-1.6A for a 2.0A motor) and increase only if torque is insufficient. Monitor motor temperature after 30 minutes of continuous operation - the case should not exceed 70-80C.

Pitfall: Using Open-Loop Control for Precision Applications

The Mistake: Assuming a stepper motor will always reach the commanded position without feedback, then discovering position errors accumulate over time.

Why It Happens: Stepper motors are marketed as “precise” (1.8 deg/step), creating false confidence. In reality, missed steps from overloading, mechanical binding, or acceleration too fast cause cumulative drift.

The Fix: For precision applications, add encoder verification or use limit switches for homing/calibration routines.

7.7 Interactive Lab: Stepper Precision

Challenges:

  1. Make the stepper rotate exactly 90 degrees
  2. Implement a clock with the second hand driven by the stepper
  3. Add buttons for forward/reverse step control

Motor MaxCheckpoint: Reliability Evidence

You now know:

  • Current limiting is not a one-time datasheet copy: the chapter recommends starting around 70-80% of rated current and checking motor temperature after 30 minutes.
  • Precision failures accumulate because the controller can miss steps without knowing it unless homing, limit switches, or encoder evidence reset the count.
  • The lab turns the rule into proof: 100-300 RPM should be smooth, 600+ RPM raises stall risk, and an instant 1000 RPM start can fail without acceleration.

7.8 Knowledge Check

7.9 Deep Dive: Step Counts, Torque Margin, and Missed Steps

A stepper motor rotates in fixed, discrete steps rather than spinning freely. Energize its coils in the right sequence and the rotor snaps to the next aligned position; do it repeatedly and the shaft advances one precise increment per pulse. A common motor has a 1.8-degree step angle, which is exactly 200 steps per revolution.

A stepper motor advances by energizing coils in sequence so the rotor aligns with each magnetic position. The figure connects the rotor and stator coil structure, four full-step positions, STEP/DIR driver interface, bipolar and unipolar motor types, and typical precision applications such as 3D printers, CNC machines, camera sliders, and telescope mounts.
Figure 7.1: Stepper motors turn counted electrical pulses into fixed angular steps; the driver translates MCU step and direction signals into the coil sequence that moves the rotor.

That counted motion is why steppers are useful for open-loop positioning. If a controller commands 400 steps on a 200-step motor, the shaft should move 400 / 200 = 2 revolutions. On a 2 mm-pitch lead screw, that becomes 2 rev x 2 mm/rev = 4 mm of carriage travel. The calculation is simple, but it is only true while the motor has enough torque margin to follow every commanded step.

Microstepping makes the command grid finer. At 1/16 microstepping, a 200-step motor has 200 x 16 = 3200 commanded microsteps per revolution. On the same 2 mm lead screw, one microstep is 2 mm / 3200 = 0.000625 mm, or 0.625 micrometers. That is a command increment, not a guaranteed accuracy claim: friction, backlash, load torque, and driver current ripple can keep the rotor from landing perfectly on every microstep.

Because there is no built-in position measurement, every assumption depends on torque margin. If an axis is told to move 10,000 microsteps and it misses 80 during a fast acceleration, the controller still believes the target was reached. On a 2 mm lead screw at 3200 microsteps/rev, those 80 missed microsteps equal 80 x 0.000625 mm = 0.05 mm of position error. That is enough to shift a 3D printer layer or blur a camera slider move.

Mode How coils are driven Effect
Full step Full current in the active phase or phases Maximum torque, coarsest motion
Half step Alternate one-phase-on and two-phase-on states Double the resolution, slight torque ripple
Microstepping Sinusoidally graded current across both phases Smoother motion and finer command increments

Two torque terms matter. Holding torque is how hard an energized stepper resists being turned off its commanded position; it clamps the load in place with no motion, which a basic DC motor cannot do by itself. Detent torque is the small residual holding you feel when the motor is unpowered, from the permanent-magnet rotor. Microstepping gives smooth, fine motion, but the incremental torque per microstep is small, so microsteps improve smoothness and command resolution far more than they improve absolute positioning accuracy.

Sizing starts from travel. Suppose a dosing pump needs to move a plunger 18 mm using a 1.5 mm-pitch screw. The screw needs 18 / 1.5 = 12 revolutions. With a 200-step motor at 1/8 microstepping, each revolution is 200 x 8 = 1600 microsteps, so the move is 12 x 1600 = 19200 step pulses. If the controller can issue 4800 pulses/s after ramp-up, the constant-speed portion alone takes about 19200 / 4800 = 4 s. Acceleration and deceleration add time, so a real profile may be closer to 5 s.

Current and heat set another boundary. If the phase current limit is 1.2 A and the winding resistance is 2.4 ohm, copper heating in one energized phase is I^2R = 1.2^2 x 2.4 = 3.46 W. With two phases active, the motor can dissipate roughly twice that, so thermal rise is a design constraint even while the shaft is stationary. Reducing hold current after a move can save heat, but only if the load cannot back-drive the axis.

Torque drops as speed rises, which is why steppers need acceleration ramps. A phase winding is inductive, so at higher step rates there is less time for current to reach the requested value. If a phase has L = 4 mH and R = 2 ohm, its electrical time constant is L / R = 0.004 / 2 = 0.002 s, or 2 ms. At 200 steps/s, one step interval is 5 ms, or 2.5 time constants. At 2000 steps/s, one step interval is 0.5 ms, only 0.25 time constants, so the phase current has much less time to build.

Good drivers handle this with current chopping: they apply a higher supply voltage briefly, sense winding current, then switch the output rapidly to hold the requested current limit. A motor might have 2 ohm windings and a 1 A current rating, implying only 1 A x 2 ohm = 2 V at DC. The driver may still use a 12 V or 24 V supply because it uses the higher voltage to make current rise quickly, then chops to avoid exceeding the current limit. This is why current limit, supply voltage, motor inductance, and acceleration profile are connected design variables.

The practical recipe is to choose a chopper driver that can enforce the motor’s rated current, use a supply voltage compatible with the driver and insulation limits, set an acceleration ramp inside the torque-speed curve, and add homing or feedback if silent position loss is unacceptable. If a machine loses position only during fast moves, reduce acceleration, lower top speed, raise current within thermal limits, reduce mechanical friction, or choose a motor and driver combination with more high-speed torque.

7.10 Summary

Stepper motors trade feedback simplicity for careful motion planning. They move in known increments, but reliable positioning depends on current limiting, acceleration ramps, torque margin, and homing or encoder feedback when missed steps cannot be tolerated.

Key Takeaway

Stepper motors provide precise, repeatable positioning through discrete steps without requiring feedback sensors (open-loop control). The key to reliable operation is proper acceleration profiles to prevent missed steps, appropriate current limiting to prevent overheating, and selecting the right driver (ULN2003 for small steppers, A4988/DRV8825 for NEMA 17). For applications where accumulated position error is unacceptable, add encoder feedback or implement periodic homing routines with limit switches.

“I’m the most precise mover on the team!” announced Stepper Stella proudly. “Watch me take exactly 200 steps to go all the way around – tick, tick, tick, tick…”

“Why do you move in little ticks instead of spinning smoothly like DC Danny?” asked Lila the LED.

“Because each tick is exactly 1.8 degrees!” Stella explained. “If Max tells me to take 50 steps, I’ve turned exactly 90 degrees. No guessing, no feedback needed – I just count my steps!”

“That’s how 3D printers work!” said Sammy the Sensor excitedly. “They use stepper motors just like Stella to move the print head left, right, forward, and backward by exact amounts, building objects layer by layer!”

“But I have a weakness,” Stella admitted. “If something pushes against me too hard while I’m stepping, I can miss a step. And since I don’t have a sensor inside me like Servo Sam does, I won’t even know I’ve made a mistake! My count will be off from then on.”

“That’s why you need to start slowly,” Max the Microcontroller advised. “If I try to make Stella go from zero to super-fast instantly, her little rotor can’t keep up with the magnets switching, and she’ll stumble and lose her place.”

“It’s like running,” Bella the Battery added. “You can’t sprint from a standstill – you have to accelerate gradually. Stella does the same thing: start slow, speed up, then slow down again before stopping. We call it a trapezoidal speed profile!”

“And I do use a lot of energy even when standing still,” Stella confessed. “I need current through my coils to hold my position. So for battery projects, think carefully about whether you need me or Servo Sam!”

Concept Relationships: Stepper Motors in the IoT Ecosystem
Concept Relationship Why It Matters
PID Control Steppers provide position; PID controls process variables Stepper moves valve to exact position; PID determines target position based on temperature sensor feedback
Duty Cycle (PWM) Microstepping uses PWM-like current control Variable current ratios between coils create intermediate positions for smoother motion
DC Motors Trade precision for simplicity DC: fast rotation, no position tracking. Stepper: precise position, slower speed
Servo Motors Trade open-loop for closed-loop Servo: built-in encoder, self-correcting. Stepper: no feedback, cumulative error risk
Motor Drivers ULN2003, A4988 translate logic to power Microcontroller sends step pulses; driver handles high-current coil switching

Cross-Module Connections:

7.11 See Also

Related Actuator Topics:

  • Servo Motors - Closed-loop alternative with position feedback
  • DC Motors - Continuous rotation without position control
  • Motor Drivers and Control - Driver IC theory and application

Control Systems:

  • PID Control Fundamentals - Combining steppers with feedback control
  • Actuator Control Strategies - Open-loop vs closed-loop design patterns

Practical Implementation:

  • Arduino Motor Control - Complete code examples for ESP32/Arduino
  • 3D Printing Applications - Stepper-based motion systems

Time: 30 minutes | Difficulty: Intermediate | Hardware: 28BYJ-48 + ULN2003, ESP32, 5V power supply

Objective: Measure how stepper torque decreases as speed increases, and discover the “don’t start too fast” rule through hands-on experimentation.

What You’ll Need:

  • 28BYJ-48 stepper motor + ULN2003 driver board
  • ESP32 or Arduino
  • 5V 1A power supply
  • Small object to attach to motor shaft (paper disc with tape)

Procedure:

  1. Baseline Torque Test at 100 RPM:
    • Load the provided code, set speed = 100 (RPM)
    • Attach a paper disc to the shaft with a small weight (coin) taped at the edge
    • Start motor and observe smooth rotation
  2. Increase Speed to 500 RPM:
    • Change speed = 500
    • Motor should still rotate, but feel slightly weaker when you gently resist the shaft
  3. Increase Speed to 1000 RPM:
    • Change speed = 1000
    • Motor may vibrate, make noise, or stall completely
    • Why? At high speed, the rotor can’t keep up with the magnetic field switching – missed steps occur
  4. Test Instant Start at 1000 RPM:
    • Set speed to 1000 RPM but remove the setAcceleration() line
    • Motor will likely buzz but not rotate (stalled at startup)
    • Why? No acceleration means trying to go from 0 to full speed instantly – rotor has too much inertia
  5. Add Acceleration Profile:
    • Restore stepper.setAcceleration(500)
    • Motor now successfully ramps up to 1000 RPM
    • Why? Gradual acceleration lets the rotor keep pace with the field

What to Observe:

  • At low speeds (100-300 RPM), torque is high and smooth
  • At medium speeds (300-600 RPM), slight vibration and reduced torque
  • At high speeds (600+ RPM), significant torque loss and risk of stalling
  • Without acceleration, high-speed starts always fail

Hint: For maximum torque, keep speeds under 300 RPM for 28BYJ-48. For faster rotation, use NEMA 17 with higher current capacity.

Solution Code:

#include <AccelStepper.h>

#define MOTOR_PIN1 19
#define MOTOR_PIN2 18
#define MOTOR_PIN3 5
#define MOTOR_PIN4 17

AccelStepper stepper(AccelStepper::HALF4WIRE,
                     MOTOR_PIN1, MOTOR_PIN3, MOTOR_PIN2, MOTOR_PIN4);

const int STEPS_PER_REV = 2048;

void setup() {
  Serial.begin(115200);

  int speed_rpm = 100; // Change this: try 100, 300, 500, 1000
  int steps_per_sec = (speed_rpm * STEPS_PER_REV) / 60;

  stepper.setMaxSpeed(steps_per_sec);
  stepper.setAcceleration(500); // Try commenting this out for instant-start test

  Serial.print("Speed: ");
  Serial.print(speed_rpm);
  Serial.println(" RPM");
}

void loop() {
  stepper.moveTo(STEPS_PER_REV * 10); // Rotate 10 full revolutions
  while (stepper.distanceToGo() != 0) {
    stepper.run();
  }
  delay(2000);
  stepper.moveTo(0); // Return to start
  while (stepper.distanceToGo() != 0) {
    stepper.run();
  }
  delay(2000);
}

Extension Challenge: Add a tachometer (hall effect sensor + magnet on shaft) to measure actual RPM and compare to commanded RPM – discover at what speed missed steps begin!

7.12 What’s Next?

Now that you can control stepper motors with acceleration profiles and microstepping, explore these related topics to deepen your actuator and control systems knowledge.

Chapter Description
Relays and Solenoids On/off switching actuators for high-power loads and electromagnetic linear motion
Servo Motors Closed-loop alternative with built-in position feedback for angular control
DC Motors Continuous rotation motors with speed control via PWM
PWM Control Pulse-width modulation techniques used in microstepping current control
PID Control Fundamentals Combining stepper positioning with closed-loop feedback control
Actuator Safety Thermal management, current limiting, and fail-safe design for motor systems