Introduction: ARDUINO UNO + TB6560 Stepper Motor Driver

Picture of ARDUINO UNO + TB6560 Stepper Motor Driver

Hi. Good day

This is my first instructable. Hopefully anybody can comment if you want to ask question or correct me if i am wrong

Ok, this is tutorial to drive stepper motor using ARDUINO and TB6560 Stepper motor driver. You acctually can use EASYDRIVER but here i'm going to show you how to use it with TB6560. Advantage of using this driver are (a), Can change AMPs, (b) can stand high amp (More than 1Amp) and (c), can change the stepping easily. (full, half, 1/8 and 1/16 bridge).

OK, Let make it short. What you need to have

1 Arduino Uno

1 Stepper motor (Nema 17 @ Nema 23)

1 TB6560 Driver

1 Power supply ( 12V adapter works fine, support 10-35 V)

few Jumper wires and breadboard


Picture of CONNECTION FROM ARDUINO to TB6560 Driver

Connection to arduino

pin 9 (Step pin) to CLK+,

pin 8 (Dir pin) to CW+,

CLK- and CW- connect to GND arduino.

Do not connect EN+ and EN- to any ARDUINO PIN.

Stepper motor connection, you need to know which color is A+, A-, B+ and B-, according to the stepper motor spec. sheet.

It only works for 1/8 step ( S3 and S4 on) and 1/16 step (S4 only on), half and full bridge does not work (for my case).

Amp setting can be change according to the table on the DRIVER.

Step 2: THE CODE

/*Code from */

int Distance = 0; // Record the number of steps we've taken void setup() {

pinMode(8, OUTPUT);

pinMode(9, OUTPUT);

digitalWrite(8, LOW);

digitalWrite(9, LOW);


