TB67H420FTG Motor Driver Carrier

7d
Hello everyone,
My project is to realize a motor DC driver for a Long-Travel Linear Stages. The connection with the motor is made using a DB25 port.

For that I use the TB67H420FTG Motor Driver Carrier as i'm new to arduino my question is how to exploit the signals that come out of the engine (encoder,Index I.....)

should I program a library for this controller ?

Thank you in advance.

DB25.PNG

project.PNG

Thank you for telling us.

...R

Which encoder libraries have you looked at already? Most encoders are the same, you
don't need a new library.

You clearly need to interface the encoder and the end switches. So first step is getting working
inputs from them, driving the motor from a small battery or something for testing (no danger
of machanical damage if the supply isn't too powerful).

Then you need to drive the motor,

Then you need to ensure emergency stop works for end-switches,

Then you close the loop (if position control is needed).

Thanks for your answer I understand better. for encoders I just know that they are quadrature encoders but I don't know if I should use a library for them.

I found this table in the datasheet of the driver.

Do you think this table can help me to control the DC Motor ?
I didn't really understand can you explain me a litte please ?

Thank you.

Pololu have a datasheet link for that chip - each channel has INx1, INx2, PWMx and a VREFx
You need to check whether you need to set the VREF, and follow that truth table you linked.

Find a small motor and experiment with low voltage, its a pretty standard setup and there
are a lot of tutorials for motor shields.

I'd like to know if this code can work with my encoder, Position measurements are read on a 4000 pts/rev. rotary encoder, mounted directly on the ball screw.
I have 6 pins to encode it. Can I use only the 2 pins : A and B as on this code to realize the controller?

int pulses;                              //Output pulses.
int deg = 0;
int encoderA = 3;
int encoderB = 2;
const int pwm = 5;                      //Power of motor.
const int dir = 4;                       //Direction of the motor.
int pulsesChanged = 0;
#define total 245                        //x1 pulses per rotation.
#define motorSpeed 180                   //Change speed of the motor.
void setup(){
  Serial.begin(115200);
  lcd.begin(16,2);
  lcd.setCursor(0,0);
  lcd.print("x1 ENCODER");lcd.print("     ");
  pinMode(encoderA, INPUT);
  pinMode(encoderB, INPUT);
  pinMode(pwm, OUTPUT);
  pinMode(dir, OUTPUT);  
  analogWrite(pwm,0);
  digitalWrite(dir,HIGH);
  waitAnyKeyPress();
  attachInterrupt(0, A_CHANGE, CHANGE);


}//setup

void loop(){
 if (pulses == total) {
    analogWrite(pwm, 0);
    digitalWrite(dir, HIGH);
  }
  else {
    if (pulses > total) {
      analogWrite(pwm, motorSpeed);
      digitalWrite(dir, LOW);


    }
    else if (pulses < total) {
      analogWrite(pwm, motorSpeed);
      digitalWrite(dir, HIGH);
    }
  }
  
  if (pulsesChanged != 0) {
    pulsesChanged = 0;
    lcd.setCursor(0,1);
    lcd.print("Pulses:");lcd.print(pulses);lcd.print("          ");
    Serial.println(pulses);
  }
}

void A_CHANGE(){                                  //Function that to read the pulses in x1.
  if( digitalRead(encoderB) == 0 ) {
    if ( digitalRead(encoderA) == 0 ) {
      // A fell, B is low
      pulses--; // moving reverse
    } else {
      // A rose, B is low
      pulses++; // moving forward
    }
  }
  pulsesChanged = 1;
}

encoder_datasheet.PNG