TMC2208 with Nema 17 stepper

Hi, I am fairly new to using stepper motors and am currently working on a project trying to power a NEMA 17 and control it using an Arduino Mega and a tmc2208 driver. The motor has a rated voltage range of 24v-48v and 0.7 A/phase.

I had previously set up this project using A4988 and gotten it to run but it was very noisy and had little to no torque power. This is why I switched to TMC2208. My issue now is that when I replaced the driver with the TMC2208, my motor stopped working. I ensured that it is in legacy mode and have tried to change the vref several times to see if this helped but my motor is still stationary. I replaced the driver with newer ones to see if it was faulty but that also did not change the outcome. My power supply settings were previously 2A and 12V but I'm not sure if I should change this with the new drivers so I started out with 0.7 A and 12 V for testing the new drivers.

I just want advice on how to get this motor running smoothly so I am able to attach it to my linear stage configuration. The project is not related to 3D printing which seems to be all the articles I can find on the driver otherwise. Here is my code.

//Include the Arduino Stepper Library
#include <AccelStepper.h>
#include <LiquidCrystal_I2C.h> // Library for LCD

const int dirPin = 27;
const int stepPin = 26;
int leftbuttonPin = 13;
int rightbuttonPin = 11;
int leftbuttonVal = 1;
int rightbuttonVal = 1;

#define motorInterfaceType 1
AccelStepper plateStepper(motorInterfaceType, stepPin, dirPin);
LiquidCrystal_I2C lcd = LiquidCrystal_I2C(0x3F, 16, 2); // Change to (0x27,20,4) for 20x4 LCD.

void setup() {


void loop () {



Post a schematic of your wiring.

Post clear photos showing the wiring.

Did you determine the coil pairs with your DMM?

This is the reference image I used for the wiring and then below are images of my wiring. My connections are:

VCC- Arduino 5V
GND- Arduino GND (also tied to power supply ground)
M1B: red
M1A: blue
M2A: green
M2B: black
VMOT- 12 v 2 A
GND- motor ground

I removed the button connections and the associated code for them which is why they arent shown here. Also yes, I used a multimeter to ensure the coils were correct they are:

red: A
blue: A-
green: B
black: B-


It sure looks like the enable is to pin 36, not 38. I cannot see where step and dir go.

How much current do you think those jumpers can carry? I would not trust them to carry more than 200mA or 300mA, if that.

Did you ever disconnect or connect the motor with the driver powered up? That is sure death for a driver.

What does the new version of your code do? Post the latest version of your code. Always post the new version any time that you change the code so that we can keep up.

Sorry that was a typoe, EN is connected to 36.

The code above is my most up-to-date code, I was simply referencing that I initialize push buttons but have removed that from the loop during testing since I couldn't even get the motor to run properly.

I don't think I have removed the motor while powering the driver. Regardless I am still able to set vref so I assumed this would mean that the driver is functioning properly. Is that true?

Is there a better solution other than jumper wires I should be using? I have gotten motors to run in the past using these wires

0.6mm solid-core hook up wire can carry decent amounts of current - breadboards aren't really designed for it though, just the contact resistance can lead to local heating and damage at multi-amp current levels.

I am a little confused because I was able to get this code working with the A4988 driver instead of TMC2208. What could've changed?

I have just tried a new code with a A4988 driver and the TMC2208 driver, in this instance the TMC2208 did not work but the A4988 worked immediately. I, therefore, assume I am doing something wrong with the TMC2208. I have set the vref to 1 V on the TMC2208 driver, I am unsure what the vref is set to for the A4988 because it is static. Here is the code:

#include <AccelStepper.h>
//Initiliaze step and direction pins for each motor
#define motor1dirPin 2
#define motor1stepPin 3
#define motor2dirPin 27
#define motor2stepPin 26
#define motor3dirPin 6
#define motor3stepPin 7
int fibers = 70;
int carts = fibers / 10;

//initialize the number of steps each motor has
#define stepsPerRevolution 200

//initialize the motor interface
#define motorInterfaceType 1

//initialize steppers with the AccelStepper library
AccelStepper stepper1(motorInterfaceType, motor1stepPin, motor1dirPin);
AccelStepper stepper2(motorInterfaceType, motor2stepPin, motor2dirPin);
AccelStepper stepper3(motorInterfaceType, motor3stepPin, motor3dirPin);

void setup()
  // Declare pins as Outputs
  pinMode(motor1stepPin, OUTPUT);
  pinMode(motor1dirPin, OUTPUT);
  pinMode(motor2stepPin, OUTPUT);
  pinMode(motor2dirPin, OUTPUT);
  pinMode(motor3stepPin, OUTPUT);
  pinMode(motor3dirPin, OUTPUT);

  //stepper 1 settings, moves stage 1 down towards load cell

  //stepper 2 settings, moves stage 2 and stage 1 left and right underneath load cell
  //    stepper2.setMaxSpeed(50.0);
  //    stepper2.setAcceleration(50.0);
  //    stepper2.moveTo(1000000);
  //    stepper2.setCurrentPosition(0);

  //stepper 3 settings, moves load cell up and down to make contact with fibers
  //    stepper3.setMaxSpeed(50.0);
  //    stepper3.setAcceleration(50.0);
  //    stepper3.moveTo(100);
  //    stepper3.setCurrentPosition(0);


void loop()

  // Take user input for number of fibers loaded, divide this number by 10 and
  //loop through main commands that many times (ex: 70 fibers, 7 loops)
  //for (int n = 0; n < carts; n++);
  // complete inner loop ten times for each of the ten fibers in a cartridge
  //for (int m = 0; m < 10; m++)
  //move stepper 3 down
  //    digitalWrite(dirPin, HIGH);
  //    stepper3.setMaxSpeed(50.0);
  //    stepper3.setAcceleration(10.0);
  //    stepper3.moveTo(100);
  //    stepper3.runToPosition();
  //    delay(1000);
  //    stepper3.setCurrentPosition(0);
  // move stepper 2 left
  // digitalWrite(motor2dirPin, HIGH);
  //move stepper 2 right
  // digitalWrite(motor2dirPin, LOW);
  //move stepper 3 up
  //    digitalWrite(dirPin, LOW);
  //    stepper3.setMaxSpeed(50.0);
  //    stepper3.setAcceleration(10.0);
  //    stepper3.moveTo(100);
  //    stepper3.runToPosition();
  //    delay(1000);
  //    stepper3.setCurrentPosition(0);
  //move stepper 1 one small tick
  //          digitalWrite(motor1dirPin, LOW);
  //          stepper1.setMaxSpeed(100.0);
  //          stepper1.setAcceleration(10.0);
  //          stepper1.moveTo(24);
  //          stepper1.runToPosition();
  //          //delay(1000);
  //          stepper1.setCurrentPosition(0);
  //move stepper 1 one extra small tick
  //  digitalWrite(dirPin, HIGH);
  //  stepper1.setMaxSpeed(100.0);
  //  stepper1.setAcceleration(10.0);
  //  stepper1.moveTo(24);
  //  stepper1.runToPosition();
  //  delay(1000);
  //  stepper1.setCurrentPosition(0);

1 Like

This topic was automatically closed 120 days after the last reply. New replies are no longer allowed.