Driving a Bipolar Stepper with the TB 6600 v1.2 Driver

Hello,

I have attached the motor datasheet, the driver specs (couldnt find the datasheet for the 1.2 version), the schematic of the circuit and the code that i used for this project (which is actually taken from another post here on arduino forums).

What i want this project to do:

  • Be able to adjust the speed of the motor with a potentiometer
  • Be able to adjust the direction of the motor (clockwise, counter-clockwise)

The problem that i face:

While the driver has Power and RUN LEDs that both turn on when i power the circuit and the RUN LED actually blinks according to the potentiometer position ( pot value low > slow blink , pot value high > faster blink ), my motor doesnt move.

I measured the voltage in the output pins for the motor coils on the driver (A+, A-, B+, B-) and i get 0 V readings even at low potentiometer values on all pins.

What could be the problem?
Also, should i try and write the program with the accelstepper library? Is it worth the hustle for such a simple project?

Thanks in advance!

P.S. The code:

// testing a stepper motor with a Pololu A4988 driver board or equivalent

// this version uses millis() to manage timing rather than delay()
// and the movement is determined by a pair of momentary push switches
// press one and it turns CW, press the other and it turns CCW

// updated 17 Oct 2016 to include input from a potentiometer on A0
//   potentiometer should vary millisBetweenSteps from 1050 to 27
//     NOT TESTED

byte directionPin = 9;
byte stepPin = 8;

byte buttonCWpin = 10;
byte buttonCCWpin = 11;

boolean buttonCWpressed = false;
boolean buttonCCWpressed = false;

byte ledPin = 13;

unsigned long curMillis;
unsigned long prevStepMillis = 0;
unsigned long millisBetweenSteps = 25; // milliseconds

byte potPin = A0; // NEW
int potval;       // NEW
unsigned long slowMillisBetweenSteps = 1050;  // NEW
int potVal;

void setup() {

  Serial.begin(9600);
  Serial.println("Starting Stepper Demo with millis()");

  pinMode(directionPin, OUTPUT);
  pinMode(stepPin, OUTPUT);
  pinMode(ledPin, OUTPUT);
 
  pinMode(buttonCWpin, INPUT_PULLUP);
  pinMode(buttonCCWpin, INPUT_PULLUP);
  millisBetweenSteps = slowMillisBetweenSteps;   // NEW
}

void loop() {
 
 curMillis = millis();
 readButtons();
 readPotentiometer(); // NEW
 updateInterval(); // NEW
 actOnButtons();
 
}

void readButtons() {
 
 buttonCCWpressed = false;
 buttonCWpressed = false;
 
 if (digitalRead(buttonCWpin) == LOW) {
 buttonCWpressed = true;
 }
 if (digitalRead(buttonCCWpin) == LOW) {
 buttonCCWpressed = true;
 }
}

void actOnButtons() {
 if (buttonCWpressed == true) {
 digitalWrite(directionPin, LOW);
 singleStep();
 }
 if (buttonCCWpressed == true) {
 digitalWrite(directionPin, HIGH);
 singleStep();
 }
}

void singleStep() {
 if (curMillis - prevStepMillis >= millisBetweenSteps) {
 prevStepMillis += millisBetweenSteps;
 digitalWrite(stepPin, HIGH);
 digitalWrite(stepPin, LOW);
 }
}

void readPotentiometer() {     // NEW
    potVal = analogRead(potPin);
}

void updateInterval() {        // NEW
    millisBetweenSteps = slowMillisBetweenSteps - potVal;
}

TB_6600_Test_v0.1a.ino (2.1 KB)

Could someone write a code that works with the accelstepper library and can control speed with a potentiometer and direction with 2 buttons? (cw,ccw).Its for the above circuit.

Thanks