Our first article in this series discussed how using Windows to solve all of the CNC Controller problem suffers because Windows is not a real time operating system. Simply put, if the task of sending motion control signals (step + direction pulses) to the motor driver hardware is interrupted, we have problems. Those signals get interrupted by a variety of distractions the machine may have ranging from other software running on the machine besides the CNC controller to energy saving software that kicks in to slow the processor to a variety of other issues.

What happens we don’t give the stepper or servo driver a clean stream of pulses?

poorlyrunningcar

Giving the motor drivers a pulse stream full of stops and starts is like driving a car with a clogged fuel filter that bucks and balks when you try to get crisp acceleration.

Think about the delays in the pulse train as introducing large arbitrary amounts of deceleration and acceleration into the motion of the axis. Whenever a step pulse is delayed, you get a big deceleration. When it shows up again, the axis must accelerate. This is tremendously wasteful of the motor’s torque, is far from ideal as a way to drive a cutter through material, and generally gums up the works.

What’s the impact of such problems?

Tormach has quantified the magnitude of these problems pretty nicely in one of their many excellent engineering articles. They use the Mach3-provided utility DRIVERTEST.EXE (comes with Mach3) to determine how stable a particular PC configuration is for driving a CNC machine.

Using DRIVERTEST.EXE, they measured performance of a 2.2 GHz Dell Optiplex 330. That machine exhibited an interrupt variation (variance from desired timing) of 14 microseconds. After substituting another computer that had a 2 microsecond variance, the machine went from being able to move the heavy Z-axis at 185 IPM to 245 IPM, graphic evidence of the amount of impact this sort of thing can have. Ironically, the machine with the 2 microsecond variance was actually a much slower CPU, it just had been more carefully configured to eliminate potential timing distractions.

Note: The astute reader will know that Tormach eventually abandoned Mach3 entirely, and now ships PathPilot, which is based on LinuxCNC. It’s interesting to note that they choose to include a Mesa Motion Control card with the new configuration too.  I will talk more about LinuxCNC and motion control shortly, but for now, I just want you to be aware of this change so I can finish going over the benefits of Motion Control Boards for Windows and Mach.

Wow, I see the problem.  Now how do we fix it?

Plan A: Can we eliminate the distractions for Windows through Software configuration?

horse-blinders1

Plan A: Eliminate Distractions.  Not optimal, but better than nothing!

One school holds that the best way to eliminate the distractions for Windows that leads to these timing variations is to strip down the machine and software to where there’s nothing left but the Mach3 control software and Windows. If we eliminate the possibility of other software introducing distractions, we greatly increase the reliability of the machine.

This approach works to a certain extent, but it is still not optimal when compared to hardware motion control boards and it limits the potential of the controller machine. Users wind up disconnecting their machines from the Internet and crippling them until they become little more than Mach3 appliances. That’s a shame when there are so many useful resources on the Internet, and so much other software you might like to run than just Mach3 on your shop machine.

Another problem, pointed out to me by Henrik Olsson (thanks Henrik!) is “jitter”. Suppose we have a Mach3 kernel frequency of 20 KHz. We are reminded to send pulses every 20 KHz, assuming nothing interferes with our timing (and as we have seen, interference is a real possibility). What if the motion we’re commanding requires 23 KHz instead of 20 KHz?

The exact kernel frequency leads to a sort of “rounding off” or approximation of the pulses, because we can only send them to the accuracy of the kernel frequency. This causes subtle effects that for the most part are probably only of industry to industrial quality work, but they’re still an issue.

Interestingly, EMC2, which uses a real-time modified Linux kernel to reduce these “distraction” problems, runs at even lower kernel frequencies than Mach3 for a given machine, so is even more subject to jitter.

Still, if you insist on running through the parallel port, you should stick to a very minimal configuration for best results. You should also keep your axis motion dialed down fairly slow, so not very many pulses are needed to move the axes around.

Plan B: Add a Motion Control Board

fastcar

Instead of Blinders, we could help Windows out with a Motion Control Board…

The more direct solution is the one we brought up in the first article: add a Motion Control Board to Mach3. This offloads the most finicky timing aspects to dedicated hardware that can do a far better job than the software versions ever will.

To get an idea, the pulse capabilities of a PC running Windows fall in the 20 KHz to 100Khz range. In other words, pulses for all axes cannot exceed 100,000 per second, and that’s under the best possible (almost theoretical) conditions.

The equivalent number for one of the cheaper Motion Control Boards, a Smoothstepper, is 4 MHz, or 4 million pulses per second. That’s 40x faster–no wonder you get so much better results!

smoothstepper

A basic motion control card, like a Smoothstepper, can generate pulses 40x faster than most Windows parallel ports…

Let’s play with the math a little bit and see what this means.

Suppose we want a positioning accuracy per step of one tenth, or 0.0001″. If we want to be able to move at 100 IPM, that means we need 100 / 0.0001 or 1 million pulses a minute. That’s about 16,000 pulses a second, theoretically its within Mach3’s range, but is it within the range of error if Windows gets distracted? 16 KHz yields a 60 microsecond pulse interval. On the aforementioned Dell that Tormach was testing, they saw 14 microsecond variations, or about 23%. That’s really too much for smooth accurate motion–we’d prefer to see more like a 5% variation or less.

