This is some documentation for my CNC motion control board.

4 Axis Stepper Motor Board Design Notes (Rev. A)

With each revision of my board I learn things to make the next version better. The previous revision C worked but was still overly complicated. This is where I keep my design notes as I make design decisions:

Homing
I will distinguish between two kinds of homing here -- accurate and approximate. Accurate homing is when you get the machine to exactly the same position within the positional accuracy of the machine. Approximate homing gets the machine to approximately the same position with some modest amount of positional error. Approximate accuracy can be acheived with a fairly simple homing switch on each axis. Accurate homing probably needs a more accurate homing switch and probably some sort of index mark on the axis motor. As I thought through the issues I came to the following conclusion -- neither accurate or approximate homing is worth the hassle of implementing. Accurate homing can be maintained by simply leaving the machine on and always reposition the machine under CNC control. If the machine is powered down, the CNC controlling software can remember where it was before power down and simply assume that it has not moved since. Hence, for this version of the system, there is no support for homing; just leave the machine powered up.
Limit Switches
There are two purposes for limit switches -- safety and homing. Limit switches can be used for approximate homing. My opinions on homing are discussed above; I do not think the effort of designing a system to use limit switches as an approximate homing system is worth the effort. There are two safety issues associated with limit switches -- human and machine safety. For machine safety, the purpose of tripping a safety switch is to protect the machine from damaging itself. For human safety, while the machine is potentially damaging itself, it might also be generating high speed projectiles that damage a nearby human. Other forms of tool failure can also generate high speed projectiles. The best solution for stopping high speed projecties is an enclosure. Given the relatively small machines being targeted here, I am going for a very simple strategy of removing power from the stepper motors, selenoids, and spindle motor. This can be done by wiring normally closed limit switches in series and detected when the circuit is broken by tripping a limit switch.
Emergency Stop
The purpose of emergency stop is to stop the machine from damaging 1) a person, 2) the machine itself, and 3) the work piece. Just like the limit switch strategy, I intend to have the emergency stop switch be wired in series with the limit switches. This is a simple and effective emergency stop strategy.
H-Bridge Selection
When it comes to choosing H-Bridge IC's, there are some hard choices to make. It is fairly easy to take 8 IRF640 MOSFET's and build a couple of very powerful H-Bridges that work in the 18 amp range. Since IRF64's are avaiable for about ~$.70/each, it is hard to justify spending much more than $6-$7 per axis. There are very few H-Bridge solutions at that price point. All I found were the A3977 and the good old L298. While I like the A3977, they do not have a very good selection of application notes. In particular, I could not really figure out how they wanted to deal with excess heat generation. Conversely, the L298's are quite easy, just slap a heat sink on. Maybe in some future revsion of this controller I will switch over the the A3977, but not for this revision. L298's are available from Jameco for $2.98. A heat sink specifically designed for the L298 Multiwatt-15 package is the 532-566010B34 available from Mouser.
Chopper Design
I want to support micro-stepping. While there are chips that help with micro-stepping they seem to be quite expensive (e.g. L6506). I eventually decided to just roll my own with a simple LM339 (Quad Comparator), some D type flip flops (74LS74), an 8-channel Digital to Analog converter (TLS5628CN), and a 40-pin microcontroller (PIC16F777-I/P).
Axis Connectors
I originally wanted to use DB-9 connectors for the axis connectors because they can be screwed in, but I am short of PCB edge space. The current thought is to use .8" wide DIN 5 connectors (a good suggestion from somebody on the net with a nom de plume of "ballendo".)
USB
Originally I wanted to support USB. I have punted on that due to a lack of board space. It is basically cheaper to purchase a USB to RS-232 converter than it is to try integrate one onto the board.
Spindle Motor
Being able to control a spindle motor seems like a good idea. The problem with spindle motors is that they operate in a significantly different power regime than the stepper motors on this board (i.e. fractional horse power motors.) I suspect that most spindle motor controllers At this point in time I have no intention of providing a spindle motor speed control on this board.
Parallel Port
The usefulness of being able to directly connect to a parallel port is extremely useful for debugging. The step and direction lines for the L298's can either be driven from the parallel port or from the microcontroller. To use the parallel port, the microcontroller is unplugged.
Schottky Diodes
I will be using the L6210 Schottky dioes from Digikey to save board space. I am concerned that the L6210 may not be in stock much longer.
Selenoids
There is no selenoid support for this board.
Probe
There is no probe support for this board.
VDC Power Supply
The power supply is assumed to be off-board. I am planning on a single 24-VAC at 12 amps transformer (Jameco: 221410), an full wave bridge rectifier (Jameco: 179477), and at lease one big 10,000 µF filter capacitor (Jameco: 157373), along with a power switch and fuse. A bleeder resistor and LED are on-board to discharge the capacitor after power off. The 24 volt transformer is measured in RMS and actually generates a peak-to-peak voltage of 34 volts minus bridge rectifier losses. While this is well less than the 48 volts system is capable of accepting, the hassle of adding another 10 volts is not really worth it. This may restrict the rapid moves by a little, but not significantly.
Enclosure Considerations
It seems quite important that the controller be designed to be stuffed into an enclosure. Since it is hard to find a premade enclosure that is "exactly" the right size, I am assuming the an over sized enclosure will be used. In this scenario, the controller board will have to live stuffed into a corner of the box with connections along two edges of the PCB that share a common corner. Since the controller board is EuroCard sized (100mm × 160mm) This gives me a total edge budget of 260mm. This not a lot of space to play with. I am currently planning on putting the parallel port connector (2.10") and the RS-232 connector (1.20") along the short edge. Since this adds up to 3.30", this leaves me with 0.40" of margin to leave between the connectors. Along the other edge, I need to put 4 stepper connectors, The 5-pin DIN connectors are .8" wide, so I should have plenty of margin left over on this edge.
Buffering
In order to use a serial line, it is necessary to provide some buffering to deal with bursts of pulse activity. Originally, I thought I could get by with a relatively small buffer (64 bytes) but after doing some simulated circular arcs, I discovered that needed significantly more buffering. I wound up needing a static RAM memory chip that is separate from the microcontroller. While 128K×8 is way overkill, there was very little to be gained from using a smaller chip (i.e. 32K×8). The Steps program is reponisible for converting RS-274 (G-Codes) into the requisite serial protocol.


Copyright (c) 2001-2005 by Wayne C. Gramlich. All rights reserved.