Doubt with TB6560 and AccelStep Library/Stepper Library

Hello

I’m trying to add the Stepper Library or the AccelStep Library from arduino to my code.
I’m using a:

One of the examples in arduino about the stepper speed control is the following:

/*
 Stepper Motor Control - speed control

 This program drives a unipolar or bipolar stepper motor.
 The motor is attached to digital pins 8 - 11 of the Arduino.
 A potentiometer is connected to analog input 0.

 The motor will rotate in a clockwise direction. The higher the potentiometer value,
 the faster the motor speed. Because setSpeed() sets the delay between steps,
 you may notice the motor is less responsive to changes in the sensor value at
 low speeds.

 Created 30 Nov. 2009
 Modified 28 Oct 2010
 by Tom Igoe

 */

#include <Stepper.h>

const int stepsPerRevolution = 200;  // change this to fit the number of steps per revolution
// for your motor


// initialize the stepper library on pins 8 through 11:
Stepper myStepper(stepsPerRevolution, 8, 9, 10, 11);

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

void setup() {
  // nothing to do inside the setup
}

void loop() {
  // read the sensor value:
  int sensorReading = analogRead(A0);
  // map it to a range from 0 to 100:
  int motorSpeed = map(sensorReading, 0, 1023, 0, 100);
  // set the motor speed:
  if (motorSpeed > 0) {
    myStepper.setSpeed(motorSpeed);
    // step 1/100 of a revolution:
    myStepper.step(stepsPerRevolution / 100);
  }
}

There’s a part in that code that says:

// initialize the stepper library on pins 8 through 11:
Stepper myStepper(stepsPerRevolution, 8, 9, 10, 11);

I suppose that these pins should be somehow related to the wires going from the TB6600 driver to the arduino.

I currently have EN- , CW- , CLK - connected to the Arduino GND Pin,
as for EN+ -->arduino pin6
CW + → arduino pin3
CLK+ → arduino pin2

so I end up with two doubts basically:

  1. Which ones should be pins 8,9,10,11 from the example to the ones on my wiring?
  2. is the TB6600 compatible with the arduino libraries? such as Accel Step; stepper, etc…

Thanks for reading and hoping you could lend me a hand here! :slight_smile:

Regards

Which TB6600 Driver?

For TB6600, you should use the AccelSteopper, the Stepper library is not designed for this type of motor driver.

You might find this page useful http://diyprojects.eu/wiring-and-running-tb6600-stepper-driver-with-arduino/

zwieblum:
Which TB6600 Driver?

it's a TB6560 actually (sorry about that)
Here's the driver itself

Is it possible that this is the correct way to write it on my code? :

Stepper myStepper(stepsPerRevolution, 8, 9, 10, 11) = (0, STEPPER, CLK_PIN, DIR_PIN) = (0,STEPPER(??),2,3)

bobcousins:
For TB6600, you should use the AccelSteopper, the Stepper library is not designed for this type of motor driver.

You might find this page useful Wiring and running TB6600 stepper driver with Arduino - DIY Projects

thank you!
unfortunatley I was mistaken and my driver is actually a TB6560
But this will be very useful for when I have one of those! thank you :slight_smile:

Robin2's simple stepper code should work with that driver to test it. You may have to handle the enable pin yourself, though. As previous mentioned, the Stepper library will not work with a step/dir driver like yours (use AccelStepper).