Stepper motor speed (RPM)

Hello,

I am using hanpose 17HS4401S with TMC2209 driver and was wondering how could I increase the RPM of the motor? do I have to put higher voltage/current?, does the driver have some kind of implemented function that could speed up the motor, or do I have to do it through <Stepper.h> library?

I am currently using 12V 5A power supply but I would like to make stepper spin little bit more faster then it currently is. Driver is providing 1.5A to the motor

1.5A is OK (as max is 1.7)
Do no microstepping.
Try Step_pulse 5 microsek / 70 us. Decrease the 70us pulse till U experience motor cant cope.

(possibly 20k steps/s is possible ==> ca 110 rpm)

We need to see your program.

Also please post a link to the datasheet for your stepper motor.

The speed of a stepper motor is determined by the interval between step pulses. And if you want a high speed you need to accelerate the motor - just like any other motor, a stepper motor cannot change instantly from stationary to high speed.

In general a higher voltage power supply (within the limits acceptable to the driver) will be needed for higher speeds. The driver needs to be set to limit the current to whatever is appropriate for your motor.

...R
Stepper Motor Basics
Simple Stepper Code

also look up the AccelStepper library

Robin2:
We need to see your program.

Also please post a link to the datasheet for your stepper motor.

The speed of a stepper motor is determined by the interval between step pulses. And if you want a high speed you need to accelerate the motor - just like any other motor, a stepper motor cannot change instantly from stationary to high speed.

In general a higher voltage power supply (within the limits acceptable to the driver) will be needed for higher speeds. The driver needs to be set to limit the current to whatever is appropriate for your motor.

...R
Stepper Motor Basics
Simple Stepper Code

also look up the AccelStepper library

Hi,
this is the code im using, it has nothing to indicate what speed it should rotate, it rotates the way it is with supply im providing it, but I consider it way too slow, which is why i'd like to increase it by even a bit. I must say that with A4988 it did spin much faster compared to TMC2209 on same settings, but I consider tmc2209 much higher quality and provides many more options, so I'd like to achieve higher speed through coding if possible. Also I am using arduino Nano

int DIR = 5;  DIR PIN
int STEP = 6;  //step pin
int Power_Relay = 3; 
int SW_Sunpoint = 2; 

int photo_res = A1;
int step_count = 0;
int check_s = 0;
bool poweron = 0;
int MODE = 0;
void setup() {
  // put your setup code here, to run once:
  pinMode(DIR, OUTPUT);
  pinMode(Power_Relay, OUTPUT); 
  pinMode(STEP, OUTPUT);
  pinMode(SW_Sunpoint, INPUT);

  digitalWrite(DIR, HIGH);
  Serial.begin(9600);

  digitalWrite(Power_Relay, HIGH); 
  Serial.println("POWER OFF initially");
  digitalWrite(STEP, LOW);
}

void loop() {
  int brightness = analogRead(photo_res);;
  Serial.println(brightness);
  if (brightness > 395) {
    MODE = 1;
    Serial.println("DAY MODE");
  }
  else if (brightness < 350) {
    MODE = 2;
    Serial.println("NIGHT MODE");
  }
  else {
    MODE = 0;
    Serial.println("IN BETWEEN DAY & NIGHT");

  }
  if (MODE == 1) {
    if (poweron == 0) {
      Serial.println("Electricity ON");
      digitalWrite(Power_Relay, LOW);
      for (;;) {
        Serial.println("Rotating");
        digitalWrite(DIR, HIGH);
        digitalWrite(STEP, HIGH);
        delay(10);
        digitalWrite(STEP, LOW);
        delay(10);
        check_s=1;
        step_count++;
        if (digitalRead(SW_Sunpoint)) {
          poweron = 1;
          digitalWrite(Power_Relay, HIGH);
          Serial.println("Electricity OFF");
          break;
        }
      }
    }
    else {
      digitalWrite(Power_Relay, HIGH);
    }
  }
  else if (MODE == 2 && check_s==1) {
    Serial.println("Night Detected");
      digitalWrite(Power_Relay, LOW);
      Serial.println("Electricity ON");
      while (step_count > 0) {
        digitalWrite(DIR, LOW);
        digitalWrite(STEP, HIGH);
        delay(10);
        digitalWrite(STEP, LOW);
        delay(10);
        step_count--;
      }
      check_s=0;
      poweron = 0;
      digitalWrite(Power_Relay, HIGH);
      Serial.println("Electricity OFF");
//    
  }
  else{
          digitalWrite(Power_Relay, HIGH);

    
    }

}

4113.png

4114.png

4113.png

4114.png

These are what determine the speed:

        delay(10);

Smaller delay gives you more speed. Up to a point where you need to consider gradual acceleration to get to the speed you want.

There are two delay(10)s in your FOR loop which means that a step pulse will be produced once every 20 millisecs.

IMHO it makes things easier if you have a very short step pulse (most drivers need less than 10 microsecs) and put all the time into the interval between steps. Like this, with your code

        digitalWrite(STEP, HIGH);
        delayMicroseconds(10);
        digitalWrite(STEP, LOW);
        delay(20);

Then you only need to change one number (the 20) to change the speed.

However look at the code in the link I gave you, especially the second example, for a better way to organise the code using meaningful variable names.

...R

Robin2:
There are two delay(10)s in your FOR loop which means that a step pulse will be produced once every 20 millisecs.

IMHO it makes things easier if you have a very short step pulse (most drivers need less than 10 microsecs) and put all the time into the interval between steps. Like this, with your code

        digitalWrite(STEP, HIGH);

delayMicroseconds(10);
       digitalWrite(STEP, LOW);
       delay(20);



Then you only need to change one number (the 20) to change the speed.

However look at the code in the link I gave you, especially the second example, for a better way to organise the code using meaningful variable names.

...R

Yes that did the trick ^^, I also checked the code you recommended and will definetly make some improvemets, thanks !