Musings and Experiments on the Art and Science of 3D Printing

Followers

Musing: How to print accurate parts

By SublimeLayers Saturday, March 3, 2018

Introduction

The purpose of this post is to help you understand:
  1. what accuracy, precision and resolution actually mean
  2. what factors influence printed part dimensional accuracy and precision
  3. how to calibrate Cartesian and delta printers to achieve high dimensional accuracy
  4. how to use RepRapFirmware's M579 Scale Cartesian Axes command to compensate for X-Y dimensional issues on a delta printer
As you read this, keep in mind I am a Duet controller and RepRapFirmware (RRF) convert and have been since the dc42 release with David Crocker's superb delta auto-calibration least-squares fit for the important delta calibration parameters. I use Duets (all models from the original 0.6 to the 0.8.5 and now the Duet 2 Wifi and Ethernet controllers) on all of my machines, currently 6 deltas, 1 CoreXY and 1 Cartesian printer. But I've built and sold or helped many others build their delta, CoreXY and Cartesian printers with Duets and RRF. Although some of what I describe is unique to RRF (the LSF auto-calibration and M579) the overall process for calibrating your printer to get dimensionally accurate parts still applies.

A Little Reality Check

Before we embark, have realistic expectations about what to expect from Fused Filament Fabrication (FFF) 3D printing! Think about the process – the printer is melting plastic filament and pushing it through a tiny orifice to create a thin layer – a really thin layer - of plastic as it moves. These thin layers are stacked one on top of another to create a 3D part. What could possibly go wrong?

All part-making technologies from blow and injection molding plastics to high-end CNC machining metals have limitations, tradeoffs and part design constraints. Let's look at injection molding a little closer since it uses similar materials to our FFF printers. Molten plastic changes dimension and shape as it is cooled – typically it shrinks. High precision injection molding takes this into consideration and molds are designed and painstakingly machined (i.e. $$$) to accommodate this shrinkage. But the actual part accuracy is highly dependent on the plastic formulation and purity, melt temperature, environment (humidity, ambient temperature, etc), molding pressure, mold residence time, mold temperature, and many other parameters including the part geometry itself. It is very complex and varying any one of these parameters can significantly affect the dimensions (accuracy) of the molded parts. Consider that these are million dollar machines in clean room, controlled environments using highly purified feedstock plastic and churning out thousands of identical parts. What chance do we have with a $1000 home-built 3D printer, printing inexpensive plastic filament in a home environment (i.e. big fluctuations in temperature and humidity) printing one part and then moving on to the next?

Consider that injection molded part tolerances for typical 75mm to 150mm cubic parts (in other words, the size of parts we typically 3D print) on dedicated commercial injection molding machines with highly engineered molds ($$) is around 0.23mm to 0.30mm for standard commercial moldings and 0.15 mm to 0.20mm for fine precision modlings (at much greater cost) in ABS. Think about that for a moment. Even in highly precise molding shops, the upper limit is only about an order of magnitude better (.015mm to .020mm).

You should not expect ± 0.01mm precision from your 3D printer. By the way, that's 0.0004" - a precision that even high-end CNC milling centers must work hard to maintain. If you've built or purchased a very geometrically accurate 3D printer and are meticulous and consistent in your approach to printing, you can attain ±0.05mm precision with experience and practice from a 0.4mm nozzle. But results within ±0.10mm precision are more typical and certainly PDG (pretty darned good) for most structural and ornamental prints.

Accuracy, Precision and Resolution - Oh My

Have you ever wondered what "accuracy" and "precision" and "resolution" mean? These confuse many people. I cringe every time I read a post that talks about "accuracy" when they actually mean "precision". Let me give simple definitions for each and then a drawing that should put it all into perspective:

accuracy – is a description of repeatable errors (how close the size of the actual printed item is to the true size)

precision – is a description of random errors (if you print that item multiple times, how much does it vary for each print or, in other words, how repeatable it is)

resolution – is the smallest increment you can measure (applied to your printer it is the smallest increment it can move precisely and/or the smallest feature it can print)

Resolution is related to precision but is NOT the same thing and often mistaken for precision. Resolution dictates the upper limit of precision. So, if your printer is not able to resolve movements of 0.05mm then your printed precision can never be better than that.