void loop() {

digitalWrite(9, HIGH);


digitalWrite(9, LOW);


Distance = Distance + 1; // record this step // Check to see if we are at the end of our move

// two rotation for 1/8 bridge and 1 rotation for 1/6 bridge (for this code)

if (Distance == 3200) { // We are! Reverse direction (invert DIR signal)

if (digitalRead(8) == LOW) {

digitalWrite(8, HIGH); }

else {

digitalWrite(8, LOW);

} // Reset our distance back to zero since we're // starting a new move

Distance = 0; // Now pause for half a second delay(500);



Step 3: The Result

Here is the result in youtube.

Any question, do not mind asking. In this video, i actually modified the code given so i can change the delay using a potentiometer.

(and this is for UNIPOLAR stepper motor - 4 wires), BIPOLAR - 6 wires also can use this driver as well but only 4 wire can be used and u need to check the spec. sheet which wire to connect to this driver. If You are using BIPOLAR stepper, please use BIPOLAR driver as you are not using your stepper motor to the highest potential (still can use UNIPOLAR driver) because UNIPOLAR Stepper motor give higher torque if you are using UNIPOLAR driver compare to BIPOLAR driver.

There are many others stepper driver for higher torque for example DQ860 and M542 (designated for HIGH torque stepper motor and i think it use the same concept. No harm trying. Use my method. If you are succesfully do that please leave a comment here. I will be very glad that i could help you !!!!



meenakshinegi (author)2018-01-08

tried with nema23

code not working

Mehadi_Saki made it! (author)2017-12-16


I made it by using your code. and change for 1/32 steps

MaisY1 (author)2017-08-17

hi, thanks for the tutorial.

i am using nema17 stepper motor and tb6560 driver.this code is working fine with me.

my question is how to rotate the motor to specific angle then stop it,so how to stop?

i have an encoder included with motor, do you have any idea how to use this? i connected A,B,G only to arduino. still have A-,B- not connected

the encoder motor is nanotec motor


mardiaha (author)2017-05-13

hi, I'm want to ask you about TB6560. Can TB6560 interface with AT89S52 microcontroller or its just for Arduino only ? I'm bit confusing how to the connect the CLK+ and CW+ to the microcontroller?

SelvaK3 (author)2016-06-15

Hi,im makeping an 2axis machine out of mdf sheet.Im going to use nema 17 stepper motor.shall i go for A4988 driver because it is cheaper than TB6560 stepper driver.can you help me

sindhuantony (author)SelvaK32016-09-23

I know its quiet late to answer this. Yes you can use both TB6560 and A4988 your Nema17. You can use A988 provided your motor current rating is 1.5 and below. Infact A4988 is a commonly used driver for 3D printing steppers. Check the current ratings before you choose a particular driver for your motor. Always better to choose a Chopper drive Stepper.

SelvaK3 made it! (author)sindhuantony2016-12-27

Thanks, even though it's late but you didn't hesitate to reply.This is my project

bparker2 (author)2016-11-05

Hi Great tutorial but I want to use 3 of these with my UNO for GRBL does anybody know of a circuit diagram for this please.

wifixcort made it! (author)2016-09-23

Thanks :)

JALASONIC2 (author)2016-09-17


SelvaK3 (author)2016-07-05

Which means 17 stepper motor is suitable for 3D printer.

das1233444 (author)2015-12-29

how do i connect the arduino to the potentiometer?what is the potentiometer rating used?

Idrispo (author)das12334442015-12-31

connect to analogpin in Arduino. Then you use analogRead to read the value of potentiometer. Replace the value of delaymicroseconds with the analogRead reading and huwala, you can control the stepper speed. But, you may need to divide with some value as analogueRead may go to 1023. this will slow down your stepper a lot.

das1233444 (author)Idrispo2016-01-06

thank u...and another thing is that can you share the program ?the provided program during compilation producing error.

Idrispo (author)das12334442016-01-07

the code should work easily, simply change delayMicroseconds(100) to delayMicroseconds(analogRead(A0)) ... if you use analog pin A0 and so on

das1233444 (author)Idrispo2016-01-07

thank u idrispo. It is working now.:)

OscarH45 (author)das12334442016-06-04

Hey… I have the same problem, but i can’t fix it… could you share the code?

Idrispo (author)das12334442016-01-07

i'm glad that i could help you. My pleasure to hear that

onurturkmen (author)2016-03-30

Hey ı know ıts late . But ı have a question for you. I couldnt see the feeding prop of driver card. How would we feed the card . There was some props to motor feeding but ı couldnt see prop.s for feeding driver card

vishnuchakravarthy (author)2016-02-16

does it matters if my motors peak current is 6A and my steppper motor drive also handles 6A and the tb6560 board output is only 3.5 A?

AllenT8 (author)2016-02-09

Thank you for the nice project. Can the Arduino uno board support, say, three TB6560 Drivers? If not, should I use board like the mega 2560 to control 3 axis?

SudarshanS6 (author)2016-01-13

I followed the above steps and used the code below with an Arduino Mega but my motor shaft will not rotate neither can it be turned with the hand. Any help would be really appreciated.


void setup() {

// put your setup code here, to run once:

pinMode(8, OUTPUT);

pinMode(9, OUTPUT);

digitalWrite(8, LOW);

digitalWrite(9, LOW);

digitalWrite(8, HIGH);


void loop() {

// put your main code here, to run repeatedly:

digitalWrite(9, HIGH);


digitalWrite(9, LOW);



Idrispo (author)SudarshanS62016-01-14

Please check whether it is full step or not?

zinedine (author)2015-12-08

good job!

what is "decay setting" in Switch mode tb6560?

Idrispo (author)zinedine2016-01-07

sorry, don't know what decay setting.. maybe you talk about delaymicroseconds

bogeym (author)2015-11-29

any one know how to wir this with arduino and use GRBL

this board tb6560 4axis

Idrispo (author)bogeym2015-12-31

sorry, i never try.

TínL (author)2015-08-31

Hi bro, can you explain to me why do we not connect the EN+ and EN- pin to any pins of the Adruino? and how can I connect it to a 2 phases 6 wires to control it

Idrispo (author)TínL2015-09-30

Ok, EN+ only to enable the stepper motor. By default, the motor will have holding torque if power is supplied to the driver it means that if u try to rotate the stepper shaft, the shaft is very difficult to move. En+ and EN- is to make sure you disable the stepper motor so you can removing the holding power of the motor. By giving signal (High or Low (i don't know which 1 since i had never tried it before)), you can disable the holding torque

eferz (author)2015-09-16

At the beginning it was working OK, but now the stepper motor nema 23 only goes forward never reverse and never stop what should I do?

Idrispo (author)eferz2015-09-30

try cek CW+ and CW- connection

E1024d (author)2015-09-25

How do u know your motor do not suport full and half step.

Idrispo (author)E1024d2015-09-30


ssraf (author)2015-03-10

Thanks for the tutorial : )

I've been trying to control a Stepper with a TB6560 but my driver is slightly different from what I've found around

If you take a closer look, it has only 4 control inputs, meaning I ONLY have V+, Pul-, Dir-, EN-. What do I do here? How do I setup the driver with the Arduino in this case? I've tried to connect Dir- and Pul- but I only succeeded damaging the Arduino

Thanks again!

Take care,

Idrispo (author)ssraf2015-07-09

I'm pretty sure that each of this have another pair. Please check again

Ultraread. (author)2015-07-09


Pul-........................... some input 8,9 or6

Dir-............................ some input 9, 8 or 7

V+.............................. arduino 5V+

that is all you need

it works with mine board same as yours

Idrispo (author)Ultraread.2015-07-09


aswin_ajayan (author)2015-01-12

excuse me ,

but are you telling that you could use a tb6560 without gcodes or mcodes. are you using any configuration files apart from the code given above?

Idrispo (author)aswin_ajayan2015-01-15

no need mcodes or gcode to move this thing using arduino.. but if you want to cut something that is complex, gcode is the solution.

NamH (author)2014-12-15


vsharma23 (author)2014-10-10

I m new in Arduino and i m trying to make. i m using this motor controler can you plz help me how to connect it with arduino and dc motor.??

plz reply..

blasterboy44 (author)2014-09-18

How can I add momentary switches to control say 10 or more programed going to stop 2,then pressing button 6 ,and stepper will advance to six..and so on..Any help or direction .very understandable post...Thanks..Ron...

Idrispo (author)2014-07-03

Ok, this tutorial is for those who want to get started with automatic control via ARDUINO especially for mini CNC, 3D Printing, 3D Scanning. There are already multiple stepper motor driver in the market which for examples (1) Easydriver (Chip A3967), (2) 3d printer driver on (4988) on polulu shield and etc.

However, these driver only support small torque stepper motor and cannot support big torque stepper motor. Big torque stepper motor is required if you want to move quite heavy load at higher precision ( not as precise as servo motor). So, you can use TB6560 for high torque stepper motor as this stepper motor require high AMPERAGE to produce high torque output at the stepper motor shaft.

With this kind of tutorial, you can have have your own CNC machine!!!.

Hope this answer your question.

crank_girl (author)2014-07-03

Excuse my ignorance but what would you use this for? (I'm trying to increase my technological knowledge.)

omnibot (author)crank_girl2014-07-03

This looks mostly like a proof of concept but it could be used to write a program for arduino for some special application such as opening or closing ventilation in a greenhouse.
If you'd like to do more I suggest looking into the GRBL, a g-code interpreter for arduino. That can be used to create a full lasercutter, CNC-mill or robot.

About This Instructable




More by Idrispo:ARDUINO UNO + TB6560 Stepper motor driver
Add instructable to: