Arduino uno and Single 1 Axis TB6560 3.5A Stepper Stepping Motor Driver Board

Hi everyone,

I am trying to get this working but I got stuck.

Instead reversing motor just gets locked…

From arduino at this moment are only 3 contacts connected

8 Step
9 Direction
10 Enable

Motor is Trinamic QMot steppmotor Hybrid 1,8° QSH5718-56-28-126 with 4 wires.

Motor driver board:

Any ideas?

#include <AccelStepper.h>

// Define a stepper and the pins it will use
AccelStepper stepper(AccelStepper::DRIVER, 8, 9);

#define switchPinA 2 // limit switch
#define switchPinB 3 // limit switch
#define ouenable 10 // Enable Motor to run
#define lowestRandomNum -1000
#define highestRandomNum 1000

void setup()
pinMode(ouenable, OUTPUT);

void loop()
digitalWrite(ouenable, HIGH);
if (stepper.distanceToGo() == 0)
// Random change to speed, position and acceleration
// Make sure we dont get 0 speed or accelerations
long someRandomPosition=random(-2000, 2000);
stepper.setMaxSpeed(random(800, highestRandomNum) + 1);
stepper.setAcceleration(random(500, 800) + 1);
if(digitalRead(switchPinA)==HIGH || digitalRead(switchPinB)==HIGH)
someRandomPosition=someRandomPosition * -1; // just invert data
stepper.stop(); // Stop as fast as possible: sets new target

Can you edit the posting and add:

code tags for the code. link to the info on the motor driver board in question diagram or photo of how its all connected up...

Else its guesswork...

Hi guys,

I’m having about the same problem. I’m using an arduino UNO and a Toshiba BL-TB6560 V2.0 single axis driver board. I’m driving 2 steppermotors nema 17. The CW+ and the CLK+ are on pin 8 and 9. Enable + is on the 5V and all the -'s are on the ground of the arduino. Now, when I turn on the current, both the steppers are locked. But when I make the connection between my PC and the arduino UNO, it’s all gone. you can turn it around freely .

Arduino code (very easy, to exlude this)

#include <Stepper.h>

int directionpin = 8;
int steppin = 9;

void setup() {

pinMode(directionpin, OUTPUT);
pinMode(steppin, OUTPUT);
void loop()

int i;

digitalWrite(directionpin, LOW); // Richting instellen, uit

int Dir = LOW;

for (i = 0; i<4000; i++) // Iteratie van 4000 microsteps
//digitalWrite(directionpin, Dir);
Dir = (Dir == LOW) ? HIGH : LOW;
digitalWrite(steppin, LOW);
delay(100); // Een delay zodat de motor niet te hoog gaat

digitalWrite(steppin, HIGH);
delay(100); // Een delay zodat de motor niet te hoog gaat, aan


I hope you guys know what i’m doing wrong. (I can make a picture of my connections if that would help you)



websonic: From arduino at this moment are only 3 contacts connected

8 Step 9 Direction 10 Enable

That cannot work - you need ground return for the opto-isolated signals.

Hi guys,

Isn't there anyone who knows what I'm doing wrong? Because I'm still not solved the problem and I really need to get on with it :).

thanks in advance,


I originally wanted to use AccelStepper with the Toshiba TB6560 because it looked like such a nice useful Library (still does) but due to my lack of knowledge of how to implement the library to the TB6560 driver and my lack of knowledge in electronics in general and me just being a cutter/paster/meddler I found snippets of code and put them together.
Below is the code I use for my Elevation stepper motor with the Toshiba TB6560.

The Toshiba TB6560 has an output MO on leg 17 of the chip which I fed to an interrupt pin on the Arduino and counted the pulses. I’m not sure if this is the best way of doing this or how it has been designed to be used but it works ok.

If the author across the ditch of AccelStepper or anyone else could put up a brief example sketch of how to use it with the Toshiba TB6560 I would be very grateful.

void EliInterupt()
void enEliStepper()
	digitalWrite(ELI_MOTOR_RESET, HIGH);
	digitalWrite(ELI_ENABLE_PIN, HIGH);
void disEliStepper()
	digitalWrite(ELEV_ENABLE_PIN, LOW);
	digitalWrite(ELEV_MOTOR_RESET, LOW);

void SendEliSteps(long Steps, int Dir) {  
	EliInt =0;
	if (Steps != 0){
		digitalWrite(ELEV_DIR_PIN, Dir);
		Serial.print("Elevation steps ");
		if (Dir == 0)
			Serial.print("clockwise ");
			Serial.print("anticlockwise ");
			digitalWrite(CLK_PIN, HIGH);
			digitalWrite(CLK_PIN, LOW);
		Serial.print("Finished Elevation steps in ");
		Serial.print(" milli seconds");

Decide what the MCU is providing- source or sink to the photo-couplers. The program sends the signal to the switch pin ( + or -) and then out the second pin to either V+ or GND.

Stepper Motors need to ramp up speed and ramp down. You can't just flip them in reverse. Also at a given high RPM, Different for every motor. They will loose steps and lock up. This dead zone is due to resonance in the system and varies for every product and design.

Why are you answering a question from a year ago, today ?

It was in Unread Posts, due to the prior post.

Yes, I know. The post before yours was the strange one.