Think you've tuned your rotation_distance properly?

The rotation distance MD document says to

not use a “measure and trim” type of method to calibrate x, y, or z type axes

because it’s “not accurate enough.”

The problem is that I’ve found that calculating your rotation distance isn’t accurate enough either.

By using something like this:


and measuring the steps using a micrometer, I’ve consistently found that the calculated value for rotation distance is not accurate.

In fact in a printer farm of 12 Prusa MK3S+'s I’ve found that rotation distance can vary as much as .1mm from machine to machine.

Why is this? For the same reasons that extruder rotation distance varies: how tight you tighten your belts, manufacturing variations in the teeth and pulleys in your printer, if your belts have to twist at all, if they run at an angle, and many other factors impact exactly how the machine operates.

Does this matter? I think so. For example on my CR10, I found that the optimal rotation distance for the x axis was 39.9063. With a 310mm bed, a rotation distance of 40 would have given me as much as 0.726175mm inaccuracy. If I was 3d printing a computer case (definitely not something I’ve done), the motherboard simply wouldn’t line up with the screw holes (definitely not a situation I’ve been in).

It gets worse if you have multiple printers too. While a single part being a little small, especially at that scale might not be a big deal in some cases, printing 2 parts that would work together on 2 separate printers could lead to bigger problems with even smaller parts.

So, if you’re having problems with parts not fitting properly, or you’re just interested in having +/-0.05mm dimensional accuracy bragging rights, read on:

Before you get started

A few things I’ll note. I’m writing this at night and I don’t want to be up until 3 tonight so I won’t be going into every single possible detail about what’s happening. You’ll need some basic knowledge of manufacturing statistics, measurement theory, and precalculus to follow everything that’s going on here. If the interest comes later I might add more pictures and explanations at that time. For now, you’ll also need:

  • Spreadsheet software (I used Excel but Numbers and Sheets should work as well)
  • Some kind of measurement device that is capable of reading down to 3 decimal places in mm with accuracy greater than your stepper motors and that is not influenced by human error caused by pressure (micrometer (xy axis only) if you want to be measuring prints or dial gauge if you’d rather mount something to your printer or you can use a bed probe for your z axis) all of these have their pros and cons and I’m sure someone can think of another device that can be used for this but the 2 qualifiers above must be met (no calipers)
  • Time
  • Some filament, possibly
  • Your own CAD software or you can download my stl for your xy axis

You should also have a well built printer. Many “3 piece” printers (ender 3, CR10) are not assembled well from the factory and you should tighten and possibly retighten things before you get started. For example, on a typical creality bedslinger if the 2 y axis beams are tightened to the bottom x axis beams before the z axis beams are, the y axis beams can be slightly rotated about the y axis which will cause the tension in the v rollers on the z axis to change throughout that axis, invalidating your results. This is just one example so you should really take the time to make sure your printer is assembled tightly where it should be, and square. Remember 3d printers should be assembled like a car wheel is mounted: put all the screws in loosely to start, tighten them all finger tight, and then tighten them the rest of the way in a clockwise pattern skipping every other screw.

One final note, if you’re printing objects to be measured, make sure you are printing in an “easy” environment since thermoplastics are not very dimensional stable in the first place. There’s a reason that all the commercial printers that advertise guaranteed dimensional accuracy have some kind of enclosure, typically a heated one.

XY axes

I’ll start with the XY axes because they’re generally more in need of this fine tuning than the z axis since those commonly use screws which, while not perfect, are much better than belts. However the general concept here is applicable to any axis so if you are using your own measuring method, apply the concept here only.

Start by mounting your dial gauge or printing this guy with the wide portion of the steps facing the direction of the axis you’re measuring.
XY Calibration.stl.zip (9.1 KB)

The main issue we have to combat here, and part of what causes the Klipper docs to say that test and trimming is not accurate enough for xyz axes is that we need to measure the travel distance of the printer in a way that is not affected by dimensional precision (or imprecision, actually). If you’re measuring a printed object you also need to account for issues like slicer errors, inaccurate flow, and other things which are not important to this sentence. If you’re measuring the first step of my model for example, you’re most likely going to measure more than 2mm. While some of that is due to your rotation distance being too high, by measuring the next step and calculating the difference, you’ll see that the majority of this is due to other 3d printing issues, which we’ll tackle in another post.

If you haven’t figured it out by now, what we’re looking for here is the size of the steps, not the object itself. And if you’re using a dial gauge, you’ll want to make many small steps as well. This is because even a perfectly calibrated printer will have some dimensional imprecision, which is different than inaccuracy.

