loading

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

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
<p>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.</p>
<p>Thanks, even though it's late but you didn't hesitate to reply.This is my project</p>
<p>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.</p>
<p>Thanks :)</p>
<p>Gut </p>
Which means 17 stepper motor is suitable for 3D printer.
<p>how do i connect the arduino to the potentiometer?what is the potentiometer rating used?</p>
<p>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. </p>
<p>thank u...and another thing is that can you share the program ?the provided program during compilation producing error.</p>
<p>the code should work easily, simply change delayMicroseconds(100) to delayMicroseconds(analogRead(A0)) ... if you use analog pin A0 and so on</p>
<p>thank u idrispo. It is working now.:)</p>
<p>Hey&hellip; I have the same problem, but i can&rsquo;t fix it&hellip; could you share the code?</p>
<p>i'm glad that i could help you. My pleasure to hear that</p>
<p>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 </p>
<p>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?</p>
<p>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? </p>
<p>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.</p><p>Thanks</p><p>void setup() {</p><p> // put your setup code here, to run once:</p><p>pinMode(8, OUTPUT);</p><p>pinMode(9, OUTPUT);</p><p>digitalWrite(8, LOW);</p><p>digitalWrite(9, LOW);</p><p> digitalWrite(8, HIGH); </p><p>}</p><p>void loop() {</p><p> // put your main code here, to run repeatedly:</p><p> digitalWrite(9, HIGH);</p><p>delayMicroseconds(100);</p><p>digitalWrite(9, LOW);</p><p>delayMicroseconds(100);</p><p>}</p>
Please check whether it is full step or not?
<p>good job!</p><p>what is &quot;decay setting&quot; in Switch mode tb6560?</p>
<p>sorry, don't know what decay setting.. maybe you talk about delaymicroseconds</p>
<p>any one know how to wir this with arduino and use GRBL </p><p>this board tb6560 4axis</p>
<p>sorry, i never try. </p>
<p>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 </p>
<p>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</p>
<p>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?</p>
<p>try cek CW+ and CW- connection</p>
How do u know your motor do not suport full and half step.
<p>IT ACTUALLY SUPPORT FULL AND HALF STEP, THE ONLY PROBLEM PROBABLY THE POWER SUPPLY OR THE WRONG VALUE OF DELAYMICROSECONDS</p>
<p>Hello!<br>Thanks for the tutorial : )<br><br>I've been trying to control a Stepper with a TB6560 but my driver is slightly different from what I've found around</p><p>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</p><p>Thanks again!</p><p><br>Take care,<br>Rafael</p>
I'm pretty sure that each of this have another pair. Please check again
<p>ssraf</p><p>Pul-........................... some input 8,9 or6</p><p>Dir-............................ some input 9, 8 or 7</p><p>V+.............................. arduino 5V+</p><p>that is all you need</p><p>it works with mine board same as yours</p>
Good!!
<p>excuse me ,</p><p>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?</p>
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.<br>
<p>thank!</p>
<p>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.??</p><p>plz reply..</p>
<p>How can I add momentary switches to control say 10 or more programed stops..like 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...</p>
<p>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.</p><p>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.</p><p>With this kind of tutorial, you can have have your own CNC machine!!!.</p><p>Hope this answer your question.</p>
Excuse my ignorance but what would you use this for? (I'm trying to increase my technological knowledge.)
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.<br>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.<br>

About This Instructable

118,674views

82favorites

License:

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