Saturday, August 10, 2019

Calibrating steps/mm: the right way and the wrong way

For a lot of people this post is going to seem redundant, but this is a problem that should have died off years ago but still seems to be around today. So, here today I'm going to try to look at the various ways people try to adjust their steps/mm values on their printers, and explain which ways are correct and which are not.

Background

A long time ago, the agreed upon method to set and adjust your steps/mm value was to print a test piece, measure the dimensions on the axis, and figure out how much the test piece is off on each axis. A multiplier could then be calculated from the difference and applied to the current steps/mm value, and a new test piece would be printed at this new value. After a couple of iterations of this, you would have a nearly perfect test piece and your steps/mm would be assumed to be accurate.

This method was heavily flawed, and over time a new method arose that was both simpler and more accurate: simply take the set of known values and characteristics of your motion system (belt pitch, pulley teeth, motor steps/mm, etc) and calculate a theoretically perfect steps/mm value. As it turns out, this theoretically perfect value in practice is almost always far more accurate than a "calibrated" value generated by the first method.

Why? Essentially what it boils down to is that both your axes steps/mm and your extrusion accuracy affect your dimensional accuracy, and both should be adjusted independently. The first method does not keep them independent, and your extrusion error contributes to your axes steps/mm error.

What happens with Method 1?

Let's take a look at a common scenario today: we just bought a new Ender 3. Out of the box, the Ender 3's XY steps/mm are both set to 80, the Z steps/mm is set to 400, and the E steps/mm is set to 93. As it turns out, the XYZ steps/mm set on an Ender 3 are 100% theoretically (and pretty close to 100% practically) accurate from the factory, but the E is often not - we'll assume this Ender 3 is underextruding by 20%. However, we don't know any of this just yet.

We decide to use method 1, and print a 20mm, single walled test cube with a 0.45mm wall width to start the calibration process.

Not drawn to scale

Something to understand here is that the "path" drawn by the nozzle (shown here by the black line) is not actually 20mm long: instead, the slicer accounts for the extrusion width and subtracts it from the width of the object. That means the toolpath is in fact just 19.55mm long, and the slicer assumes half of the 0.45mm wall width is added to each side; that brings the total width of the cube to 20mm exactly.



Remember how we said we were underextruding by 20%? Well, now, instead of being 0.45mm the extrusion width is actually only 0.36mm. The slicer doesn't know that: it's still going to make the toolpath 19.55mm wide, which now means the overall width of the cube only turns out to be 19.91mm. Quite a ways off.

So now we take that 19.91mm, and see that it needs to be increased by .45% on both X and Y in order to bring it up to 20mm. As such, we set the new XY steps/mm to 80.362.

This is what the next test print looks like.


Because we increased the XY steps/mm by 0.45%, correspondingly, the length of the toolpath increased by 0.45% as well. Now it's 19.638mm instead of 19.55mm. However, we didn't touch the extrusion, so the wall width stayed the same **. Add those values together, and we see that our box is now 19.998mm wide.

It's still not exactly 20mm, but 0.002mm is beyond the capabilities of regular calipers to measure so it appears to us that it's exactly 20mm. Yay! Calibration complete! Right?

Well, let's take a look at what happens when we move beyond test cubes and start printing actual objects. This time, we have a print that's 200mm wide and 150mm long.


Under ideal circumstances, this is what that print should look like. The toolpath is 199.55mm wide, and half of the 0.45mm wide extrusion width is added to each side to make exactly 200mm wide.

Whoops, we're still underextruding. And we increased our XY steps/mm by 0.45%, so instead of a 199.55mm toolpath we get...

a 200.45mm wide toolpath, and an object that works out to nearly a millimeter larger than it should have been.

This is the problem with "calibrating" your axes steps/mm. You can calibrate those values so that you seem to get nearly perfect dimensional accuracy at the size of your test piece (in this case, 20mm), but you start losing more and more dimensional accuracy the farther you go from 20mm. Larger prints will come out oversized, and smaller prints will come out undersized. (The opposite is true if you were overextruding when you calibrated.)