Another complication arises with resolution and that is attributed to the resolution of the STL model you are printing. If the model was tesselated with a low polygon count such that the resulting sliced line segments are longer than your printer's mechanical resolution, your prints will likely not be accurate. This is a subtle issue that most 3D printing enthusiasts don't realize – now you are armed with that knowledge.

Now take a look at the figure below. A target and bullseye is the classic way to show accuracy and precision. I've added a third dimension, resolution, to the picture.

The top row shows the difference between accuracy and precision at low resolution – the grid used to measure the position of each red star is very large. The stars in the bullseye can't be distinguished from each other since they are all in the same grid square – the resolution of measurement for the top row of targets.

The bottom row shows the same accuracy and precision as the top row but at high resolution. Here you can see the grid is much finer so you can distinguish the difference between stars even if they are all in the bullseye.
Click image for larger view
Think about this... high accuracy and high precision is, of course, best and the goal. But what can we say about low accuracy and high precision? In this case, a simple fudge factor could be used to compensate for the low accuracy. Once you know what this fudge factor – or compensation – is, you can apply it to each star and the results would be high accuracy and high precision! This is not true for the two cases on the right. There is no simple fudge factor that can fix low precision. So given the choice, always choose high precision over high accuracy. Accuracy is easy to adjust, precision is not.

Look at the definitions above again – precision is random, accuracy is repeatable. Hopefully this makes more sense now. Let's see how all this applies to your printed parts, that's why you are reading this right?

What Affects Printed Part Accuracy?

Realize that dimensionally accuracy and precision is dependent on a lot of factors including:
  1. the mechanical resolution and precision of the printer itself
    1. with Cartesian printers, the resolution for Z is usually different than the resolution in X and Y
    2. with delta printers, the resolution for X, Y and Z is the same but the resolution decreases from the center of the bed to the perimeter
  2. the mechanical resolution and precision of the extruder
  3. nozzle orifice diameter – and don't forget about the accuracy of the diameter
  4. the type of plastic filament 
  5. the extrusion temperature AND extrusion flow rate (which is determined by print speed)
  6. the quality of the STL file (low polygon counts are course, high polygon counts are more precise)
  7. how you slice the STL file (one perimeter is suboptimal, perimeter print order, infill density)
That's a lot to take into consideration and there are other factors too – but they have a lesser impact so I'll ignore them for this discussion.

A Strategy for Accurate Parts

You've just built or purchased a 3D printer and want to print some replacements for some broken parts on one of your kid's toys. These parts need to fit properly on the toy – they can't be too large or too small. Let's assume you have a 3D model of the parts. Let's also assume you know a little bit about slicing and have watched all of my YouTube videos and read all of my blog posts on the topic. Here's how to proceed – in order...
  1. calibrate your extruder
  2. calibrate your printer (more below)
  3. create an STL file from your model
  4. slice your STL file (see my numerous videos and posts)
  5. print three or more test cubes (a 25mm "calibration cube")
  6. measure the printed test cubes
  7. adjust the printer's firmware calibration to fix any problems
  8. repeat steps 5-7 to verify
  9. use firmware compensation (if available) to fix minor discrepancies
From the measurements you should get an idea of how accurate and precise you can print this simple test part. If these are within the requirements for the replacement toy part, you are ready to go! But if your accuracy is off (say the X and Y are always larger than expected) or precision is poor, then you have some work to do.

A note about precision: determining precision is deceptively difficult. Measuring printed parts is almost an art in-and-of itself due to the variability in the sidewalls caused by the printed layers. Measuring a part's height (Z) is more precise because the bottom layer is quite flat (depending on your print surface) and the top layer is likewise flat and measurement with a simple caliper averages any unevenness. Measuring a part's length and width is a greater challenge since the layers make it difficult to find a flat surface to register against. Also, printer artifacts like blobs and strings appear on these layers, again complicating measurement. Measuring length or width in one place on the part might yield a different value than measuring even a millimeter higher or lower. In general, I like to measure across the layers as shown in the photo below. I take three measurements – one near the front, one in the center and one near the back - and average them. Make sure not to be thrown off by a burr on the first layer. Assuming that your printer has the mechanical resolution to obtain it and you are willing to work to achieve it, a precision of ±0.05mm is achievable.