Precision is that +/- you see on your calipers, dial gauge, and any other scientific instrument. It’s the repeatability of the positioning system for your printer. As you can see from my results, my first run on my CR10 had a precision of +/-0.0365. (I started with 39.79102314 because the spreadsheet I’m showing here is from a recalibration after I reassembled my gantry)

You should setup your spreadsheet something like this after you record your first results:


Make sure to replace the 300 in total error with the length of your axis

Take the value from the new column and put it in your config and go again. A few things you should know at this point:

  • The ultimate goal is to get the total error to be less than the variation. While you theoretically want a total error of 0, it’s going to be really difficult, and there isn’t really a point because again, there is a repeatability limit in your stepper motors and everything else in your system
  • The higher your variability the more steps you’ll have to measure to minimize the effect of the variation in your results. You can either do this by increasing the steps in your model or running the test multiple times.
  • If your variability is super high, you should consider upgrading your motors, belts, pulleys, etc.

At some point you will find that your “new” rotation distance is oscillating up and down. This is because when you get that close the the target value, the effects of inaccuracy in the measurement device and plastic if you’re measuring printed parts gets too relevant. To combat this, create a scatter plot of your tested values to their “delta” values. (yours will have more points than mine as mentioned above. Create a best fit line and retrieve the equation for that line. Then solve for y=1.

Testing this value should get you your closest value yet.

At this point, getting more accurate will require measuring more steps and plotting more points to refine your best fit line. You could theoretically get to “perfect” dimensional accuracy but you’re likely to find that things like thermal expansion in your belts will throw your results while you’re tuning. The good news is that at this point, you should be well beyond what Stratasys promises for $50k machines, and you should definitely be good enough for anything you could possibly want to 3d print.

Z axis

With the Z axis you have to get a little creative if you aren’t using a dial gauge. Because beds aren’t flat as you probably well know, you can’t just print the same test part rotated. You could print a bunch of towers placed in exactly the same spot but that’s a lot of work. I like to use a bunch of towers I know the height of and the probe command to do the measuring. Just make sure that you take a couple results and average them and measure your towers with your micrometer because they aren’t going to be perfectly 2mm steps or whatever.

You could also consider printing your step tower on a raft if you already have bed leveling to compensate for the majority of the tilt in the bed. Just make sure that the bottom of your print turns out nice so you have an even measuring surface.

Final remarks

Most extruder rotation distance calibration guides recommend extruding like 50mm and measuring how far it actually went. Now that you’re probably familiar with manufacturing statistics, think about how stupid that sort of is. If you marked your filament with a sharpie and are measuring with a calipers, the best measurement you can hope to get there is within a tenth of a mm. I just sliced a benchy in simplify3d and it says 4013mm of filament. That .1mm just became 40mm of filament. Take a benchy and 4cm of filament and think about the volumetric difference you have there. Get a meter stick and extrude at least 500mm of filament. Do it a couple of times just like you’ve done for everything else. Make sure you use a temperature near the top of what your printer can do and slow down that extrusion to get the very least pressure influence.

Consider tuning input shaping and pressure advance, again if you already have as they have a large impact on your geometry and thus your dimensional accuracy in a lot of ways.

If you have bed leveling, please don’t use fixed mounting for your bed. Even if your firmware accounts for tilt in your bed, you’re still going to be left with either a slant in your prints or inaccuracies if you use mesh fade.

You’re likely to find at this point that a flow rate of 100% is actually perfect. Turns out that unless you have some special filament like a filled filament, 1.75mm is 1.75mm (or 2.85) and the volume doesn’t change so there’s no need to compensate for flow.

If you’ve gotten this far and you’re done this please let me know how precise you got.

4 Likes

You appear to be relying on a 16mm object to do this tuning. Have you confirmed that this is accurate on something larger? Have you printed this object in other locations on your bed to verify you aren’t tuning based on location bias? Have you done this tuning with different materials to verify material shrinkage, filament diameter, and moisture in the filament aren’t skewing results?

I ask because I’ve been down this road myself, and I found the results confusing and inconsistent. In the end I no longer tune these values and I rely on slicer tuning based on the type of filament I’m using. It has led to much better results for me than trying to find a magic rotation distance value.

Great questions,

The object I have made is 16mm because most micrometers cap out at 25mm. My micrometer has an accuracy of +/-0.003mm. That extrapolates out to 0.036mm for my CR10. Even if all my readings were at a far end of that range, it’s still far less of a consideration than the errors of any other method I’ve found. In reality, the lab at my school found that 95% of its readings fall within +/-0.001mm of the tested value although the last time I had mine tested was last year.

Part of the point of measuring steps is to eliminate the problem of material shrinkage and such factors you mention. As I noted, filled filaments, those prone to warping, and reels not well taken care of will need flow adjustments but this post is about tuning the kinematics of your machine itself.

As for positioning on my bed, I found that as long as your belts are reasonably parallel and tight, any variation was undetectable beyond the general unpredictability of my axes, which checks out unless you’re getting into the levels of quantum physics. On some older designs where the belt runs in sort of a triangle, you would have varying results around your bed in which case I would say you have bigger issues than rotation distance.

If you found your results confusing and inconsistent it’s most likely due to one or both of the following:

  • Not enough samples taken to diminish the effect of measurement error
  • Problems with the construction of your printer

If this was what you were doing I might be okay with this type of tuning, but what you’re measuring is entirely different. You’re measuring the total accumulation of errors of the entire system, and using that to adjust one value within that system. The problem I see is the variance in all the other inputs which will lead to problems when doing this type of tuning.

I will always recommend against this type of tuning for the reasons I’ve outlined. It’s much better to tune flow and XY shrinkage per material in my experience.

I think you’re confused with the printed part. Think of the printed part as an intermediate step that allows you to use a micrometer to measure the distance your printer travels when it’s told to (in the case of my part, 2mm).

Whether the plastic shrinks or expands is irrelevant because the wall of the step should move 2mm relative to the previous step no matter what. The only reason you have to measure against the other side of the part and calculate the distance to find the step’s height is because that’s how micrometers work.

If you use a dial gauge then you don’t have to do the nonsense of calculating differences in step heights because the value is there already.

You should always tune your printers firmware to reflect the reality of the printer hardware and then compensate for filaments in your slicer. Your printer uses that information to perform things like velocity and acceleration control, pressure advance, input shaping, and many more things that the slicer has no control over.

As I already stated you aren’t measuring how far an axis travels, you’re measuring the size of a plastic part that can vary significantly based on a ton of variables (only one of which is how far the axis travels). If I print a 16mm object out pf PLA and ABS, I would expect the ABS part to be about 0.1mm smaller because of shrinkage. ABS shrinks about 0.5%-0.6% more than PLA in my experience. That size difference is solely because of the change in material and has nothing to do with the physical characteristics of the printer.

That is why you also have to do modifications in your slicer. But each line will be placed relative to the other lines in a way that represents how far the axis travels.

As you can see from my own data that I posted, all the measurements are above the 2mm increment. But the average of the step height is correlated directly to rotation distance as you can see with this data for my Flashforge

The point of this post is not to say that rotation distance calibration solves all your dimensional accuracy problems. The point is that merely calculating your rotation distance doesn’t work to obtain a usable rotation distance and to bring some understanding about variability in printer movement.

My recommendation is that users configure rotation_distance by “inspecting the hardware” as described at Rotation distance - Klipper documentation . I think your post does a good job of getting at the root of that recommendation - getting to a more accurate rotation_distance requires a careful test methodology, many measurements, a statistical analysis of the resulting data, and the resulting deviation is typically small relative to the noise. It is also worth mentioning that a subtle error in the process can easily result in a worse configuration.

I know that some people have gone through a detailed calibration process and are happy with the results. As always, I encourage people to use the processes and procedures they are most comfortable with.

FWIW, the rotation_distance parameter is primarily defined by the belt pitch - the average distance between each tooth on the belt. Individual errors in belt teeth, belt tension, pulley dimensions, stepper motor construction variances, and similar all do result in positional error, but that positional error can not typically be addressed by altering rotation_distance. That is, those types of error will result in periodic swings in positional accuracy, but do not change the average position over long distances. It is possible that an axis skew could result in a systemic position error over long distances, but such an error would be better addressed with the skew_correction module. I suppose it’s possible that a belt could be tensioned so tightly that it alters the average belt pitch, but I suspect doing so would result in much bigger problems than a change to rotation_distance.

It sounds like you’ve gotten results that you are happy with. That’s great. For what it’s worth, your test seems susceptible to sources of periodic error and I would not recommend it on 3d printers in general. In particular, a variation in pulley diameter could result in a periodic error that repeats with every rotation_distance (often 40mm). This type of error can show up as a repeatable deviation over small distances, but does not alter the average position over long distances; so a test print that doesn’t span long distances will be susceptible to an incorrect reading. Similarly, small prints would also be susceptible to minor inconsistencies in rail friction at certain parts of the bed. Also, be aware that each step size being measured has to be carefully chosen - otherwise the steps could heterodyne with stepper microsteps, stepper phases, belt pitch, etc. That too could show up as a repeatable deviation that is not representative of the average distance.

So, in closing, if you’re happy with the results, that’s great. If a new user is coming to this topic, than be aware that “there be dragons here”.

Cheers,
-Kevin

2 Likes

I think it may be useful to elaborate on this statement as I think there is often confusion on this point.

Consider the distance travelled with one full rotation of a 20 toothed pulley with a 2mm belt pitch. If the belt pitch is exactly 2mm then that pulley has to move the belt 40mm. Barring the absurd, it’s not really feasible for the belt to move some other distance. Sure, the belt could move around within the pulley (slack), but that type of error wont grow with multiple rotations. Similarly, the carriage may not move the full distance due to friction, backlash, or other effects, but that too wont grow with multiple rotations of the pulley. It’s possible the pulley axis is not fully aligned, the teeth of the pulley are not all equally spaced, the pulley is at an angle, etc - but again none of those errors would grow with multiple rotations. It’s possible there are errors in individual teeth of the belt, but that too wont be seen over multiple rotations of the pulley.

Thus, it is the belt pitch (average distance between belt teeth) that determines the position over long distances, and it’s that average value that is needed when configuring rotation_distance.

-Kevin

This is very interesting and something that I did not think of. Let me see if I can get my hands on a larger micrometer. ASU has to have one somewhere… I have to think about it but I think placing another print 16mm forward and back to cover 48mm and thus more than one full rotation should also tell if this is a concern.

This is a good point. I checked my bed skew before calibrating my setup but I did fail to mention that…
For the record my xy plan is only skewed about .003 degrees so even if I hadn’t checked for this it wouldn’t have influenced it much.

As I eluded to before, it doesn’t take that much change in belt tension to change the rotation distance. Simply retightening my belt was enough to move my rotation distance from 39.79102314 to 39.9063. You are right that the average pitch in the belt teeth is a primary factor but the other important factor is the diameter of the hobbed gear that interfaces the belt to the motor. Tightening the belt at all will change the diameter at which the belt meshes with the gear, just like how tightening an extruder influences how the filament interfaces with the gear.

Again, you are forgetting that the diameter (and thus the circumference) of the drive gear plays an equal role as the teeth in the belt. If the gear has double the circumference, it will double the rotation distance. What I’ve found is that tightening the belt ever so slightly shrinks the “interface diameter” which is a term that I might have just made up but it’s the middle of where the teeth end up. Loosening the belt will cause the teeth to not mesh as tightly and increase the diameter and rotation distance.

This is part of a long saga I have in trying to beat machines like the Stratasys F170, not a complete guide to dimensional accuracy by the way. I want to be clear that jakep_82’s concerns about slicer adjustments have merit. But rotation distance isn’t something that’s specific to a printer for it’s life, and it’s certainly not specific to just any model of printer. This is why commercial 3d printers have hardware for calibrating their dimensional accuracy built in, typically a laser based system. Older printers like the uPrints would run a calibration procedure every night. Modern Stratasys F123’s do less often, although I’m not sure exactly how often anymore because Stratasys wants to be a butt about covering up everything.

1 Like

No, this can not be. If you rotate a 20 toothed pulley one full rotation then you will move the belt 20 teeth. If you rotate that pulley 1,000,000 times, you will move the belt 20,000,000 teeth. There is no way you can somehow move the belt 20,000,001 teeth. Yes, there can be variance within a rotation, but that variance can not grow upon multiple rotations - thus it does not impact rotation_distance over long distances.

-Kevin

1 Like

I don’t know how I missed that.

I guess then it has to be errors in the construction of the motor?

Stepper motor construction can certainly result in position error within a rotation, but for the same reasons outlined above, it can not grow with multiple rotations. A 200 full_steps_per_rotation stepper motor will have 200 iron teeth in the stator that, depending on current passing through the two coils, push/pull the permanent magnet on the rotor. The full steps are discrete, so errors don’t accumulate. (Barring “lost steps” which would always occur in a unit of 2 full steps - an event that would be similar to the belt skipping on the pulley.)

Cheers,
-Kevin

1 Like

Ok I’m lost now, I’m going to have to get back to the drawing board on this one I guess. There is something happening here and it’s either I mis configured skew correction or something periodic. Unfortunately I’m 2.414e+9mm away from my printers right now and can’t conduct any tests for a couple weeks

1 Like

Edit: Removed the [how-to] in the title