A similar problem exists with the Z steps/mm as well. If you set your first layer height to 0.20mm, but you accidentally oversquish it so that in reality it's only 0.15mm tall, your 20mm tall test print will only come out to 19.95mm. Increasing Z steps/mm by 0.25% will similarly affect dimensional accuracy as soon as you start printing prints that aren't exactly 20mm tall.

Method 2 explained

Let's backtrack a bit and say that for some reason our Ender 3 didn't come with firmware preloaded. We have no factory values for steps/mm, and have to find our own.

What could we do? We could pick arbitrary values such as 50 on XY and 300 on Z and use method 1 to dial them in, but as we just saw, method 1 is not accurate.

Instead, let's look at the motion components. For X and Y, we know we have 2mm pitch belts, and the pulley on the motor has 20 teeth. So, what that means is that for every full revolution of the motor the belt moves 20 teeth, or exactly 40mm. It takes 1/40 of a revolution of the motor to move 1mm.

We also know that the motors have 200 full steps/rev, and given that 1/40 of a revolution moves the belt 1mm, we can determine that every 5 full steps on the motor moves the belt 1mm.

The drivers microstep the motors at 1/16, so every full step is in fact divided into 16 microsteps. The software doesn't distinguish between full steps and microsteps: it just considers 1 microstep a "step". When each of the 5 full steps is divided into 16 microsteps, that gives us 80 steps/mm - which happens to be the same number that the Ender 3's firmware ships with!

The final formula we arrived at is:

((motor steps/rev) * (microstepping)) / ((belt pitch) * (pulley teeth))

This is for a belt driven axis. For a leadscrew driven axis such as Z it's even simpler:

((motor steps/rev) * (microstepping)) / (leadscrew pitch)

Or, you know, if you don't want to do the math just use Prusa's Reprap calculator. It does the exact same thing.

Now, as we know nothing in real life is ever theoretically perfect. We could say that every revolution of the motor moves exactly 40.00mm, but if the belt's actual pitch is just a tiny bit off from manufacturing, you're going to get errors. So this theoretical value still isn't 100% accurate, is it?

It's not.

But it's close. It's reaaaal close.

The manufacturing tolerances on high precision timing belts and leadscrews is quite stringent, and it's far more than we would be able to measure by hand. And as we just saw, if we try to use method 1 to calibrate it we'd be thrown off far more by the error created by even a slight amount of underextrusion or overextrusion than we'd gain in accuracy. If you had some high precision measuring device on your axis that could tell you exactly how much your axis is moving, you might be able to use that to calibrate your axis to a better accuracy than this theoretical calculated value - but most of us do not.

So how do I make my prints more dimensionally accurate?

You...uh...calibrate extrusion. With something more akin to method 1.

It might seem odd to say, but your extruder is the only "axis" on your printer that will get better values with a measure>adjust>measure approach than calculating a theoretically perfect value. The reason for this is that the drive gear will sink its teeth into the filament slightly, which changes its effective diameter by an unpredictable amount. 

Instead, it's better to tell the printer to extrude 100mm and then measure it, and see how far off from 100 it was. You can then use that difference to adjust your esteps/mm. Unlike adjusting your motion axes, this value is not inaccurate because there is no fixed offset such as you would get with underextrusion while calibrating your motion axes.

Conclusion

So there you have it. Hopefully this explained a bit more about why you should calculate rather than calibrate your steps/mm on your motion axes.

Printer manufacturers (looking at you, Monoprice!) please stop using calibrated values. 


* A 20% underextrusion is quite extreme and rather unlikely for an out-of-the-box Ender 3, but it's not entirely unheard of. I chose an extreme value because it illustrates the point better. The same principles apply even if the printer is only underextruding 2%; the effects will just be less severe.

** Okay, the wall width decreased a tiny bit, because the longer toolpath with the same amount of plastic means the plastic will be run a bit thinner. I don't feel like calculating that though.

No comments:

Post a Comment