CNCCookbook: Be a Better CNC'er


Steppers, Servos, and Backlash Simulator

If you've done some reading and perhaps looked over my CNC Dictionary, you have at least an intellectual idea of the concepts of steppers, servos, backlash, closed loop, and open loop operation. You will have heard that backlash is very bad, and that a closed loop or servo system is much better than an open loop or stepper based system for CNC. What's lacking is an intuitive feel for why? Or, how bad is it really? What will happen if I choose a stepper based open loop system with lots of backlash?

In order to answer those questions, I developed a simulator in Excel that may be used to explore the concepts. The spreadsheet model is pretty simple. It assumes you want to command the machine to cut a circle. I chose the circle because they're inherently a bit of a torture test for this problem because the axes change direction as you move around the circle.

If you'd like to play with the model, download by clicking here. I have samples and conclusions below if you don't want to take the time to play with it yourself.

There is a set of parameters you may enter:

- Circle Diameter, in inches. Pretty self-explanatory, but I like to do 1" or smaller circles because the errors are "blown up" in the graphs, which display larger than 1".

- X and Y Backlash, in inches. Enter the amount of backlash in your system. Check the CNC Dictionary to see what backlash is and how to measure it.

- % Errors: The circle is simulated as 360 commanded moves, or 1 degree around the circumference for each commanded move. % Errors determines what percentage of the time these moves will be ignored due to lost steps or problems in the machine other than backlash. Take a look under "Lost Steps" in the CNC Dictionary to see what some potential sources of these errors are, and be aware that a servo system is capable of "catching up" with the errors again. Note that a lost step occurs in both axes at once, which makes the result unusually symmetrical. It is not realistic--each axis should have had an independent error simulation, but it serves for the educational purposes this simulator is intended for. Another source of inaccuracy in the model is that the lost steps are truly random. In a real machine, once you lose a step, the probability of losing an adjacent step is much higher (perhaps resistance at that point on that axis is unusually high for some reason), so the errors will tend to "clump". Again, this hardly matters for educational purposes.

- Servo Catchup Speed: The Servo Catchup Speed is a crude way of measuring how much of the following error (See "Following Error" in the CNC Dictionary!) can be eliminated in each step. Put another way, if I enter "4" here, 1/4 of the following error will be eliminated each step. This again is exclusive of backlash, and refers entirely to the errors introduced by the "% Errors" parameter. Like the over simplifications on losing steps, this model is also too simple for the real world. For example, it assumes constant speed of error catchup, while a real servo has gain and would accelerate as the error got larger.

The model itself is segmented by columns whose headers alternate blue and yellow as follows:

- Commanded Position: The commanded position is the idealized X and Y coordinates the machine should go to if it performed perfectly and stayed on the circle exactly.

- Axis Errors: Axis errors computes when a random error occurs and step is missed. If the error occurs, the entire step is simply ignored, and the next commanded move is made relative to the prior position. The axis errors are generated completely randomly, and you may wish to experiment with overriding my formulas and forcing constant errors at particular locations or perhaps on just one axis.

- Stepper w/ No Backlash: This block of columns shows the result of running a step motor that gets the Axis Errors as defined, but has no backlash. Step X, Step Y show where the machine wound up, while Step Dev X, Step Dev Y show how far that is off from the commanded position.

- Perfect Motor w/ Backlash: This block shows the result of a perfect motor (i.e. one that never gets an error) with backlash. Backlash X, Y show where the backlash error is injected. Note that the model assumes maximum backlash for an axis whenever an axis changes direction as well as at the outset, which is admittedly worst case. Cmd + Bklsh X, Y shows where the axis winds up, and there is a Dev X,Y to show the error.

- Stepper w/ Backlash: This block adds together the effects of lost steps and backlash. The result can sometimes be hideous if it happens just right, triggering backlash in more than the normal number of places.

- Servo w/ No Backlash: Finally, we show the effects of close loop control, wherein the servo motor "catches up" by systematically correcting out the error over time to get back on track.

I didn't bother to show a servo with backlash. Once you see the differences in just these models, it will be clear what impact each is having. Moreover, I am simulating a closed loop system that measures rotation of the leadscrew, not actual table motion with linear scales, so it can't correct for backlash in that way anyway. The servo system will get the characteristic backlash "ears" just like the idealized "Perfect Motor w/ Backlash."

