Electric Machines
Stepper Motor Microstepping
How sine and cosine currents through two phase windings interpolate the rotor between its detents — and why 3D printers fell silent the year the TMC2208 shipped.
Microstepping drives the two phases of a hybrid stepper with a sine-cosine current pair, interpolating the rotor between full-step detents. A 1.8° stepper × 16 microsteps = 0.1125° per step; 256× pushes it to 0.00703°. Smoothness matters more than resolution: sinusoidal currents kill torque ripple, mid-band resonance, and the whine that defined hobby CNC for two decades.
- Full step1.8° (200 steps/rev)
- 1/16 microstep0.1125° per step
- 1/256 microstep0.00703° per step
- Drive lawI_A=I·cos θ, I_B=I·sin θ
- Common driversA4988, DRV8825, TMC2209
- Workhorse use3D printers, CNC, plotters
Interactive visualization
Press play, or step through manually. The visualization is yours to drive — try it before reading on.
Watch the 60-second explainer
A condensed visual walkthrough — narrated, captioned, under a minute.
What microstepping actually does
A two-phase hybrid stepper has two field-winding axes physically offset by 90 electrical degrees. The rotor — a permanent magnet with toothed pole pieces — aligns to whichever direction the net stator field points. In the simplest full-step mode the driver energises one phase fully (say, I_A = +I_peak, I_B = 0) and the rotor lands on the corresponding full-step detent. Energise the other phase next (I_A = 0, I_B = +I_peak) and the rotor jumps 1.8 degrees — one full step on a standard 200-step-per-revolution stepper.
Microstepping replaces those two binary on-states with a continuum. Instead of asking the rotor to teleport between detents, you ask the stator field vector to rotate smoothly: drive I_A = I_peak · cos(θ) and I_B = I_peak · sin(θ), and the field vector points at angle θ with constant magnitude. The rotor follows θ. By choosing θ values between the full-step landings (0°, 90°, 180°, 270° electrical) you place the rotor between the natural detents — at half-steps, quarter-steps, sixteenth-steps, all the way down to 256ths.
// Microstep generator (8-bit lookup, 256 microsteps per electrical cycle)
uint8_t step; // 0 .. 255, increments on each microstep
int16_t I_A = sin_table[step]; // signed amplitude, ±I_peak
int16_t I_B = sin_table[(step + 64) & 0xFF]; // 90° phase shift = cos
// Drive H-bridge A toward I_A target via current chopping
// Drive H-bridge B toward I_B target via current chopping
// Rotor follows the rotating stator field at constant magnitude.
The microstep arithmetic
A 1.8° hybrid stepper has 200 full steps per revolution. Each full step corresponds to 90 electrical degrees on a four-pole magnetic structure — so a full electrical cycle is four full mechanical steps, or 7.2 mechanical degrees. Microstepping divides each full step into N microsteps:
Full step: 1.8° 200 steps/rev
1/2 microstep: 0.9° 400 steps/rev
1/4 microstep: 0.45° 800 steps/rev
1/8 microstep: 0.225° 1600 steps/rev
1/16 microstep: 0.1125° 3200 steps/rev
1/32 microstep: 0.05625° 6400 steps/rev
1/64 microstep: 0.028125° 12,800 steps/rev
1/256 microstep: 0.00703° 51,200 steps/rev
The 0.1125° per step at 1/16 is what dominates 3D printers and small CNCs. With a 200-step belt drive on a 16-tooth pulley and 2 mm GT2 belt pitch, one microstep at 1/16 corresponds to 32 mm of belt travel ÷ 3200 microsteps = 0.01 mm of linear motion. Well below the layer height of a typical FDM print.
Why smoothness matters more than resolution
The deceptive thing about microstepping is that the nominal positioning resolution of 1/256 mode (0.007° per microstep) is far below what the rotor can actually hold under load. A typical hybrid stepper has roughly 1-2 N·cm of detent torque and several N·cm of static holding torque — meaning that any external load will pull the rotor away from its commanded microstep angle by a fraction of a degree before generating enough restoring torque to balance the load. Below about 1/16 mode the rotor's stiffness curve smooths over the discrete microstep boundaries entirely.
What the higher microstep counts buy is motion smoothness. Square-wave phase currents at full step pulse the stator field by 90 electrical degrees at each commutation, exciting any resonance in the rotor + load + frame mechanical system. The rotor oscillates around the new detent for several milliseconds before settling. Sinusoidal currents rotate the field continuously, so there is no impulse to excite. The rotor accelerates and decelerates instead of jumping. This is the entire reason TMC drivers — which interpolate to 256 microsteps internally even when the host commands 16 — earned the "silent driver" reputation that flipped the 3D printer market between 2018 and 2020.
Current chopping — how the driver actually delivers a sinusoid
A stepper-winding has inductance — typically 1 to 10 mH per phase — that resists rapid current change. To drive a clean sinusoid at, say, 1 kHz of microstep rate, the driver needs current to slew much faster than the underlying inductive time constant. The standard solution is current chopping: apply the full supply voltage (24-48 V is typical) across the winding, monitor the rising current with a sense resistor, and switch the H-bridge off the instant the current crosses the commanded reference value.
// Pseudocode for one channel of a stepper driver chopper
loop:
on_phase_a(); // H-bridge applies +Vsupply
while (I_sense < I_ref_microstep) wait;
off_phase_a(); // freewheel through diodes / synchronous FETs
wait(t_off); // fixed-frequency or constant-off-time scheme
goto loop;
The result is a current waveform that tracks the commanded sinusoid with a small triangular ripple superimposed at the chopper frequency (20-100 kHz, well above audible). The same hardware that drives 1/256 microstepping smoothly also handles 1/4 and 1/8 — the difference is purely in how finely the reference sinusoid is sampled.
Driver ICs — the four chips inside almost every printer
| Driver IC | Max microstep | I_peak | V_max | Notable feature | Typical use |
|---|---|---|---|---|---|
| Allegro A4988 | 1/16 | 2 A | 35 V | Original hobby standard, audible | Legacy RepRap, low-cost CNC |
| TI DRV8825 | 1/32 | 2.5 A | 45 V | Higher voltage than A4988, similar noise | Mid-range 3D printers |
| Trinamic TMC2208 | 1/16 (256 internal) | 1.7 A | 36 V | StealthChop2 silent operation | Modern consumer 3D printers |
| Trinamic TMC2209 | 1/16 (256 internal) | 2.8 A | 29 V | StallGuard sensorless homing | Prusa MK4, Voron, Bambu X1 |
| Trinamic TMC5160 | 1/256 | 20 A (external FETs) | 60 V | SPI bus, full programmable | Industrial CNC, lab automation |
| Trinamic TMC2240 | 1/256 | 3 A | 36 V | UART, integrated sense-less | Premium 3D printers, robotics |
Worked example — a 3D printer X axis at 1/16 microstepping
A typical CoreXY 3D printer (Voron 2.4 era) uses a NEMA 17 stepper (1.8°/step), a 20-tooth GT2 pulley (2 mm pitch, so 40 mm of belt travel per pulley revolution), and a TMC2209 driver in 1/16 microstep mode.
stepper: 200 full steps per rev × 16 microsteps = 3200 microsteps/rev
pulley: 40 mm per revolution
linear: 40 / 3200 = 0.0125 mm per microstep = 12.5 microns
target travel: 1 mm → 1 / 0.0125 = 80 microsteps
max feed: 300 mm/s → 300 / 0.0125 = 24,000 microsteps/s = 24 kHz step rate
step_pin = HIGH; delayMicroseconds(20);
step_pin = LOW; delayMicroseconds(20); // 25 kHz square wave
At 300 mm/s the step pin is being toggled at 24 kHz — well within microcontroller comfort, and the TMC2209 silently interpolates each commanded microstep into 16 internal substeps for additional smoothness, putting the effective step rate at 384 kHz inside the chopper.
Closed-loop steppers — covering the step-loss failure mode
Microstepping is open-loop: the driver assumes the rotor obediently followed every commanded microstep. Apply enough load torque to exceed the holding torque and the rotor slips by one full electrical cycle (four full steps, or 7.2 mechanical degrees) into the next stable attractor; the driver has no idea this happened. The commanded position keeps incrementing while the actual rotor is now four steps behind. Cumulative step loss is how a botched 3D print ends up with a layer shift after 6 hours.
The closed-loop stepper retrofit clips a magnetic encoder to the rear shaft, reads the rotor angle, and either issues a fault when the position error exceeds a threshold (cheap, Trinamic StallGuard does this with no encoder at all by measuring back-EMF on the un-energised phase) or runs a full position-velocity PI loop on top of the microstep generator (expensive, Mechaduino and ODrive do this). The hybrid pulls modest open-loop precision into closed-loop reliability without paying for a full brushless servo motor.
- StallGuard (Trinamic). The driver measures back-EMF on the un-energised phase during each chopper-off period and detects the load angle. Above a threshold it flags a stall — no encoder needed. Used for sensorless homing in modern 3D printers: instead of a limit switch, the printer drives the axis into the frame, detects the stall, and zeros there.
- Mechaduino / ODrive S1. A magnetic encoder bonded to the rear shaft feeds a 14-bit absolute angle into a Cortex-M4. The firmware runs a position-velocity-current cascade on top of microstepping. Step loss becomes recoverable: the rotor catches up after the load eases.
- Klipper closed-loop drivers. Klipper firmware can monitor a TMC2209 StallGuard signal during the homing phase only, then run open-loop afterwards. Cheap, common in Voron and similar DIY printer builds.
Stepper microstepping vs brushless servo — when to switch
| Criterion | Microstepped stepper | Brushless servo (FOC) |
|---|---|---|
| Cost (motor + driver) | $15-50 total | $150-500+ total |
| Open-loop precision | 0.1125° / 0.0125 mm typical | Encoder-limited, 0.0003° for 17-bit |
| Holding torque at rest | High, ~30-50 N·cm with full current | Zero without active current |
| Heat at standstill | Constant — winding stays energised | Zero — only when moving |
| Step loss under overload | Silent, cumulative, common failure | Cannot lose position — encoder catches it |
| Top speed | ~1000 rpm useful (torque collapses above) | 3000-18,000 rpm typical |
| Best fit | 3D printers, hobby CNC, plotters, lab dispensers | Industrial robots, EV traction, gimbals |
Common failure modes and pitfalls
- Mid-band resonance. Driving the stepper at a step rate that matches the rotor + load mechanical resonance (often 50-300 Hz at full step) causes the rotor to oscillate and lose steps. Fix: use 1/16 or 1/32 microstepping to push the dominant excitation frequency well above the resonance band, or add mechanical damping (rubber motor mounts, sand-filled gantry).
- Insufficient supply voltage. The maximum sinusoidal current slew rate is V_supply / L_winding. A 12 V supply into a 4 mH winding tops out at 3 A/ms slew — fine at low microstep rates but flattens the sinusoid into a triangle at high RPMs. 24 V or 48 V supplies preserve the sinusoidal shape and keep torque at speed.
- Driver thermal shutdown. The H-bridge dissipates I² · R_DS(on) plus switching losses. At 2 A continuous through 100 mΩ that's 400 mW per phase per channel, 1.6 W total — enough to overheat a bare-package A4988 without a heatsink. Trinamic drivers cut conduction loss with synchronous rectification but still need airflow over 1.5 A.
- Microstep DAC nonlinearity. Cheap drivers with poor current-DAC linearity produce visibly non-uniform microsteps even at 1/16 — the rotor moves in slightly unequal increments, manifesting as a low-frequency print artifact. TMC drivers' internal 256-position interpolation and SPI-trim current setting solve this; an A4988 hand-trim potentiometer with 5% DAC error does not.
- Phase wiring swap. Swap one phase's two wires and the rotor reverses direction; swap both phases' wiring and the rotor refuses to start, vibrating in place. Bipolar steppers have four wires (two per phase); five-wire and six-wire variants are unipolar and need conversion to bipolar for microstepping use.
- Belt stretch and backlash masking microstep precision. A 1 m GT2 belt under 30 N tension stretches by ~0.05 mm per Newton change in load — well above the 0.0125 mm-per-microstep resolution of a 1/16 microstepped axis. Position accuracy at the tool tip is dominated by mechanical compliance, not stepper resolution.
A short history — from full step to silent driver
Stepper motors arrived in the 1950s for slow, precise positioning of paper tape, plotter pens, and disk drive heads. Full-step open-loop drive was the only option until the 1980s when bipolar chopper drivers — built around discrete BJT pairs and op-amp current references — made half-stepping the default. The first commercial 16-microstep drivers appeared in industrial CNC by the late 1980s; hobby 3D printing inherited that as the A4988-class single-chip driver in the late 2000s.
The next jump was Trinamic. Founded in Hamburg in 1996, the company shipped its first StealthChop driver in 2014 with a fundamentally different approach: instead of constant-current chopping with audible 30-40 kHz ripple, the driver synthesises a clean continuous sinusoid and switches at frequencies above audibility. Combined with 256-position internal interpolation, the result was a stepper driver that was literally inaudible at any reasonable load. The TMC2208 hit consumer 3D printers in 2018; by 2020 it had displaced A4988-class drivers across the entire mid-range market, taking 3D printer noise from "screaming bee" to "ambient room noise."
Frequently asked questions
What is microstepping?
Microstepping commands a stepper motor to positions between its natural full-step detents by driving the two phase windings with a sine-cosine current pair rather than on/off square waves. A standard 1.8° (200 step/rev) hybrid stepper at 1/16 microstepping has 3200 steps per revolution at 0.1125° per microstep; 1/256 mode reaches 51,200 steps and 0.00703° per microstep.
Why use sine and cosine for phase currents?
A two-phase hybrid stepper has phase windings physically offset by 90 electrical degrees. Driving IA = Ipeak·cos(θ) and IB = Ipeak·sin(θ) makes the stator field vector rotate continuously at constant magnitude. The rotor follows that angle. Square-wave currents jump the field by 90° at each step, exciting torque ripple and mid-band resonance; sinusoidal currents rotate it smoothly.
Does 1/256 microstepping really give 256× more positioning resolution?
Not for static positioning. The rotor's holding-torque-vs-angle stiffness pulls the rotor off the nominal microstep angle by a fraction of a degree under any external load, masking the last several bits of nominal resolution. The real benefit of 1/64 and 1/256 is motion smoothness — sinusoidal currents kill torque ripple and mid-band resonance, making the motor near-silent.
What is current chopping inside a microstepping driver?
Stepper winding inductance fights rapid current change. Current chopping applies the full supply voltage (24-48 V) across the winding, monitors rising current on a sense resistor, and turns the H-bridge off when current hits the commanded sinusoid value. After a fixed off-time the bridge re-applies voltage. The result is a sinusoidal current envelope with small triangular ripple at the chopper frequency (20-100 kHz).
What is mid-band resonance and how does microstepping fix it?
A stepper + load forms a torsional spring-mass system with resonance typically at 50-300 Hz. Drive the stepper at full-step speeds matching this band and the rotor oscillates wildly, sometimes stalling. Microstepping shifts the same shaft speed to a 16× higher step rate, well above resonance, and the sinusoidal currents do not pulse-excite the spring-mass system even when passing through that band.
Which matters more — number of microsteps or current accuracy?
Current accuracy. A driver with poor current-DAC linearity produces visibly non-uniform rotor motion regardless of microstep count. Trinamic's TMC family invest in 256-position internal interpolation even when the host commands only 16 microsteps, smoothing the current ramp between input steps — this is the algorithmic origin of their "silent driver" reputation.
Can a microstepped stepper lose steps under load?
Yes. The rotor slips by one full electrical cycle (four full steps, 7.2 mechanical degrees) into the next stable attractor when load torque exceeds holding torque. The driver has no idea — commanded position keeps incrementing while the rotor is four steps behind. Workarounds: oversize the motor, slow the acceleration profile, add a rotor encoder for closed-loop step-loss detection (StallGuard, Mechaduino).
Why are 3D printers and CNC routers built on steppers instead of servos?
Cost. A NEMA 17 stepper plus a $6 A4988 driver replaces a brushless motor plus encoder plus closed-loop servo that would cost 10× as much. For light loads (3D printer gantry, plotter pen) the open-loop stepper hits 0.05-0.1 mm positioning easily — finer than belt stretch and leadscrew backlash. Heavy-load CNC mills with micron tolerances do move to servos; lighter machines stay on steppers.