A NEMA 17 is a stepper motor with a 42.3 mm (1.7 inch) square faceplate. It turns in exact steps, usually 1.8° per step (200 steps per revolution), with no encoder needed, which is why it sits in almost every desktop 3D printer, small CNC router, plotter and pick-and-place machine. Most are bipolar: two coils, four wires. The name describes the frame, not the performance: two NEMA 17 motors can differ widely in torque, current and length, so the numbers on your motor's label matter more than the name.
You cannot connect one directly to an Arduino or ESP32. Each coil needs roughly 1 to 2 A, a GPIO gives tens of milliamps, so the motor needs a stepper driver (A4988, DRV8825 or TMC2209) and its own 12 to 24 V supply. The driver turns two cheap signals, STEP and DIR, into the right current in the coils. This guide covers the specifications, how to pick the body length, how to wire and identify the coils, how to set the driver current (Vref) without burning anything, microstepping, why torque falls with speed, and the faults you will meet. When you are ready to build, the Arduino Uno guide and the ESP32 guide take you from wiring to homing and speed control.
NEMA17 at a glance
NEMA 17 in ten seconds. Pick a 40 mm body for light 3D printer and CNC axes, 48 to 60 mm for heavy axes or more speed. Set the driver to 70 to 80 % of the motor's rated current: Vref = I × 8 × Rs on an A4988, I × 5 × Rs on a DRV8825. Use 24 V if you want real speed. Join all grounds, put a 100 µF capacitor across VMOT and GND, and never plug or unplug the motor while powered.
Specifications
| Parameter | Typical value |
|---|---|
| Frame size | 42.3 mm (1.7 in) square |
| Step angle | 1.8° (200 steps per revolution) |
| Winding | 4-wire bipolar, two coils |
| Rated current | 1 to 2 A per coil (set by the model) |
| Mounting holes | 4 × M3, 31 mm apart |
| Centring boss | 22 mm diameter |
| Shaft | 5 mm diameter, often with a flat (D-shaft) |
| Holding torque | About 40 to 85 N·cm, depends on body length |
| Body length | About 34 to 63 mm (see the table below) |
| Step accuracy | ±5 % of a full step (±0.09°) per the PBC datasheet |
| Supply (via driver) | 12 to 24 V typical; up to 36 V with a suitable driver |
| Case temperature | Datasheets allow up to about 80 °C rise at rated current |
Frame dimensions are the NEMA standard. Current, torque and resistance depend on the exact motor: always read the label or datasheet of yours.
How a stepper motor works
Inside are two coils (A and B) around a toothed magnetic rotor. The driver energises the coils in a repeating pattern, and each change of pattern pulls the rotor one step round. 200 steps make one revolution, so a command to move 200 steps turns the shaft exactly once, with no feedback needed. That is called open loop: the controller counts steps but cannot see the shaft, so a skipped step goes unnoticed.
A bipolar motor has four wires, two per coil, and the driver reverses the current in each coil. A unipolar motor (five or six wires, such as the 28BYJ-48) has centre taps and is simpler to drive but weaker. NEMA 17 motors are almost always bipolar. The step rate sets the speed (RPM = steps per second × 60 ÷ steps per revolution) and the number of pulses sets the distance.
Choose the body length
A longer body holds more rotor and winding, so it makes more torque. The table compares four real motors from the PBC Linear and Handson Technology datasheets:
NEMA 17 motors compared
| Motor | Body length (max) | Holding torque | Rated current | Resistance | Inductance | Weight |
|---|---|---|---|---|---|---|
| PBC Linear single stack | 39.8 mm | 48 N·cm | 2 A | 1.04 Ω | 2.2 mH | 0.28 kg |
| PBC Linear double stack | 48.3 mm | 63 N·cm | 2 A | 1.3 Ω | 2.9 mH | 0.36 kg |
| PBC Linear triple stack | 62.8 mm | 83 N·cm | 2 A | 1.49 Ω | 3.8 mH | 0.6 kg |
| Handson 42BYGH60 | 60 mm | 80 N·cm | 1.5 A | 1.8 Ω | 7 mH | 0.56 kg |
Holding torque is the force the shaft resists with the coils powered and the motor standing still. It is good for comparing motors, but it is not the torque you get while turning (see below).
Inductance hints at speed. The 42BYGH60 has almost twice the inductance of the PBC triple stack at similar torque, so it loses torque sooner as speed rises. On a slow lead-screw axis that does not matter; on a fast belt axis it does. As a rule: 40 mm is plenty for 3D printer axes and light CNC work. Go to 48 or 60 mm when the axis carries real weight or needs headroom at speed.
Check the voltage per phase. The Handson motor is rated 1.5 A at 1.8 Ω, so 1.5 × 1.8 = 2.7 V per phase. Connected straight to 12 V, each coil would try to pull about 6.7 A. That is why a NEMA 17 always needs a current-regulating driver, which chops the supply on and off to hold each coil at the limit you set.
Wires and coil pairs
| Wire | Name | Description |
|---|---|---|
| 1 | A+ | Coil A, one end. Pair it with A− using the datasheet or a multimeter |
| 2 | A− | Coil A, other end |
| 3 | B+ | Coil B, one end |
| 4 | B− | Coil B, other end |
Wire colours are not standardised. Many motors use black / green for one coil and red / blue for the other, but not all do, and a connector's pin order often differs from the wire order. Do not guess. Find the pairs:
- Multimeter: set it to resistance (or continuity). Two wires of the same coil read a low resistance (about 1 to 3 Ω); wires from different coils read open.
- Shaft test (no meter): twist the bare ends of two wires together and turn the shaft by hand. If it becomes noticeably stiff and "notchy", those two wires are one coil.
Each coil pair goes to one pair of driver outputs (1A/1B for coil 1, 2A/2B for coil 2). Swapping the two wires of one coil reverses the direction. Crossing a wire from coil A with one from coil B makes the motor buzz and shake instead of turning.
Match the driver to the motor
Stepper drivers compared
A4988
- Max current (cooled)
- About 2 A (1 A without a heatsink)
- Motor supply
- 8 to 35 V
- Microsteps
- Up to 1/16
- Pick it when
- Cheapest, simplest, fine for first builds
DRV8825
- Max current (cooled)
- About 2.5 A (1.5 A without a heatsink)
- Motor supply
- 8.2 to 45 V
- Microsteps
- Up to 1/32
- Pick it when
- Higher voltage and finer microsteps; note it has no logic-supply pin
TMC2209
- Max current (cooled)
- 2 A RMS (2.8 A peak)
- Motor supply
- 4.75 to 29 V
- Microsteps
- Up to 1/256 interpolated
- Pick it when
- Quiet running (StealthChop), UART settings and stall detection
L298N / L293D
- Max current (cooled)
- Not recommended
- Motor supply
- —
- Microsteps
- None
- Pick it when
- They are DC-motor drivers. They waste power and cannot limit current properly for a NEMA 17
Limits from the Pololu A4988 and DRV8825 carrier pages and the Trinamic TMC2209 datasheet. Carrier boards vary, so check yours.
Set the current limit (Vref) before the first run
The rated current is per coil. The driver limits it with a small trimmer you adjust while measuring a voltage called Vref, between the trimmer's metal screw and GND:
- A4988: Vref = I × 8 × Rs
- DRV8825: Vref = I × 5 × Rs
I is the current you want in amps. Rs is the value of the two small sense resistors beside the chip: marking R100 is 0.1 Ω, R068 is 0.068 Ω, R050 is 0.05 Ω. Run at 70 to 80 % of the motor's rated current: the motor keeps plenty of torque and both motor and driver stay cooler.
Worked example. A 1.5 A motor at 80 % (1.2 A) on an A4988 with 0.1 Ω resistors needs Vref = 1.2 × 8 × 0.1 = 0.96 V. On a DRV8825 with the same resistors it is 1.2 × 5 × 0.1 = 0.6 V.
Vref cheat sheet
| Target current | A4988, Rs = 0.1 Ω | A4988, Rs = 0.068 Ω | DRV8825, Rs = 0.1 Ω |
|---|---|---|---|
| 1.0 A | 0.80 V | 0.54 V | 0.50 V |
| 1.2 A | 0.96 V | 0.65 V | 0.60 V |
| 1.5 A | 1.20 V | 0.82 V | 0.75 V |
Warning
Do not copy a Vref value from another tutorial. The right setting depends on your motor's rated current, your driver and its sense-resistor value. Measure Vref with the driver powered but the motor disconnected, adjust the trimmer slowly with a plastic screwdriver, and recheck after the motor warms up. Always switch everything off before connecting or disconnecting the motor: unplugging a running motor can destroy the driver.
TMC2209 note. Its Vref formula depends on the module (sense resistor and settings), so follow the documentation of your exact board. The wiring and the sketches in the board guides stay the same.
Microstepping
A driver can divide each full step into smaller steps. It gives smoother, quieter motion. Set it with the MS pins (tie each to GND for low or to the logic supply for high):
Microstep pins (A4988 and DRV8825)
| Resolution | A4988 MS1, MS2, MS3 | DRV8825 M0, M1, M2 | Steps per revolution |
|---|---|---|---|
| Full step | Low, Low, Low | Low, Low, Low | 200 |
| 1/2 | High, Low, Low | High, Low, Low | 400 |
| 1/4 | Low, High, Low | Low, High, Low | 800 |
| 1/8 | High, High, Low | High, High, Low | 1,600 |
| 1/16 | High, High, High | Low, Low, High | 3,200 |
| 1/32 | Not available | High, Low, High (M2 plus M0 or M1 high) | 6,400 |
Microstepping adds smoothness, not accuracy. The PBC datasheet lists a step accuracy of ±5 %, so each full step can land about 0.09° off, and microstepping does not remove that. Torque per microstep is also much smaller than at a full step, so a heavily microstepped motor is easier to push off position. For positioning, rely on full steps and add a home switch instead of trusting the step count forever.
Higher resolution needs a higher pulse rate. At 1/16, one revolution per second is 3,200 steps per second, and 300 RPM is 16,000 steps per second. The plain AccelStepper library on an Uno tops out around 4,000 steps per second, so for fast moves use a lower microstep setting or a faster controller.
Torque falls as speed rises
Each coil is an inductor, so current takes time to build in it. At low speed there is time at every step. As the step rate climbs, the current never quite reaches its target and torque drops. This is the most important thing to know when sizing a stepper. A higher supply voltage pushes current in faster, so more torque survives at speed: use 24 V for real speed and keep 12 V for slow axes.
From one motor's datasheet curve, the running torque at low speed is about 34 N·cm even though the same motor is rated 48 N·cm holding, so plan with the running curve, not the headline number. At 3,000 steps per second (900 RPM at full step) the 36 V curve still gave about 27 N·cm while the 12 V curve had fallen to about 9 N·cm.
Size the motor from the load. Torque = force × distance: T = F × d. A 1 kg load hanging from a pulley of 2 cm radius pulls with 9.81 N at 0.02 m, which is 0.196 N·m, or about 20 N·cm. A common rule of thumb is to pick a motor that still delivers about twice the load torque at the speed you need, so about 40 N·cm here, read from its own torque-speed curve and not the holding torque.
Unit conversions: 1 N·m = 100 N·cm = 10.2 kg·cm = 141.6 oz·in, so 80 N·cm is about 8.2 kg·cm.
Power supply and wiring habits
- Supply voltage. 12 V works for slow axes, 24 V for speed. A single NEMA 17 at 1.5 A runs comfortably from a 12 V or 24 V supply rated 2 A or more. Printers and CNCs with several motors, heaters and fans need much more.
- Capacitor. Put a 100 µF (or larger) electrolytic capacitor across VMOT and GND, close to the driver, rated above your supply voltage. It absorbs voltage spikes from the motor coils. Without it, the driver can be damaged or reset.
- Common ground. The board's GND, the driver's logic GND and the supply's negative must be joined.
- No hot-plugging. Connecting or disconnecting a motor while the driver is powered can destroy the driver.
- Cooling. Above about 1 A per coil add a heatsink and airflow to an A4988 or DRV8825. A motor case at 60 to 80 °C is normal at rated current, but lowering Vref is the first thing to try if it is too hot.
- Wire length. Keep motor cables short, twisted in pairs, and away from sensor wires.
NEMA 17 vs 28BYJ-48 vs servo
| NEMA 17 | 28BYJ-48 | Hobby servo | |
|---|---|---|---|
| Torque | About 40 to 85 N·cm | Very low, geared | Low to medium |
| Supply | 12 to 24 V plus a driver | 5 V, ULN2003 board | 5 to 6 V |
| Speed | High with 24 V | Slow (geared down) | Fast, limited angle |
| Position feedback | None (open loop) | None | Built in |
| Best for | 3D printers, CNC, plotters, linear axes | Cheap demos, dials, blinds | Angle control, robot joints |
See the 28BYJ-48 stepper for the small 5 V alternative. If you cannot afford to lose position, choose a closed-loop stepper (with an encoder) or a servo.
Troubleshooting
Motor buzzes or shakes but does not turn
- Likely cause
- Wires from different coils crossed, or the current limit is too low
- Fix
- Re-check the coil pairs with a multimeter; raise Vref slightly
Motor turns the wrong way
- Likely cause
- Direction wiring
- Fix
- Reverse the direction in code, or swap the two wires of one coil with power off
Motor stalls, skips steps or loses position
- Likely cause
- Torque falling with speed, or too sharp an acceleration
- Fix
- Raise the supply voltage, lower the top speed, use acceleration ramps (AccelStepper)
Motor does nothing, no hold torque
- Likely cause
- ENABLE pin high or floating, or no motor supply
- Fix
- Pull ENABLE low (or leave it unconnected); check VMOT and GND
Motor runs only in one direction or jerks
- Likely cause
- A loose wire in one coil
- Fix
- Re-seat the connector; check each coil with a meter
Driver gets very hot or shuts off
- Likely cause
- Current limit too high, or no heatsink
- Fix
- Lower Vref, add a heatsink and airflow
Driver resets or behaves erratically
- Likely cause
- Supply sag or voltage spikes
- Fix
- Add a 100 µF capacitor across VMOT and GND; use a stronger supply
Motor case is very hot
- Likely cause
- Normal at rated current up to about 80 °C
- Fix
- Lower Vref if it is too hot for your enclosure
Noisy or whining motor
- Likely cause
- Low microstep setting or chopper noise
- Fix
- Use 1/16 microstepping, or a TMC2209 for quiet running
Wrong distance per command
- Likely cause
- Microstep setting does not match the steps per revolution in code
- Fix
- Match the MS pins and the code (200 × microsteps)
Project ideas
- 3D printer or plotter axis. One motor per axis on a belt or lead screw, with end-stop switches for homing.
- CNC engraver. Two or three NEMA 17 axes under GRBL on an Arduino Uno.
- Camera slider or turntable. A slow, smooth move, ideal for 1/16 microstepping and a sleeping driver.
- Linear actuator with a lead screw. 200 steps and an 8 mm lead give 0.04 mm per full step.
- Pick-and-place or pen plotter. Home with limit switches, then move to positions in millimetres.
- Automatic blinds or a valve. Slow moves, hold torque off to save power.
Start with the Arduino Uno sketches or the ESP32 sketches.
Frequently asked questions
Can I connect a NEMA 17 directly to an Arduino or ESP32? No. A GPIO pin supplies only tens of milliamps and the motor needs an amp or more per coil. Use a driver such as the A4988 or DRV8825, or a TMC2209 for quiet running.
How many steps per revolution? 200 full steps, or 3,200 at 1/16 microstepping.
How fast can it turn? It depends on supply voltage and load. On 12 V the torque has already dropped sharply by 300 RPM, while 24 to 36 V keeps useful torque well past 900 RPM.
Which driver should I buy? An A4988 or DRV8825 for a first build, a TMC2209 for a quiet printer or an indoor project. All three use the same STEP and DIR wiring.
How do I find the right Vref? Vref = I × 8 × Rs for an A4988 and I × 5 × Rs for a DRV8825, using about 70 to 80 % of the motor's rated current. Check the sense-resistor marking on your board.
Is the NEMA 17 name a guarantee of torque? No. NEMA 17 only describes the 42.3 mm square frame and mounting. Torque, current and resistance depend on the exact motor.
Does it know where it is? No. A standard NEMA 17 runs open loop, so a skipped step goes unnoticed. Use a home switch, or choose a closed-loop motor with an encoder.
Can I run it from 5 V? Not usefully. The driver's motor supply must be 8 V or more for an A4988 or DRV8825. A 5 V stepper like the 28BYJ-48 is the alternative.
Why does the motor get hot? Steppers draw full current even when holding still. A case temperature of 60 to 80 °C at rated current is normal; reduce Vref or disable the driver when idle to run cooler.
Can I use it for a servo-like job? For simple positioning with a home switch, yes. For fast loads with a risk of stalling, add an encoder or use a servo.
Datasheets and references
- PBC Linear NEMA 17 datasheets (single, double and triple stack) and the Handson Technology 42BYGH60 datasheet: the sources for the motor figures on this page.
- Pololu A4988 and DRV8825 carrier pages: current-limit formulas, pin tables and thermal limits.
- Trinamic TMC2209 datasheet: the supply range and current limits quoted above.
- AccelStepper library: the library used in the board guides.
- 28BYJ-48 stepper: the small 5 V alternative.
Ready to build? Each guide has full wiring and three sketches:
- NEMA 17 with Arduino Uno: back-and-forth moves, potentiometer speed control and homing to a limit switch
- NEMA 17 with ESP32: the same wiring on 3.3 V logic, Serial command control and smooth high-speed moves with FastAccelStepper
Wiring & code
Board integration
Library
AccelStepper by Mike McCauley
Arduino IDE > Tools > Manage Libraries > search "AccelStepper" > install "AccelStepper" by Mike McCauley
This guide drives a NEMA 17 from an ESP32 through an A4988 or DRV8825 driver. The ESP32's 3.3 V logic works with both. Three sketches build up from a basic move to Serial command control and smooth high-speed moves with FastAccelStepper, which uses the ESP32's hardware to generate pulses. For the motor, torque, microstepping and the Vref formula, read the NEMA 17 overview first.
What you need
1ESP32 DevKit (WROOM-32)
- Notes
- 3.3 V logic
1NEMA 17 stepper motor
- Notes
- Rated about 1 to 2 A per coil
1A4988 or DRV8825 driver module
- Notes
- Check the sense-resistor marking for the Vref formula
112 to 24 V DC power supply
- Notes
- 2 A or more; separate from the ESP32
1100 µF electrolytic capacitor
- Notes
- Across VMOT and GND at the driver
1Breadboard and jumper wires
Wiring (A4988)
| A4988 pin | ESP32 pin | Notes |
|---|---|---|
| STEP | GPIO25 | One pulse = one (micro)step |
| DIR | GPIO26 | Sets the direction |
| ENABLE | GPIO27 | Active LOW; optional |
| VDD | 3V3 | Logic supply (A4988 only; the DRV8825 has no VDD pin) |
| GND (logic) | GND | Common ground with the supply and the motor ground |
| RESET and SLEEP | Join them together | Tie RESET to SLEEP with a jumper wire |
| MS1, MS2, MS3 | 3V3 (all three) | Selects 1/16 microstepping. Leave all low for full steps |
| VMOT and GND (motor) | 12 to 24 V supply | Add the 100 µF capacitor across these pins. Never from the ESP32 |
| 1A, 1B, 2A, 2B | Motor coil leads | Coil 1 on 1A/1B, coil 2 on 2A/2B |
Warning
Set Vref before connecting the motor, and switch everything off before connecting or disconnecting it. The ESP32 pins are 3.3 V logic: the A4988 and DRV8825 read 3.3 V as HIGH, but confirm that your exact carrier does. Power the driver's VDD from 3.3 V so the ESP32 never sees 5 V on a pin. Never power the motor from the ESP32.
- 1Identify the coil pairs with a multimeter and mark them.
- 2Wire the driver as in the table, with the motor disconnected.
- 3Power the 12 to 24 V supply, and adjust the trimmer until Vref matches your calculated value.
- 4Power off, then connect the motor coils.
- 5In the Arduino IDE install the ESP32 board package, then in Tools > Manage Libraries install AccelStepper by Mike McCauley (and FastAccelStepper by gin66 for Sketch 3).
- 6Select your ESP32 board and port, upload Sketch 1, then power the motor supply.
Sketch 1 - Back and forth, one revolution each way
#include <AccelStepper.h>
const int STEP_PIN = 25;
const int DIR_PIN = 26;
const int ENABLE_PIN = 27;
const int MICROSTEPS = 16; // MS1-MS3 high on an A4988
const long STEPS_PER_REV = 200L * MICROSTEPS; // 3200
AccelStepper stepper(AccelStepper::DRIVER, STEP_PIN, DIR_PIN);
void setup() {
pinMode(ENABLE_PIN, OUTPUT);
digitalWrite(ENABLE_PIN, LOW); // LOW enables the driver outputs
stepper.setMaxSpeed(STEPS_PER_REV); // 1 revolution per second
stepper.setAcceleration(STEPS_PER_REV);
stepper.moveTo(STEPS_PER_REV);
}
void loop() {
if (stepper.distanceToGo() == 0) {
delay(500);
stepper.moveTo(-stepper.currentPosition());
}
stepper.run();
}Sketch 2 - Control from the Serial Monitor
Type commands in the Serial Monitor at 115200 baud (set it to Newline line ending): move 3200 moves 3,200 steps from where it is, to 0 goes to absolute position 0, speed 2000 sets the top speed in steps per second, stop decelerates to a halt, and pos prints the position.
#include <AccelStepper.h>
const int STEP_PIN = 25;
const int DIR_PIN = 26;
const int ENABLE_PIN = 27;
AccelStepper stepper(AccelStepper::DRIVER, STEP_PIN, DIR_PIN);
String line;
void handle(const String& cmd) {
if (cmd.startsWith("move ")) {
stepper.move(cmd.substring(5).toInt());
} else if (cmd.startsWith("to ")) {
stepper.moveTo(cmd.substring(3).toInt());
} else if (cmd.startsWith("speed ")) {
stepper.setMaxSpeed(cmd.substring(6).toFloat());
} else if (cmd == "stop") {
stepper.stop();
} else if (cmd == "pos") {
Serial.println(stepper.currentPosition());
} else if (cmd.length() > 0) {
Serial.println("Commands: move N, to N, speed N, stop, pos");
}
}
void setup() {
Serial.begin(115200);
pinMode(ENABLE_PIN, OUTPUT);
digitalWrite(ENABLE_PIN, LOW);
stepper.setMaxSpeed(2000);
stepper.setAcceleration(2000);
Serial.println("Ready. Commands: move N, to N, speed N, stop, pos");
}
void loop() {
while (Serial.available()) {
char c = Serial.read();
if (c == '\n' || c == '\r') { handle(line); line = ""; }
else line += c;
}
stepper.run();
}Sketch 3 - Fast, smooth moves with FastAccelStepper
AccelStepper times every pulse in software, which limits the rate and can jitter when Wi-Fi is busy. FastAccelStepper generates the pulses in ESP32 hardware, so it reaches much higher rates and keeps running while your code does other work. Whether the motor can follow is a torque question: at 12 V it will stall at high speed, so use 24 V for the faster moves.
#include <FastAccelStepper.h>
const int STEP_PIN = 25;
const int DIR_PIN = 26;
const int ENABLE_PIN = 27;
FastAccelStepperEngine engine = FastAccelStepperEngine();
FastAccelStepper *stepper = NULL;
void setup() {
Serial.begin(115200);
engine.init();
stepper = engine.stepperConnectToPin(STEP_PIN);
if (stepper) {
stepper->setDirectionPin(DIR_PIN);
stepper->setEnablePin(ENABLE_PIN); // active LOW by default
stepper->setAutoEnable(true); // driver off when idle
stepper->setSpeedInHz(8000); // 8000 steps/s = 150 RPM at 1/16
stepper->setAcceleration(20000);
}
}
void loop() {
stepper->move(3200 * 5); // five revolutions forward
while (stepper->isRunning()) delay(10);
delay(500);
stepper->move(-3200 * 5); // and back
while (stepper->isRunning()) delay(10);
delay(500);
}Tip
If the motor stalls or squeals, lower setSpeedInHz and setAcceleration first. Raise them in steps of about 20 % until it just starts to miss, then back off by 20 % for a safe margin. A 24 V supply raises that limit noticeably.
ESP32 notes
- Pins. GPIO25, 26 and 27 are safe general-purpose pins. Avoid the strapping pins (0, 2, 5, 12, 15) and the flash pins (6 to 11) for STEP and DIR. See the ESP32 pinout guide.
- Wi-Fi and timing. With AccelStepper, heavy Wi-Fi work can delay the loop and make the motor stutter. Keep the loop light, or use FastAccelStepper for hardware timing.
- Idle heat. Disable the driver (ENABLE high) when the motor does not need to hold position.
- Power budget. The ESP32 and the motor share only ground. Keep the motor supply separate to avoid resets.
ESP32-specific problems
Nothing moves
- Likely cause
- RESET and SLEEP not joined, no VMOT, or ENABLE high
- Fix
- Jumper RESET to SLEEP; check the motor supply; drive ENABLE low
Motor buzzes but does not turn
- Likely cause
- Coil wires crossed or Vref too low
- Fix
- Re-check the coil pairs; raise Vref slightly
Stutter when Wi-Fi is active
- Likely cause
- Software pulse timing delayed
- Fix
- Use FastAccelStepper, or keep the loop light
Driver does not respond to 3.3 V
- Likely cause
- Some carrier boards need more than 3.3 V on STEP or DIR
- Fix
- Check the carrier datasheet; try the same code with a level shifter
Motor stalls at high speed
- Likely cause
- Torque falls with speed
- Fix
- Raise the supply to 24 V, lower speed and acceleration
ESP32 resets when the motor starts
- Likely cause
- Supply sag or noise
- Fix
- Separate supplies, common ground, 100 µF at VMOT
Distance does not match the code
- Likely cause
- Microstep pins and constants differ
- Fix
- Match MS1 to MS3 with 200 × MICROSTEPS
Compile error for FastAccelStepper
- Likely cause
- Library not installed, or not an ESP32 board selected
- Fix
- Install it from the Library Manager and select an ESP32 board
ESP32 FAQ
Can an ESP32 drive an A4988 directly? Yes, through its STEP and DIR pins at 3.3 V. The ESP32 does not power the motor; the driver and its own supply do.
Why FastAccelStepper? It generates pulses with ESP32 hardware, so high speeds and Wi-Fi work together. AccelStepper is simpler and fine for modest speeds.
Can I control it over Wi-Fi? Yes: add a web server or MQTT handler that calls stepper.move() or moveTo(), and keep the handlers short. See the ESP32 MQTT guide.
Does it work with an ESP32-S3 or C3? Yes. Change the pins to ones your board supports.
Which driver is best with the ESP32? The A4988 and DRV8825 both work. The TMC2209 gives the quietest running.
Next: the NEMA 17 overview covers torque, the Vref formula and choosing a driver. For a simpler Arduino build see the Uno guide.
