TB67S128FTG Driver Speed Issue

Hello,

I just brought a couple of the new TB67S128FTG motor drivers, they are great and offer tons of new functions.

However, I’m having trouble getting the motor to run at the right speeds. I’m using an Arduino, and I will be posting the code down below.

The issue I’m facing is that when I lower the delay between steps, the motor speed does not ramp up as much as expected (expect speed to increase by 1 rpm but in reality, it increased by 0.4). And this issue becomes more serious at higher speeds.

I’m familiar with DRV8825s and AMIS-⁠30543s. This is the first time I encountered this issue.

Any discussion would be immensely helpful.

Thanks!

#define DIR 10
#define STEP 9
#define EDGE 5
#define ENABLE 6
#define STANDBY 7

#define MODE0 13
#define MODE1 12
#define MODE2 11

#define GEAR_RATIO 14.1
#define MICROSTEPS 128
#define MOTORSTEPS 200
#define OFFSET 1

volatile int interval;
volatile double RPM = 1;
String inputString = "";
volatile boolean stepState = HIGH;

void setup() {
  pinMode(DIR, OUTPUT);
  pinMode(STEP, OUTPUT);
  pinMode(ENABLE, OUTPUT);
  pinMode(STANDBY, OUTPUT);
  pinMode(EDGE, OUTPUT);

  pinMode(MODE0, OUTPUT);
  pinMode(MODE1, OUTPUT);
  pinMode(MODE2, OUTPUT);

  digitalWrite(DIR, HIGH);
  digitalWrite(STEP, LOW);
  digitalWrite(ENABLE, HIGH);
  digitalWrite(STANDBY, HIGH);
  digitalWrite(EDGE, HIGH);

  digitalWrite(MODE0, HIGH);
  digitalWrite(MODE1, HIGH);
  digitalWrite(MODE2, HIGH);

  Serial.begin(9600);
  getDelay();

}

void loop() {
  step();
  delayMicroseconds(interval);
}

void getDelay() {
  interval = (60000000 / (MOTORSTEPS * MICROSTEPS * GEAR_RATIO * RPM));
  interval -= OFFSET;

}

void step()
{
  digitalWrite(STEP, stepState);
  stepState = !stepState;

}

void serialEvent() {
  while (Serial.available()) {
    // get the new byte:
    char inChar = (char)Serial.read();
    // add it to the inputString:
    inputString += inChar;
    // if the incoming character is a newline, set a flag so the main loop can
    // do something about it:
    if (inChar == '\n') {
      RPM = inputString.toDouble();
      getDelay();
      inputString = "";
      Serial.println(interval);
    }
  }
}

Hello.

You talk about relative changes in speed (e.g. a 1 RPM increase produces an actual increase of 0.4 RPM), but that is not so helpful since the performance of your program is affected by the actual speed. Can you give me some absolute numbers for the speed are you setting and speed are you observing? Also, how are you measuring the actual speed of your stepper motor?

- Amanda

Hi Amanda,

Thank you for your reply, I’m using an encoder based speed monitoring rig I built myself. I’ve tested it with other drivers and find it to be relatively reliable.

I just ordered an oscilloscope and a function generator. I’ll update the post once I have an idea of what’s going on.

Thank you!

That sounds good. In the meantime, can you give me some actual examples of speeds you are setting and the corresponding speeds you measure?

- Amanda