It is fortunate indeed that this problem does not becomes additive with the number of axes in motion. To interpolate a hole requires 2 axes moving in concert. To do that at 100 IPM requires 2 x the pulserate. A really fancy 3D profiling job is even worse, because you may need 3 axes moving in concert. Mach3 is able to trigger up to 6 axes at once, so the number of axes doesn’t create additional problems in the pulser.

These problems get steadily worse as we ask for the axes to move faster. Consider a machine like a Haas TM-1. Rapids speeds for this inexpensive VMC are 200 IPM–2 times faster than our example. Now we’ll need a 32 KHz kernel speed instead of 16 KHz, which starts to be pretty hard to do with Mach3.

The Smoothstepper’s 4 MHz rate means it can handle that with 100,000 / 4,000,000 or 2.5% accuracy–that’s about right for an industrial grade application.

You Can See the Difference

I hope you’re getting the idea that these Motion Control boards can provide a noticeable improvement in CNC performance. If you’re the sort of person who wants to run servos instead of steppers on your CNC for the performance, you certainly will want to run a Motion Control Board as well.

The difference in performance and surface finish is noticeable. In fact, depending on what you’re doing, you may not even be able to do it without a Motion Control Board. For example, our article on building a low-cost high-accuracy milling machine for micro-milling revealed they were unable to get clean features from Mach3 when running the parallel port. To fix the problem, they switched to Flashcut, which uses hardware motion control coupled with their proprietary (but Windows-based) control software to do the job.

Note that this will also affect the allowable feeds and speeds if you’re pushing the envelope. HSM (high speed machining) constant tool engagement angle toolpaths rely on the idea that the load on the cutter is constant–there are no “shocks” such as we find with conventional toolpaths as they plough into corners.

There is software out there that will fit arcs to a series of short line segments in your g-code to provide another form of smoothing. Running a cutter is not unlike running a race car on a track. The better drivers soon learn that any input takes away from the adhesion available from the tires. Slowing down in a turn at the wrong point can spin the car just as surely as accelerating too much or entering the turn with too much speed.

When your cut is unpredictably changing the feedrate by as much as 25% in a truly worst case scenario, it’s very hard to run that cutter close to its limits.

How Do I Install One of These Controllers?

Good news here: it’s pretty easy. I have used a Smoothstepper, for example. You plug it into the USB port or Ethernet (depending on which version you’ve purchased), tell Mach3 you’re using it, and then it simulates 3 parallel ports which you can connect to motor drivers (Geckos or other) in the usual way. For $155 – $180, you’re off and running with dramatically improved performance.

I ran my Smoothstepper rig using an old slow laptop.  I ran the Internet and all sorts of other software on that old laptop, and Mach3 cut great on my machine–no struggle at all. I could even play my MP3’s so there’s a little music to offset the music of chip making.

The key is to find a Motion Control Board that’s already setup for your control software. Check out the directions on these boards, they’re usually pretty simple to get running, and different boards have a range of functions available.

Going back to our 3 layer diagram, some boards incorporate the g-code interpreter layer on the board as well.

Motion Board Links for Mach3 Compatible Boards:

Dynomotion KFLOP

Dynomotion: KLFLOP motion control board has powerful DSP capabilities on board.  It also has its own GCode interpreter so you need not use Mach3, or you can use their plugin and run with Mach3.

smoothstepper

Warp9TD: Smoothstepper motion control board.

CNCDrive: UC100.  This neat looking little gizmo plugs into your breakout board as if it was a parallel port.  But the PC connects via USB.  They have a plugin for Mach3 as well.  I don’t know much about it, but love the idea and simplicity!  They also have versions with more capability that are boards more like the Smoothstepper.

galil

Galil: Galil motion control boards have been around a long time, have available Mach3 plugins, and are higher end alternatives.  I’ve personally seen a Galil card work well with Mach3 to make molds for a carbon fiber project.  Be sure to check Galil’s application notes to see which of their products are Mach3 compatible.

Coming Soon:  I’ll be doing a 3rd installment in this series to discuss Motion Controllers for LinuxCNC and also single board CNC Controllers.  Sign up below for our Weekly CNC Newsletter so you won’t miss the new installment and to get some really useful CNC resources that only go to our subscribers.

 

Like what you read on CNCCookbook?

Join 100,000+ CNC'ers!  Get our latest blog posts delivered straight to your email inbox once a week for free. Plus, we’ll give you access to some great CNC reference materials including:

  • Our Big List of over 200 CNC Tips and Techniques
  • Our Free GCode Programming Basics Course
  • And more!

Just enter your name and email address below:

Full Name
Email *
100% Privacy: We will never Spam you!

Motion Control Boards Take Mach3 From Hobby Class to Industrial Grade, Part 2
5 (100%) 2 vote[s]