ARDUINO UNO + TB6560 Stepper Motor Driver

168,286

95

45

Published

Introduction: 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

Step 1: 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 http://www.schmalzhaus.com/EasyDriver/Examples/Ea... */

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);

delayMicroseconds(100);

digitalWrite(9, LOW);

delayMicroseconds(100);

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 !!!!

THANKS!!!!

3 People Made This Project!

Recommendations

  • Oil Contest

    Oil Contest
  • Creative Misuse Contest

    Creative Misuse Contest
  • Water Contest

    Water Contest

45 Discussions

Hello,

I am developing a AGV project in which i ll be using a Disc magnet stepper motor (P532 stepper motor). My question is that can i use the same setup for the stepper motor mention.

I am new in this so don't know much about it. I ll also be using ultrasonic sensor for collision avoidance during movement.

Suggest me a best way for communication between 3-4 workstations as they will transfer material on AGV.

Please help me out for this.

tried with nema23
code is working

thanks a lot! i got a lot of lesson learnt from this guide

1 reply

tried with nema23

code not working

0
user
MaisY1

11 months ago

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

thanks

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?

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.

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

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

6 replies

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.

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

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

thank u idrispo. It is working now.:)

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

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

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

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?