Driving Stepper motor from TB6612FNG?

According to the documentation, it should be possible to drive a Bipolar stepper from the TB6612FNG…

I’m having a heck of a time getting it to do anything though. I was able to at least get the motor to move a little when I was using the sparkfun Arduino motor shield, but I couldn’t work out how to get it to move in the right direction continuously (was trying to use the Arduino servo library.)

Since I generally HATE that shield, I decided to go to my old standby, the TB6612FNG which I’ve had great success with in the past. But I’m getting nowhere with it.

I have it hooked up like this:

The AIns and BIns are hooked up to Arduino pins 10,9,7,6 respectively. I have the standby hooked to pin 3 which I’m driving High. I have the Aouts and Bouts going to the 4 wires on the stepper. I have PWMA and B both tied to pins which I’m setting digital high. VMotor is tied to a 6V battery pack (4 AA’s). The grounds are all tied together between the 6612, the Arduino and the Battery. I’m driving the Arduino and 6612’s VCC from my USB port on my laptop.

I’m then using the following sketch:

const int motorstandby = 3;
const int pwmA = 12;
const int pwmB = 13;
const int A1IN = 10;
const int A2IN = 9;
const int B1IN = 7;
const int B2IN = 6;

int steptable[4][4] = {
  // energize stage 1
  { 1, 1, 0, 1},
  //energize stage 2
  {1, 1, 1, 0},
  // energize stage 3
  {0, 1, 1, 1},
  //energize stage 4
  {1, 0, 1, 1}
};


int stepCount = 0;         // number of steps the motor has taken

void setup() {
  // initialize the serial port:
  Serial.begin(9600);
  pinMode(pwmA, OUTPUT);
  digitalWrite(pwmA, HIGH);
  pinMode(pwmB, OUTPUT);
  digitalWrite(pwmB, HIGH);
  pinMode(motorstandby, OUTPUT);
  digitalWrite(motorstandby, HIGH);

  pinMode(A1IN, OUTPUT);
  pinMode(A2IN, OUTPUT);
  pinMode(B1IN, OUTPUT);
  pinMode(B2IN, OUTPUT);
}

void loop() {
  // step one step:
  stepCW(200);
  delay(500);
}

void stepCW(int steps) {
  int stage = 0;
  for (int i = 0; i < steps; i++) {
    stage = i % 4;
    // turn off the motor
    digitalWrite(motorstandby, LOW);
    // write the pins the way we need to get the output
    digitalWrite(A1IN, steptable[stage][0]);
    digitalWrite(A2IN, steptable[stage][1]);
    digitalWrite(B1IN, steptable[stage][2]);
    digitalWrite(B2IN, steptable[stage][3]);
    Serial.print("steps:" );
    Serial.print(i);
    Serial.print("  stage:");
    Serial.print(stage);
    Serial.print(": ");
    Serial.print(steptable[stage][0]);
    Serial.print(steptable[stage][1]);
    Serial.print(steptable[stage][2]);
    Serial.println(steptable[stage][3]);


    // turn the motor back on
    digitalWrite(motorstandby, HIGH);
    // wait a little bit
    delay(500);
  }
}

I see the output cycling on the serial port the way I would expect it to and based on what I’ve seen for the 6612’s control lines, I would expect this would cycle between making A brake and B switch between CW/CCW, then A switch between CW/CCW with B braking, which is what my understanding of Steppers says should be getting sent into it.

I’m getting ZERO movement though. No movement, not even resistance to me spinning the motor by hand.

I’m utterly stumped. Ideas??? I’m about ready to give up and just order a dedicated stepper controller, but I would prefer to use what I already have since it’s SUPPOSED to be doable.

I also have one of the VNH5019’s if that’s usable… I just fail to understand how the Arduino Stepper library can even work with all the variations of motor controllers out there!

Hello.

The TB6612FNG should be able to drive a stepper motor. From your description, it sounds like you might have a power issue. Could you tell me more about your stepper motor? What are the rated voltage and coil current of the stepper motor? Could you post pictures of your setup?

The VNH5019 shield can also be used to drive stepper motors. You can find more information about using it to control stepper motors in this thread.

- Jeremy

Thanks for getting back to me.

This is my first go around with steppers so I’m pretty lost… It’s a M35SP-11HPK that I pulled out of an old printer. I’m powering the motor (VMotor) with 4AA’s (so ~6V) (also tried with 4 rechargeables so ~4.8V).

Without knowing more information about your stepper motor, it is difficult to say if 6V is appropriate for powering it. If possible, you should refer to the stepper motor’s datasheet to find out what its rated voltage and coil current are. This will help determine if the batteries are suitable for driving the motor.

- Jeremy