Categories

 

G-Wizard Calculator:
Fast, Easy, Reliable Feeds and Speeds

Subscribe

Join 50,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!

 

GCode is Complicated
G-Wizard Makes it Easy

Motion Control Boards Take Mach3 From Hobby Class to Industrial Grade, Part 1

Oct 3, 2016   //   by Bob Warfield   //   Blog, Products, Software, Techniques  //  20 Comments

Many a forum post has carried the derisive view that Mach3 can’t be an industrial grade control because you can’t build “industrial grade” on top of Microsoft Windows. The logic goes on to say that because Windows is not a real time operating system, it’ll never be able to do industrial grade work. There are various other arguments against Mach3, such as the idea that the servo closed loop isn’t accessible to Mach3, but the big issue is the real time operating system issue. How severe is this criticism of Mach3 and Windows?

It turns out the idea that an industrial grade CNC controller can’t be built on top of Windows is false. We know that because there are many successful industrial CNC controls that are built on Windows. Okuma’s THINC®-OSP control is Windows-based, for example.  They tout their resulting open architecture as a big advantage, and THINC-OSP even lets you install apps as a result of its Windows underpinnings.

okuma_think_osp

Okuma’s THINC®-OSP control is Windows-based…

Lest we think this is because machines are only recently powerful enough to allow Windows to work for CNC, let’s understand that building controllers on Windows is not even all that new an idea.  Consider the Siemens A2100 control, used on machines like the Cincinnati Arrow. Some say it was one of the best CNC controllers ever made, but whether you agree with that assessment or not, it was clearly an industrial grade controller, and it was based on Windows NT.

How did these CNC Controls manage to get great results despite Windows and what’s the deal with Mach3?

The key answer to getting industrial-grade CNC Control performance is that controls must separate the functions of low level motion control from the user interface and g-code interpreter. Look at a CNC controller as consisting of 3 layers:

CNC Controller Block Diagram

3 layers of function separation for CNC Controllers…

At the top level is the human interface, the part that talks to the operator through the control panel. The middle level is the g-code interpreter. Give it a block of g-code (uploaded by the User Interface through a USB key, serial feed, FTP, or other means), and it knows how to convert that g-code into simple motions.

Those simple motions go to the motion control portion of the program which is responsible for converting the simple motions into driver control signals. For example, if you want the machine to move to X0Y0Z0 and the machine is at X1Y0Z0, the X-axis has to move -1 to get to 0. Let’s say your machine moves in 0.0005″ steps. It then has to move 1 / 0.0005 = 2000 steps in the correct direction.

To accomplish that, the Motion Control portion of the Controller sends 2000 steps to the hardware driver for the servo or stepper motor on the X-axis.  At the same time, it must also control the direction line so the motor spins either clockwise or counterclockwise, as desired:

stepdir

Motion Control must generate step and direction pulses to send to the controller…

An additional wrinkle is that the faster we want the axis to move, the faster the 2000 pulses have to be sent to the step pin of the stepper or servo driver.  If we run Mach3 through a parallel port, it’s cheap and cheerful, but the faster the axis needs to move, the more we are expecting from the software.

Let’s look at how this works with vanilla Mach3, running with a parallel port. What that means is the Mach3 software must generate a smooth series of 2000 pulses on a parallel port pin to accomplish that motion. If we want to move at 100 IPM, which is not very fast by industrial standards, we have to produce those 2000 pulses in 0.6 seconds. For each pulse, we only have 0.0003 seconds to get the job done. Put another way, we need to move at 3,333 pulses per second. It turns out Mach3 can pulse up to 6 axes at whatever the kernel speed allows, but Mach has to do more than a few unnatural acts to pull that off.

Any minor interruption or distraction for the computer, may result in a brief pause between sets of the pulses. It turns out that Mach processes groups of buffered pulse requests. For example, it may have 5 requests that each ask for 0 to 5 pulses, depending on whether the axis is maintaining speed, slowing down, or accelerating. Lets say we have perhaps 25 pulses from 5 requests of 5 each. If, instead of getting a following on request for 25 pulses, that follow on is lost, it may take a whole new kernel timer cycle before the pulses are delivered.

In the meanwhile, it’s as though the lost cycle had instead been heard but requested the axis to slam on the breaks to 0 speed. On average, we got 25 pulses instead of 50, so we ran a lot slower, but the acceleration/deceleration makes it that much worse. Imagine trying to cut smoothly and with good surface finish if you command your cutter to move 1″ at 100 IPM, but at 2 points during the move it actually slows down to 33 IPM. Things are not quite that bad because we have inertia to smooth it out and the axis doesn’t start and stop instantaneously, but you can start to understand the problem here.

What causes such interruptions?

There are a myriad of things that can result in an interruption of the basic cycle.  Remember, we run Mach3 runs on a general purpose Windows PC.  The owner may have installed all sorts of other software on the machine. They might be running the MP3 player so they have music while they’re machining.

doomInstalling and running the wrong software on your Windows CNC machine can cause problems if the software interrupts the motion control functions of the CNC Controller software…

There are a number of factors that can cause one of these timer ticks to be disturbed including:

– Multimedia Software. I’m told Quicktime is a known offender.

– DMA. If your machine accesses disk too much, it interferes as the disk takes control of data transfer through a process called “Direct Memory Access”.

– Normal OS operations can also disable the interrupts involved from time to time.

– Lots of other kinds of software.

A so-called “real-time” operating system, which Windows is not, has the capacity to put out a “do not disturb” sign during critical operations. If it was making that 1″ move, it might very well want to be left alone to finish that task in perfect timing and at exactly the right speed.  Linux is sometimes touted as real-time, and therefore a better alternative.  It’s actually not a real-time OS either, it’s just closer to the ideal than Windows, and since so much less software will run on Linux, we’re much less tempted to put software that can interfere onto the machine.

For this reason, you frequently see recommendations not to connect a Mach3 PC to the Internet, not to allow any extraneous software onto the controller machine, and so on. This is a pity, because it is almost entirely due to the parallel port’s limitations and we can work around those as we shall see in a moment. Personally, I hate the idea of being cut off from the Internet in my shop. There’s just too much useful information to be had there that I can use in my work.

How do the Industrial Grade Controllers get around this problem?

The answer is pretty simple. They move those parts of the software that are sensitive to these timing issues to another piece of hardware. Imagine a configuration like this:

CNC Controller w/ PC and Motion Control Board

Now we have a separation of tasks that forms an assembly line. As the Windows PC finishes converting each g-code line to some sort of motion commands, it hands them off to the Motion Control Board and goes on to the next line. The Motion Control board is a piece of dedicated hardware whose sole purpose is converting motions to driver control signals. It can’t really be interrupted because it doesn’t do anything else, which is great in terms of providing smoother and higher speed motion.

The G-Code Interpreter is happier too. It takes a fair amount of machine cycles to produce all those motion control pulses smoothly. By handing that task off to another piece of hardware, the G-Code Interpreter finds more time to do a better job itself. Whether that’s simply processing g-codes faster, or using the time for more sophisticated “look-ahead” and trajectory planning is a function of the controller, but the important thing is that more time is available.

Having this 2-part architecture is the secret sauce in creating an industrial grade CNC control from Microsoft Windows. It isn’t the only secret sauce, but it is an extremely important starting point.

Is it hard to use a Motion Control Board with Mach3 instead of the Parallel Port? Is it worth it?

It turns out to be pretty easy to use a Motion Control Board with Mach3, and it is well worth the effort. In Part 2 of this series, we’ll take a look at some of the Motion Control Boards that are available and we’ll also talk about the results.

Note: I originally published this two-part series some time ago, and it has been hugely popular ever since.  I recently went through it and added a lot of new information and updates.  I am republishing so new folks will get a chance to see it and so folks that have already seen it can take advantage of all the new information.

 

Like what you read on CNCCookbook?

Join 50,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!

Rate this post

20 Comments

  • […] to read a random CNCCookbook post Motion Control Boards Take Mach3 From Hobby Class to Industrial Grade, Part 1 […]

  • […] to read a random CNCCookbook post Motion Control Boards Take Mach3 From Hobby Class to Industrial Grade, Part 1 […]

  • […]  And, they’re going to try to operate by generating pulses via the parallel port unless a separate hardware motion control solution is being used.  Mach3 uses a ring buffer which it fills with velocity commands for each axis. […]

  • […] you’re curious about how something like this helps, see my articles on motion control boards for use with Mach3. Share this:FacebookEmail [+] Share & Bookmark • Twitter • StumbleUpon […]

  • […] I am now doing very small almost micro-machining I am becoming more concerned about accuracy. Several articles in the CNCCookbook blog by Bob Warfield got me to thinking. Read both parts written by […]

  • […] Boards:  A two-part series on how to get your PC talking to your CNC machine.  My 2-part series on Motion Control boards was also extremely popular on the blog for extra […]

  • […] […]

  • […] port.  Above a certain pulse speed, it’s hard to get reliable motion unless you have a motion control board, such as a Smoothstepper. If this number is higher than what Mach3 reports as your maximum reliable parallel port speed, […]

  • My Citizen cnc swiss lathes use windows 98 as the user interface and program storage, and uses a Mitsubishi controller system to actually run the motors, etc.

    2 problems with this setup:

    1. I am locked in to both software and hardware.
    I cannot upgrade the software as it was written for Win98 exclusively and there is no upgrade path to later versions of windows.
    The hardware is also locked in, they come with a 486-100 Mhz processor and that cannot be upgraded.

    For interfacing to hardware, it is getting difficult to find an ethernet pcmcia card that has win 98 drivers, and it is getting harder to find techs to come and install them that are familiar with windows 98 networking. It predates most of their personal knowledge.

    2. Occasionally, I have had windows crash, and it is disconcerting for machine operators for the machine’s user interface to fail, giving a blue screen of death, or simply to lock up and stop taking keystrokes, while the Mitsubishi control in the background keeps making parts (and you cannot do anything to stop or start things save hitting emergency stop or powering off and rebooting.
    I have had this happen a couple times a year, so it is not often, but it is troubling to lose control of your cnc while it is running!

    I guess I’m making the point that industrial controllers that use windows are not the gold standard of reliability in industrial controls.

    • Skm, appreciate your input. Somebody, somewhere, seems to feel that no matter what the control is, it is not the gold standard of reliability for them. I can’t think of a control where I haven’t heard someone complain bitterly at one point or another. Every computer will crash at some point. Most of these proprietary controls are locked into some ancient legacy thing or other. Paying a zillion dollars for more memory (just a little more memory too) or an ethernet when it’s almost free on commodity hardware is another pet peeve.

      Cheers!

      BW

  • […] 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 […]

  • I’ve switched all of my Mach-powered machines to using the Ethernet SmoothStepper boards. It really does make a big difference in both the finish of the parts AND the speeds at which I can run to have the ESS in there as a buffer between a modern i7 and the router vs using a Pentium 4 with a parallel port. I’m limited by the phsyical characteristics of my router, now, rather than the speed of my computer.

  • Trying to run a motion controller on a PC with Windows or other OS made sense when PCs were the only available computer and cost $2,000. Today a Micro controller chip under $5.00 is all that is needed for the most controllers.

    When I looked at Mach3, it was not clear or idiot proof that there was an off board controller solution.
    I considered Mach4. It was clear that Mach 4 was designed for an off board controller. But all Mach4 offered at that time was a list of links through an obscure link … yes I do need things idiot proof …. The links led to vendors which seemed to expect me to read their minds about what their products did. Especially the Mesa products.
    Mach does not offer an integrated product and the success of Mach depends on other vendors whose success does not depend on Mach. Essentially 2 vendors who can pass problems off to the other vendor. I don’t want to chance time and money on this kind of business model.

    Since the two years I have been working on this project, I can now buy an integrated controller and control panel from China for $129 on sale. Only 4 Axis and only 50Hkz per axis. But it will do at that price and I have one each for my 2 mills. It is no ones clone and comes with a well written manual. SMC4-4-16A16B.

    For $250, from Slovenia, a 9 axis off board controller running 200Khz each axis with excellent software that handles spindle synchronization. The nicely written software will run on Linux under Wine.

    I am watching GRBL in the maker community inch forward but I am not rich enough with time for that kind of free. Same sentiments for LinuxCNC and the time I wasted hunting down proper legacy components.

    I am done with Windows marketing based operating system who has too much control of my computer even for non real time programs and I am done with anything to do with parallel ports.

    Currently moving forward at a nice pace having broken out of the box.

    • John, sooner or later something goes wrong with any controller. At that stage, you’re left with trying to figure out how to fix it yourself or trying to get help.

      I’ve been down the road a couple of times with low production brand new bleeding edge controller technologies. They sounded great, fantastic even. They were fairly priced, had the right people behind them, and seemed like the future. Both times I ran into trouble and couldn’t get the help I needed.

      The thing is, when the chips are down, there is no sustitute for a big community and a business that’s making enough money to stay afloat and keep improving the platform is also a positive.

      I worry about the cheap Chinese or Slovenian controllers. Heck, I worry a bit even about things like GRBL, though it is way better off in terms of maturity, it just lacks a fair bit of useful functionality compared to a Mach3 or a LinuxCNC.

      The past few years, Mach3 hasn’t had the best track record for improvement, but at least there are a lot of folks using it who can help with a diagnosis or workaround. I am very pleased with my PathPilot controls on my Tormach Mill and Lathe. If I was building a machine from scratch, I would try to use PathPilot or at least LinuxCNC for it, rather than a microcontroller or all-in-one board. You can buy plenty small PC’s too that are cheap and can run these things.

  • I understand how a motion controller offloads a lot of the work for running a CNC Mill but I am having trouble understanding how they work when used in conjunction with a lathe where you have a spindle sensor dictating the rate the steps should be generated. If the CNC software doesn’t know when to send the next pulse until after it has received a signal from the spindle sensor, how does it queue the commands up in the motion controller board? Do the motion controller boards accept the spindle signal directly and have the logic to clock the pulses out at the correct rate? If so, how do they handle things like spindle direction changes? If the CNC controller queued up a sequence for cutting a taper what happens when the spindle reverses?

    Thanks in advance, Brian

    • Brian, it all depends on the application, but you correctly identify a potential problem coordinating a motion controller with a spindle sensor. Depending on the motion controller, it may either have the task of syncing the two or that may happen pre-controller.

Leave a comment

 

Do you want to be a better CNC'er?

Get Better Tool Life, Surface Finish, and Material Removal Rates.

 

Start Now, It's Free!

Home

Software

  GW Calculator

  GW Editor

  Gearotic

  Conversational

  Deals and Steals

CNC Blog

  Software

  Techniques

  Beginner

  Cool

  Projects

 

Cookbooks

     Feeds and Speeds

     G-Code Tutorial

     CNC Machining & Manufacturing

     DIY CNC Cookbook

     CNC Dictionary

CNC Projects

Resources

     Machinist's Search

     Videos

     Online Groups

     Individuals

     Reference Data

     Books

     CNC Dictionary

     Suppliers

     Tool Brands

Workshop

     Hall of Fame

     Organization: Soon!

 

About

     Customers

     Partners

     Our History

     Privacy Policy

 
All material © 2016, CNCCookbook, Inc.