Cartesian Printer Calibration

Cartesian printers are generally easier to calibrate to get good dimensional accuracy than delta printers due to their linear motion mechanics and independence of the three axes. Once you've printed and measured your parts, adjustments to improve X, Y or Z accuracy is done with the axes' steps/mm parameter in firmware. For instance, let's assume you printed a 25mm calibration cube and your average Y measurement came out to 25.10mm. Your firmware currently has 800 steps/mm configured for Y. The formula to adjust the steps/mm is:

adjusted steps/mm = steps/mm * (true size / measured size)

For our example, this becomes:

adjusted steps/mm = 800s steps/mm * (25.0/25.1) = 796.8 steps/mm

Update your firmware and re-print the test cube and Y should be much closer to 25.0mm. Each of the three Cartesian axes are independent and can be calibrated individually in this way.

Delta Printer Calibration

Calibrating a delta printer is a much bigger challenge due to the math involved in the kinematics (it is based on trigonometry) and the inter-dependance of the three delta axes. I'm not going to go into detailed delta kinematics discussion here but I will touch on the basics you'll need to calibrate your printer.

The first thing to recognize is that the delta firmware calculates the position of the nozzle from the Cartesian coordinates fed to it in g-code. The g-code for a delta printer is – and should be – almost indistinguishable from the g-code used to print on a Cartesian printer (if the home position on the Cartesian is defined as the center of the print bed, otherwise the X-Y offset to home needs to be considered). The delta firmware calculates positions of the carriages that run up and down on the three towers. All movement in the X, Y or Z Cartesian space requires moving all three tower carriages. Confusingly, these towers are sometimes labeled X, Y and Z – but understand that they are not X, Y, Z Cartesian coordinates. It would have been nice if alpha, beta and gamma or some other label were used to reference the three towers on a delta printer.

Delta calibration depends on a lot of attributes but I'll focus on the main ones here. Some of the others really should be addressed in the mechanical build (i.e. tower lean and tower location errors, arm length variation, etc). The effects of these can be minimized with sophisticated firmware features like delta auto-calibration (RepRapFirmware) and grid compensation or the M579 compensation discussed later. The main parameters are:
  • delta radius
  • diagonal rod length (arm length)
  • the three tower steps/mm
See minow.blogspot.com for the classic delta calibration guide. Note, that I left off homed height - that affects the first layer height and not the absolute X, Y, Z positioning.

The approach to calibrating a delta printer is:
  1. Adjust the steps/mm for all three towers to get the correct Z movement. This can be calculated based on the stepper motor step angle, driver microstepping, number of pulley tooth count and belt pitch. For pure movements in Z, all three carriages move the same amount. This is exactly like a Cartesian printer. The Prusa steps per mm calculator for belt systems can be used to calculate this.
  2. Measure or estimate the delta radius and arm length. It is best to actually measure these or use the manufacturer's recommendations. At the very least, roughly measure them. Plug these starting values for delta radius and arm length into the config.g (RepRapFirmware) M665 command. You can take a rough measurement for home height (the distance from the homed nozzle tip to the bed in mm) and enter that too. 
  3. Bring the bed up to print temperature. I also prefer to bring the hot end up to temperature too. Allow to stabilize for at least 5 minutes once they have reached the target temperature.
  4. Make sure to delete the config-override.g file if there is one. Then run delta calibration (G32) three or more times. Each time you run it, it will print the calibration results and the deviation of the calculated fit. You want to run enough times for the deviation to converge. You can see this in the G-code Console in the Web interface. The final converged deviation should be below  0.04 for best results. If it is higher, it is best to track down the issue and fix it. If you are using FSR probing, 99% of the time the problem is the bed is constrained, resulting in more force than necessary to trigger the FSR.
  5. Run M500, which will persist the calibration results to a config-override.g file.
  6. Print three 25 mm test cubes and measure their height. This will give you some information on how precise your printer's Z motion is. If there is a lot of variability in the heights, you should try to determine the cause and fix it. Usually it is a mechanical "slop" issue – loose belts, loose pulleys, or stepper motors not mounted firmly. 
  7. If the height (Z) is off, adjust the tower steps/mm to correct the printed height. This is the same as the calculation described above in the Cartesian Printer Calibration section. Edit the M92 command in config.g using this new value – all three towers (X, Y, Z) should be the same.
  8. Repeat steps 6 and 7 until your measured height is within the range ±0.05mm of the true value. This is a very good precision for FFF printers and requires some work to achieve. You should be happy with ±0.10mm of true value for most non-critical work. 0.10 mm is only four one-thousands of an inch – or roughly twice the diameter of a human hair.
  9. Now measure the test cube's length (X) and width (Y). These should be the same (within your printer's precision, again between ±0.05 to ±0.10). The firmware diagonal rod length determines the X-Y scaling of the printed part. This is the L parameter in the M665 command. Use the measured X value to proceed, if X and Y are different, we'll address that next. You calculate the corrected value like this: corrected L = original L * (measured X / true X)
  10. Print another test cube and measure X and Y. If X is not within your printer's precision (between ±0.05 to ±0.10) repeat steps 9 and 10 until it is.
  11. Now turn your attention to Y. Ideally, X and Y will be nearly equal (within tolerance). If not, the best approach is to identify and correct the geometrical error that is causing the discrepancy. Culprits include tower rotation, tower lean, arm length variations, and non-circular delta "radius". If you can't fix the geometrical issue and the variation is not large (say less than 5%), you can use the RRF's M579 command to compensate for the variation. You should only use M579 as a last resort and I highly recommend calibrating Z properly and calibrating either X or Y properly, leaving M579 to compensate the other axis (Y if you calibrated X).

