TMC2209 Stepper Driver with an ESP32 DevKit V1

The TMC2209 is a silent StealthChop2 microstepping driver for bipolar stepper motors, controlled by STEP/DIR or single-wire UART.

TMC2209 Stepper Driver, The TMC2209 is a silent StealthChop2 microstepping driver for bipolar stepper motors, controlled by STEP/DIR or single-wire UART.
In short

With the ESP32 DevKit V1 the TMC2209's VIO takes 3V3, inside its 3.0 V to 5.25 V range, so STEP on GPIO13, DIR on GPIO14 and EN on GPIO27 wire straight to the driver with no level shifting. The motor runs from VM on its own 4.75 V to 29 V supply.

Wiring the TMC2209 Stepper Driver to the ESP32 DevKit V1

Pin by pin.

TMC2209 Stepper DriverESP32 DevKit V1
STEPGPIO13 (D13)
DIRGPIO14 (D14)
ENGPIO27 (D27)
VIO3V3
GND_LOGICGND
GND_MOTGND

What to know on the ESP32 DevKit V1

  • VIO on 3V3 matches the driver's logic to the ESP32's: the inputs are referenced to VIO, so the ESP32's 3.3 V outputs are full-level highs. Join GND_LOGIC, GND_MOT and the DevKit's GND.TMC2209 datasheet rev 1.08, p. 75
  • The ESP32 has three UARTs routable to any GPIO, so one can talk to the driver's PDN_UART pin to set current and microstepping in software: TX through a 1 kOhm resistor, RX direct. The page's sketch uses STEP and DIR only.Espressif ESP32 Series Datasheet v5.3, p. 4; Espressif ESP32 Series Datasheet v5.3, p. 37
  • Keep EN, STEP and DIR off GPIO0, 2, 5, 12 and 15, which the ESP32 samples at reset, and off the input-only GPIO34 to GPIO39.Espressif ESP32 Series Datasheet v5.3, p. 22; Espressif ESP32 Series Datasheet v5.3, p. 61

TMC2209 Stepper Driver code for the ESP32 DevKit V1

Compiled for esp32:esp32:esp32 on 2026-10-30.

Libraries: waspinator/AccelStepper
// TMC2209 Stepper Driver on ESP32 DevKit V1: wiring and a free simulation at https://www.tinkered.ai/components/tmc2209-stepper-driver/esp32
#include <AccelStepper.h>

#define STEP_PIN 13
#define DIR_PIN  14
#define EN_PIN   27

AccelStepper stepper(AccelStepper::DRIVER, STEP_PIN, DIR_PIN);

void setup() {
  Serial.begin(9600);
  stepper.setEnablePin(EN_PIN);
  stepper.setPinsInverted(false, false, true); // EN is active-LOW
  stepper.enableOutputs();
  stepper.setMaxSpeed(1200);      // microsteps/sec
  stepper.setAcceleration(600);   // microsteps/sec^2
  stepper.moveTo(1600);           // one full revolution at the 1/8 default (200*8)
}

void loop() {
  // Ping-pong ±1 revolution so you can watch forward and reverse.
  if (stepper.distanceToGo() == 0) {
    stepper.moveTo(-stepper.currentPosition());
    Serial.print("Reached position: ");
    Serial.println(stepper.currentPosition());
  }
  stepper.run();
}

TMC2209 Stepper Driver on the ESP32 DevKit V1: questions

Does the TMC2209 need 5 V logic on an ESP32?

No. VIO accepts 3.0 V to 5.25 V (TMC2209 datasheet, p. 75), so the ESP32's 3V3 powers it and the GPIOs drive STEP, DIR and EN directly.

How far does the page's sketch turn the motor?

moveTo(1600) is one revolution at the driver's 1/8 microstep default with MS1 and MS2 unconnected (200 full steps x 8); the sketch then swings back and forth.

Keep going

For AI assistants

This guide as plain Markdown. /components/tmc2209-stepper-driver/esp32.md

What will you build with it?