Above the column headers is a line marked "Max Deviation". It provides a sort of absolute measure of how far from the ideal each model gets at its worst.

There are a set of charts on the "Graphs" tab that show what's happening pictorially. They're on the sheet 2 wide, so scroll vertically to get to the ones you can't see:

- Commanded Figure: A very boring, but perfect, circle.

- Commanded + Backlash: From here on, I show the commanded as one line, yellow, and the others in other colors. On this one, you can see the characteristic backlash "ears" or glitches when describing a circular toolpath:

Backlash "Ears": 1" diameter circle, 0.020" backlash on both X and Y axes...

You can see the little blue "ears" are quite pronounced and would be an unhappy result if you were trying to machine a circle. 0.020" is quite a lot of backlash, but certainly not unheard of.

- Stepper w/ No Backlash: This graph shows the effect of lost steps. As mentioned above, you can adjust the likelihood of losing steps. I have no idea what a reasonable real value is, but after playing with the simulation I can clearly understand why people tune stepper systems to such slow speeds that there is almost no chance of losing a step! Here is a graph with a 2% step loss:

Stepper system losing 2% of steps...

You can see that the problem is once you lose a step, you never get it back and the errors just accumulate, making things worse and worse as the CNC program runs on. The result is scrapped parts or worse, a crash of some kind on your machine.

- Stepper with Backlash:

Wow! Backlash and Steppers are Incompatible!

This graph is particularly glitchy and bad. What's happening is the lost steps are triggering backlash due to direction changes as the machine hesitates. This is probably not that realistic a simulation, but if it was only half right, it shows how bad things can bit if you take a system with lots of backlash and run it open loop.

- Servos with No Backlash: This graph is a comparison of servo vs stepper with no backlash.

Servo vs Stepper, Assuming No Backlash...

The sample assumes 2% lost steps (very high, puts the stepper in a bad light) and that the servo system can correct only 10% of the error in a given step cycle (seems slow to me, but I really don't know what a "real" number might be). What is obvious is that the servo can track extremely well, and basically stays right on the circle (not quite, you can see little bits of blue), and the stepper does the exaggerated walk of the path that we saw before.


While this simulation is crude, it does give one an intuitive sense of the effects of backlash and closed loop on accuracy. We can clearly see that backlash introduces "glitches" each time an axis changes direction (which is often on a circle). Yes, there is backlash compensation in some software, but it will force the axis to stop while it winds out the backlash from the screw, and so there will still be some kind of a glitch. It seems as though backlash can also really trip up an open loop system if we're not careful too.

We can also see that a closed loop system has the potential of catching up and eliminating the error pretty quickly. The only answer available in an open loop system is that there must not be lost steps. One can come closer to this ideal than many would expect by using big step motors and conservative speeds, adding some gearing down to further increase torque, so all is not lost. Likewise, Closed Loop does not fix all the sins either. Here is a case where the lost step rate is very high (25%) and the ability to correct for lost steps is slow (taking 100 steps). We are little better off here than with an open loop system (also depicted):

When your servos are too slow to correct following error, closed loop is no advantage...

When you hear someone discussing having to slow down their speeds for their servo system to achieve accuracy, think of this graph. Also think of getting some bigger motors to reduce the errors!

Back to CNC Dictionary Home


Featured Articles

Step-By-Step Guide to Making CNC Parts

CNC Router Cutter Types

Why Use a Single Flute Endmill?

Step and Servo Motor Sizing

The Truth About Tool Deflection

10 TIps for Router Aluminum Cutting

2 Tools for Calculating Cut Depth and Stepover

CNC Machine Hourly Rate Calculator

Special Purpose CNC Calculators

Feeds and Speeds Guide

CNC Cutter Guide

Feeds and Speeds By Material

G-Code Tutorial

Sales, and Special Deals


Feeds and Speeds:
Made Easy.

Try G-Wizard


GCode is complicated.
G-Wizard Editor
makes it easy.

Try It!



Do you want to be a better CNC'er?

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


Start Now, It's Free!