In this article I will describe how I built stepper motor drivers for about $10USD a piece. Included will be a complete schematic, a sample board layout, and links to YouTube videos of the driver running under clock and computer control.
A few specs for the device:
- 2.5 amps per phase
- 24V operation
- no load speed in excess of 2,500 RPM
- microstepping modes
- low total parts count per driver
- reliable optical isolation
If you build these drivers I would appreciate it if you left feedback in the comments section so we all may benefit from your experience.
Step 1: Schematic
This is the schematic for my drive. A full sized file can be found at:
Step 2: Board
This is the board layout I came up with. I wasn't planning on etching it, I only needed parts on a board. I print this out, tape it to a piece of board, drill it, put parts in, then solder them point to point. When I design stuff I keep in mind that I have to make it too so I try to design things I am capable of making. Making this is a little tricky but it can be done. It works too, and I know no one is going to rip my design off for commercial exploitation. Good luck making these in quantity! I made three and that was enough for me for a while.
Link to full sized file:
Pop Quiz: Can anyone see what label is wrong with this? Compare to this:
At least I think that one is right now.
Step 3: Parts
The main component of this circuit is the Toshiba TB6560AHQ Stepper Motor Driver IC. I got mine at Mouser I think it was for $4.79 each. Apparently since I got mine the price has dropped even lower to $4.20 a piece.
These are brilliant little chips. You don't have to mess with surface mount, you can put a heatsink on it easily, they do everything you can possibly ask for with a hobby CNC stepper motor driver. Check out the datasheet:
The next part of note is the optical isolators. I used Toshiba TLP521-2 because I found them for cheap someplace and they had specs I liked. I'm sure any dual optoisolator will do just fine in its place though. Just make sure your pinout matches it, or adjust your board layout accordingly.
Finally I used a 74LS14 as a buffer to square up my signals because optoisolators can be a little sloppy in that department. My driver board also has its own on board voltage regulator a 7805. I include reverse bias diodes because I have loads of diodes and they never hurt to have. If you want you can skip the diodes by the voltage regulator. Everything else on the board is a passive device, resistors, capacitors, DIP switches, you don't need the LEDs but I would have had to have tied off those unused gates if I didn't include them anyways so I threw them on there.
There are two components I would like to make special mention of on my drivers, the current sense resistors, R5 and R6. You will note there is no value given for those on the schematic because what you use depends on what motor you plan on running off the driver. The formula for determining the proper value for your resistors can be found in the Toshiba datasheet for the TB6560AHQ driver IC on page 10 section 6. Try to use non-inductive resistors for these as well. You will likely pay through the nose getting the right parts for this, more than the IC itself cost! So pay special attention when selecting these for your drivers. I'm using .25 ohm resistors to get me 2 amps per phase current. But you're going to have to figure out what you need for your motor.
Step 4: It's a runner!
Here are a couple videos of my stepper motor driver going. In the first video I am using a 555 timer to generate clock pulses I feed directly into the step input of the driver. I turn it up until the motor stalls at high speed. Just something stepper motors all do.
I don't know if you could tell or not by just watching the video but it was screaming! Then it jumped up right before the video ended when it rotor locked. That motor weighs a couple of pounds too it is like a brick. All well and good if you want to make say a fan with your stepper motor but lets operate it under computer control now shall we?
In this video the motor will reverse over and over using a fast sloped clock at 800 RPM:
That is about what you can expect to drive your CNC machine at using this driver. maybe a little slower, maybe a little faster, it'd depend on the mechanics of your machine. That folks is what its all about!
The software I'm using to control the motor is called EMC2 and you can get it for free here:
There is none better.
In the future if there is any interest I may put up an article about my port buffer board seen to the right in the attached image. I am also planning on documenting the power supply I run my CNC project with. Though you can use whatever power supply you like. You really can't run these drivers directly from a parallel port because they need more signal current than you can get out of most PC parallel ports.
I'm sure I left out a million little details in my article but that is what the comments section is for. You're starting out with a lot more than I had with just what I've posted already. I went through a lot of trouble experimenting in order to get this circuit to perform as well as it does by looking the second image attached to this page. Also I have not implemented every possible feature of this device as I wanted to keep it simple to make. More can be done!
Really all you should need is the schematic diagram I am providing in order to build this project. I've built three drivers myself and they each run great. If you build this and it really isn't working well for you make sure your signal and power grounds on the TB6560AHQ are not connected directly to one and another but come off of the electrolytic decoupling capacitors C4, C5 and C6. That is what they are there for. They soak up all the noise the stepper motors make when they run so that noise does not propagate and interfere with your control signals.
I had that problem myself with one of my drivers and it took me quite some time to figure it out. I know on the schematic all the grounds are running together but you cannot physically make this circuit that way or it WILL NOT WORK!
Good luck if you decide to make this driver for yourself. Although if you look closely at the picture of my breadboard you may decide I don't count on luck so much with that copper scatter plate I have attached to the TB6560 there. Ha! These devices do have a reputation for blowing up. I am not sure sure if it is well deserved though, as none have self destructed on me yet.
Do it right, use your head, and it should all work for you too. It works here.