I’m fascinated by motor drivers, and stepper motors in particular. There is just something so awesome about a modular little unit that will allow you to control a motor. As the motors get bigger, the awesomeness increases.

Lately I’ve been looking at high powered driver chips as part of a plan to build a CNC machine. Toshiba makes some great chips. The TB6560 is the ‘classic’ driver chip they make: 1/16th step, 4amps, and >30 volts. Unfortunately it has some flaws with power sequencing that causes it to blow up if you don’t turn VCC on before VMOT.

They’ve since released a few new driver chips. I designed a board around the beefy THB6064AH. This chip is pretty badass as its a 4.5A, 1/64th step, 50V beast. This thing will do some damage with the right motor. Unfortunately I’ve been struggling with the design. You can find it on Github.

Lately I’ve discovered an even more awesome chip! The THB7128. Not only is it cheaper than the THB6064AH, but it does 1/128th stepping. The internet doesn’t have a ton of info. This appears to be a new chip on the market. This should make for extremely smooth operation. The only real downside is that it maxes out at 3A instead of 4.5A. Most of my motors are <3A so that shouldn't be a problem. I've ordered a demo board to test it out.

With my new design in hand, I ordered the boards + a new test fixture and got cracking. I used my Stencil8 setup to make 6 beautiful prototypes and a test fixture to go with it. Then things started to go wrong.

The Ugly Details of How I Messed Up

First, I messed up the connector on the test fixture. Basically it was mirrored, so I had to solder on the headers on the back side. That just generally made things awkward. Always do a reality check before purchasing boards!!!! Your printer and some cardboard (or old pcbs) are your friends.

Second, I messed up a couple traces on the PCB. Nothing major, but things like the relay enable lines for 5V and VMOT being the same weren’t cool. Easy enough to fix with some jumper wires. The good news is the relays fired up first try, and the current measuring works as expected. I’ll do a writeup of this new and improved test fixture soon.

Third, and here’s where the trouble really started: I had no idea how to design for these higher power drivers. I knew about the sense resistors, and what value to make… but not what wattage. I knew they needed fast response diodes, but nothing more than that.

One very real problem I had was using too small of resistors. I never really quite grokked how to select current sense resistors for stepper motor drivers that need them. It’s actually very simple! Your driver is rated for a given current (say 4 amps). The datasheet will typically recommend a resistor value, as well as a formula for current based on a VREF. From that, it is easy to determine the ohm rating of your resistor (for the THB6064AH, its 0.22ohm). What they don’t say (and this is probably obvious to a real electrical engineer) is that the WATTAGE of the resistor can be calculated by W = I^2*R. In this case, 4*4*.22 = 3.2W. That pretty much rules out SMT resistors like I was using. Instead, you’ll need to use ceramic resistor. These resistors come in different sizes, but 5W is probably a safe bet. The next lowest is 3W which is less than the max required wattacge.

Fourth, and this is the main problem that I bashed my head into for 2 days in a row: The THB6064H is NOT THE SAME as the THB6064AH. I somehow purchased the THB6064H chips while designing for the THb6064AH. Of course this results in completely unpredictable operation that was so tantalizingly close that I *just knew* it had to be something in my circuit. Turns out, it was just me being an idiot.

Ultimately, this was a very frustrating but enlightening problem. I bashed my head at almost every single problem – both perceived and real. I did find some real issues, but the ultimate problem was one that I had completely overlooked. In the process I used the scope on just about every single pin, verified the test fixture, and just generally went over it with a fine toothed comb. I also learned a ton about the workings of the diode bridge, the current sense resistors, the resistors that control the oscillator, etc. I wish I had gotten it in one, but hey… thats life!