Conclusion

The most important thing you can do to print the most accurate parts possible is to make sure your printer's geometry is as close to perfect as you can get it. Time spent finding and fixing geometry issues – and this applies to both Cartesian and delta printers – is time well spent and will yield much more consistent results. The next most important thing you can do is have realistic expectations on part accuracy. After reading this post, you should have a clear idea on what that means. The third most important thing you can do is carefully calibrate your printer. And lastly, try to be as consistent as possible – including using the same filament (even color), slicing attributes, and room temperature and humidity.

For my work, I prefer to print 100mm x 100mm x 50mm test objects. This larger size reduces measurement errors and exercises more of the printer mechanics. Of course they take much longer to print but for exacting work, that shouldn't be an issue.

If you have an application where dimensional accuracy is critical and you've done all of the above and your printer prints accurate and precise calibration cubes, I'd recommend looking at the polygon count in the STL, consider how part geometry could be affecting things (thin walls for example) and if all else fails, consider tweaking the scaling of one or more dimensions in the model to compensate for the variation. Another option if you designed the part, is to design for "tolerance tolerant" –------------------ meaning consider how FFF printing tolerances can affect your parts and design accordingly. Some examples are designing parts that are an integral number of layers in Z height and an integral number of extrusion widths for thin walled features.

I wrote this post in a stream of consciousness to help a few of my supporters on my Slack channel. Please let me know if there are any errors or points that are confusing and I will update this post as needed.



3 comments to ''Musing: How to print accurate parts"

ADD COMMENT
  1. Decimal places in the steps/mm value always confuse me. Since the motors are really only capable of full step positional accuracy (is that the right term?) won't that decimal place get rounded off somewhere?

    ReplyDelete
    Replies
    1. Rounding off is true if you were only traveling 1 mm but consider taking ten 1mm segmented movements vs one 10mm continuous movement. If you round off steps/mm you could be off (short) by quite a bit whereas the continuous 10mm movement would put you dead-on 10mm. Hopefully that helps your understanding!

      Delete
  2. Good article but I would desagree in 1 thing: how to calibrate a cartesian printer. IF you print a cube and measure it and use that easurement to calibrate an axis, you are introduceing error due to extrusion. Calibration of an axis should be done measureing the movement of the axis yself: you command the axis to move X mms, and you measure that movement. And then procede with same formula. But if yo use the cube calibration method you have some variables affecting that measuement: a smal underextrusion, overextrusion, could give you a 0.1 mm more or less. printing 1 perimeter will give you a value... printing 2 or more perimeter probable give you another one. Even printing the inner perimeter first will give you a different value than printing the external perimeter first. And those measurements can be ok with a 20 mm cube, but then largeer prints will increase the error.

    ReplyDelete