Fig. 1 TB6600 Stepper Motor Driver with Arduino schematic.
TB6600 Stepper Motor Driver with Arduino
by Lewis Loflin
- Youtube Videos:
- Pt. 1 TB6600 Stepper Motor Driver with Arduino
- Pt. 2 Program TB6600 Stepper Motor Driver with Arduino
Also see Operation TB6600 Stepper Controller with PC Parallel Port.
TB6600 is a CNC Single Axis, 0.2-5A Two Phase Hybrid Stepper Motor Driver Control module.
The device has three optocoupler inputs that require 8-15mA. I connected mine as shown in Fig. 1. The Arduino program is shown below.
What causes confusion is the "EN" connection. To quote the manual:
Note: When "EN" is in the valid state, the motor is in a free states (Off-line mode). In this mode, you can adjust the motor shaft position manually. When "EN" is in the invalid state, the motor will be in an automatic control mode.
It never defined what "valid" or "invalid" means.
Further down the manual we get this:
If you turn on the Off-line function, the motor will enter a free state. You can adjust the motor shaft freely, and the pulse signal will be no response. If you turn it off, it will be back into automatic control mode
Note: Generally, EN terminal is not connected.
This is nonsense. If EN is not connected or (LOW) if connected the motor is locked at all times unless stepping! The motor gets HOT!
I wrote my program with this in mind. "EN" is connected in my circuit. "EN" is turned on unless I have a reason to lock the motor.
The original program was programmed for 100 R.P.M. or 20,000 steps per minute. The motor was 1.8 degrees per step or 200 steps for 360 degree rotation.
The step delay is 3.3 mSec. or 3300 uSec. My particular test motor requires minimum 2 mSec. or it stalls.
Fig. 2 TB6600 Stepper Motor Driver case.
Arduino Code
// if ENA is LOW motor is locked at last position // this can lead to overheating of motor // program assumes common cathode connection #define SW1 2 #define SW2 3 #define SW3 4 #define DIR 5 #define PUL 6 #define ENA 7 // HIGH disables motor power #define CW 1 #define CCW 0 // indicates motor is on // this is built in LED on DP13. #define motorOn 13 // sets how many pulses for 360 degrees #define rot360 200 // HIGH on PUL will keep motor locked in position // note motor will get hot after some time. int x, y; // this sets the motor speed int pulseDelay = 3300; // in uSec. void setup() { // DP13 LED pinMode(motorOn, OUTPUT); digitalWrite(motorOn, LOW); pinMode(SW1, INPUT_PULLUP); pinMode(SW2, INPUT_PULLUP); pinMode(SW3, INPUT_PULLUP); pinMode(DIR, OUTPUT); digitalWrite(DIR, LOW); pinMode(PUL, OUTPUT); digitalWrite(PUL, LOW); pinMode(ENA, OUTPUT); digitalWrite(ENA, HIGH); } void loop() { // manual CW when pushed while (digitalRead(SW1) == 0) { digitalWrite(motorOn, HIGH); // motor LED On digitalWrite(ENA, LOW); // enable motor power digitalWrite(DIR, CW); digitalWrite(PUL, 1); digitalWrite(PUL, 0); delayMicroseconds(pulseDelay * 2); } // end while // manual CCW when pushed while (digitalRead(SW2) == 0) { digitalWrite(motorOn, HIGH); // motor LED On digitalWrite(ENA, LOW); // enable motor power digitalWrite(DIR, CCW); digitalWrite(PUL, 1); digitalWrite(PUL, 0); delayMicroseconds(pulseDelay * 2); } // end while if (digitalRead(SW1) && digitalRead(SW2)) digitalWrite(motorOn, LOW); if (digitalRead(SW3) == 0) { lockMotor(); } else { unlockMotor(); } delay(100); } // end loop void motorRun(int count, byte dir_local ) { digitalWrite(motorOn, HIGH); // DP13 LED digitalWrite(ENA, LOW); // motor power ON digitalWrite(DIR, dir_local); count = count * rot360; for (int x = 0; x < count; x++) { digitalWrite(PUL, 1); digitalWrite(PUL, 0); delayMicroseconds(pulseDelay); } // end for digitalWrite(ENA, HIGH); // motor power OFF digitalWrite(motorOn, LOW); } void lockMotor(void) { digitalWrite(motorOn, HIGH); digitalWrite(ENA, LOW); } void unlockMotor(void) { digitalWrite(ENA, HIGH); } /* Ex. motorRun(10, CW); motorRun(10, CCW); motorRun(100, CW); motorRun(50, CCW); motorRun(50, CCW); */
- MOSFET-Transistor Drivers with TC4420 and TC4429, IGBTs, etc.
- Introduction TC4420-TC4429 MOSFET Drivers
- Use TC4420 MOSFET Driver for Simple H-Bridge Circuit
- TC4420 MOSFET Driver Various Circuits
- TC4420 MOSFET Driver Replacement Circuits
- Test Power MOSFET Transistors, IGBTs
- Insulated Gate Bipolar Transistor IGBT Circuits
- Issues on Connecting MOSFETs in Parallel
- TC4420 MOSFET Driver Replacement Circuits
- TB6600 Stepper Motor Driver with Arduino
- Interfacing Microcontrollers to CMOS and MOSFET Circuits
- Simplified CMOS-MOSFET H-Bridge Circuit
- Tri-State H-Bridge using CD4093B CMOS Circuit
- Common Collector Opto-Isolated Bipolar Transistor Switches
- Compare 2N3055 MJE10005 Transistor Power Switches
- Connecting PCF8574P GPIO Expander to Raspberry Pi
- Programming PCF8574P 8-bit I-O Expander with Arduino
- DS1307 RTC with a CD4040 as a Precision Time Base
- CD4040 12-stage Binary Counter with DS1307 RTC Time Base
- Off Site:
- Web Master
- Tri-Cities VA-TN
- General Science
- Hobby Electronics
- US Constitution
- Christianity 101
- Religious Themes
© Copyright 2019 Lewis Loflin E-Mail