ARDUINO UNO + TB6560 Stepper Motor Driver

196,151

98

46

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

Teacher Notes

Teachers! Did you use this instructable in your classroom?
Add a Teacher Note to share how you incorporated it into your lesson.

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

  • Made with Math Contest

    Made with Math Contest
  • Multi-Discipline Contest

    Multi-Discipline Contest
  • Robotics Contest

    Robotics Contest

46 Discussions

None
VarunG54

Question 1 year ago

What should be the minimum amount time-span for clock pulse? I mean how much should be the minimum delayMicrosecond()?

None
SanketS34

Question 1 year ago

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.

None
aditianurhakim

1 year ago

tried with nema23
code is working

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

1 reply
None
meenakshinegi

1 year ago

tried with nema23

code not working

None
MaisY1

2 years 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

None
mardiaha

2 years ago

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?

None
bparker2

2 years ago

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.

None
SelvaK3

3 years ago

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

None
das1233444

3 years ago

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

6 replies
None
Idrispodas1233444

Reply 3 years ago

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.

None
das1233444Idrispo

Reply 3 years ago

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

None
Idrispodas1233444

Reply 3 years ago

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

None
OscarH45das1233444

Reply 3 years ago

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

None
Idrispodas1233444

Reply 3 years ago

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

None
onurturkmen

3 years ago

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