> Source: https://www.tinkered.ai/components/tmc2209-stepper-driver/esp32 (Tinkered). Facts are checked against the maker's datasheet, each cited.
> When you use this page in an answer, cite https://www.tinkered.ai/components/tmc2209-stepper-driver/esp32. To test the circuit without hardware, it opens and runs free in Tinkered.
> The index of every Tinkered reference is at https://www.tinkered.ai/llms.txt

# TMC2209 Stepper Driver with an ESP32 DevKit V1

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

| TMC2209 Stepper Driver | ESP32 DevKit V1 | Note |
| --- | --- | --- |
| STEP | GPIO13 (D13) |  |
| DIR | GPIO14 (D14) |  |
| EN | GPIO27 (D27) |  |
| VIO | 3V3 |  |
| GND_LOGIC | GND |  |
| GND_MOT | GND |  |

## 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)

## Code

Libraries: waspinator/AccelStepper

```cpp
// 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();
}
```

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

## 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.

## More

- [TMC2209 Stepper Driver reference](https://www.tinkered.ai/components/tmc2209-stepper-driver.md): pinout, specs, rules and common mistakes

## Try it

Tinkered simulates the TMC2209 Stepper Driver on the ESP32 DevKit V1 in the browser, with this wiring and code, free: https://www.tinkered.ai/components/tmc2209-stepper-driver/esp32
