Introduction: THB6064AH Nema 23 Motor Driver
The THB6064AH chip can be used to drive a nema 23 stepper motor using the commands from an Arduino. This instructable depicts the assembly of a version 1.1 Massmind 6064 stepper motor kit.
Step 1: Set Up
Take stock of the components. In addition to what you see in the picture, a heat-sink, thermal paste, solder, soldering gun, magnifying glass, bright lamp, clamp, various pliers, drill, drill bit, and 3 screws are also required.
Step 2: Soldering
Secure the pcb in a clamp and plan the order that you will solder the components. Start with the two surface mounted R200s and test pins at VREF and GND. Next solder the LEDs, the small resistors, the small capacitors, the network resistors, potentiometer, medium capacitor, jumpers, terminal block, then the shrouded header. In general I started with the smallest components and progressively worked towards the largest ones. At this point align the THB6064AH pins on their respective solder points and ensure the chip is also aligned appropriately relative to the three mounting holes on your heatsink. After soldering the chip then bend the legs of the big capacitor and solder it in last.
Notes:
Be mindful of the placement of the resistors and the LEDs - they can be easy to confuse. It is advisable to use a multimeter to test all of the resistors prior to soldering them. I found it useful to create a mockup of the resistor placements prior to soldering them.
The IC will generate some heat when the motor driver is being used. The heat is disipated with a heat-sink. The THB6064AH will have to lie flat with respect to the heat-sink surface so align the IC and then drill holes in the heat-sink before soldering the IC to the PCB. I found it necessary to use a few thin spacers between the pcb and the heatsink to maintain good alignment. Three screw holes need to be drilled into the heat-sink. One hole to mount the pcb and two holes to mount the IC.
Apply a thin coat of thermal paste between the THB6064AH and the heat-sink. Secure the IC with screws.
Step 3: Connecting the PCB to Your Ramps Board.
The version 1.4 ramps board has 5 carriers for the Allegro Pololu A4988 stepper driver. Each of these drivers uses 16 pins but the THB6064AH only needs 4 pins: Step, Dir, VDD and GND. I made a small PCB that sits where an A4988 normally does but just makes the pins accessable so that I could easily and securely run a cable to the THB6064AH board.
The Driver can also be connected directly to an arduino. If you want to run it this way here is a simple test sketch for the arduino.
/*
Date: Nov 16 2015 Build: 0.0.1c
Title: Stepper_Test_02
*/
Variable declarations int stepPin8 = 8;
int dirPin9 = 9; int minDelay = 100;
int maxDelay = 2000;
boolean rotation = LOW; //low = cw, high = ccw
void setup() {
// initialize pin input and output
pinMode(stepPin8, OUTPUT);
pinMode(dirPin9, OUTPUT);
digitalWrite(stepPin8, LOW);
digitalWrite(dirPin9, LOW);
}
void loop() {
for (int speedUpDelay = maxDelay; speedUpDelay > minDelay; speedUpDelay--)
//reduce the delay to increase the rate of rotation
{ digitalWrite(stepPin8, HIGH);
delayMicroseconds (speedUpDelay);
digitalWrite(stepPin8, LOW);
delayMicroseconds (speedUpDelay); }
for (int fullRotation = 25600; fullRotation > 0; fullRotation --) // 25600 = 1/16 stepping mode
{ digitalWrite (stepPin8, HIGH);
delayMicroseconds (minDelay);
digitalWrite(stepPin8, LOW);
delayMicroseconds (minDelay); }
for (int slowDownDelay = minDelay; slowDownDelay < maxDelay; slowDownDelay++) // increase delay to decrease rate of rotation
{ digitalWrite(stepPin8, HIGH);
delayMicroseconds (slowDownDelay);
digitalWrite(stepPin8, LOW);
delayMicroseconds (slowDownDelay); }
rotation = !rotation;
digitalWrite (dirPin9, rotation);
}
Step 4: Testing the Driver.
1a.) Connect the stepper motor to the driver. (In my case I pluged Blue to B-, Red to B+, Green to A-, and Black to A+.)
1b.) Connect a 24V 3A power source to the driver's M+ and motor GND. Don't power up the 24V supply yet.
2.) Connect your driver to your arduino. I used an Arduino Micro without any kind of shield.
2a.) I plugged the driver's +5V to a 5V power souce (I used a usb cable attached to an old keyboard encoder but you could use any +5V source)
2b.) I plugged the driver's ground into the usb source's ground.
2c.) Connect pin 8 from the arduino to Step on the driver.
2d.) Connect pin 9 from the arduino to Dir on the driver.
3.) Plug your arduino into your computer and upload the test program
4.) Turn on your 24V power supply.
Step 5: Extra Precautions
If you intend to place the driver in an enclosed space you may choose to enhance the cooling capacity of the unit by adding a fan. Pictured here is a 12 volt case fan screwed onto the heatsink.