Stepper Motor very slow. Can't figure it out

With the setup and code below my stepper motor is only turning about 1 revolution every 10 seconds. According to my power supply it's only drawing about .22 Amps which isn't enough.

The stepper driver I'm using is the TMC2209 v1.3 which seems to have no documentation from v1.2.

#include <AccelStepper.h>
#include <MultiStepper.h>
/*

*/

AccelStepper stepper1(1, 4, 2);


void setup() {
  Serial.begin(9600);
  stepper1.setMaxSpeed(2000);
  stepper1.setSpeed(2000);
  pinMode(8, INPUT_PULLUP);
 
}

void loop() {

     
     
      if(digitalRead(8) == LOW){
        Serial.print("button on");
        stepper1.runSpeed();
        
      }
    
}

I don't even know what to troubleshoot at this point. Would love some thoughts. Thank you

can you clarify exactly how you power the motor ?

otherwise you should remove the Serial.print("button on"); from the loop as you'll soon saturate the Serial port and print will become blocking, especially at 9600 bauds. ➜ this becomes a throttling factor to your stepper

TMC2209_datasheet_rev1.08.pdf (analog.com)

1 Like
#include <AccelStepper.h>
#include <MultiStepper.h>
AccelStepper stepper1(1, 4, 2);

void setup() {
  stepper1.setMaxSpeed(200);
  stepper1.moveTo(2000);
  pinMode(8, INPUT_PULLUP);
}

void loop() {
  if (digitalRead(8) == LOW) stepper1.run();
}

What's wrong with that? Why is it not enough? What's the voltage of your PSU?
How did you set the current at the TMC2209?

The slow speed is caused by too much Serial prints

It was the serial prints. :face_with_peeking_eye:

Thank you

glad it was solved! have fun.