Advertisement
robathome

Printer Kinematics 101

Jun 3rd, 2019
231
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 9.73 KB | None | 0 0
  1. Alright, nerds, you asked for it... Printer Kinematics 101.
  2.  
  3. By overwhelming majority, the Facebook hivemind has made it clear, you want to learn more about printer kinematics. Well, your wish is my command... Fair warning: This is a dry topic, and difficult to keep it exciting, but hopefully you'll learn something anyway!
  4.  
  5. The goal of any FDM-type 3D printer is to create a plastic model of a virtual object, which is divided into layers, each of which can be further divided into individual hotend paths. Now, consider for a moment how a path could be broken down even further: If you dig deep enough into the G-code, you will find that all FDM g-code is simply a massive list of linear move commands, each with target coordinate, how fast to get there, and how much filament to extrude along the way. And I know this is getting really abstract really quickly, but I promise there's a point: Let's break down an individual linear move into the smallest element of the 3D-print: the exact position of the hotend at a given moment in time.
  6.  
  7. The last layer of this metaphorical onion is more difficult to define, because it depends on how small your time-steps are, but the point is that in order to create the printed object, the hotend moves through a long list of very specific coordinates, and depositing filament at (and in between) those locations as it goes. And so the fundamental building block of our kinematic definitions is position.
  8.  
  9. Kinematics is the study of motion, ignoring the forces that create that motion. In the 3D printing world, this is almost exclusively defined in the "time domain", that is to say, all kinematic definitions are used to describe a property of motion with respect to time. Bear with me, these first few definitions are a bit repetitive, but they're important for later discussion.
  10.  
  11. When we compare changes between two values, this is sometimes called the "derivative". When comparing the change in a value over a specific period of time, it's called a "time derivative". And so the first time derivative of position is simply the change in position over a specific time, and we call this "velocity". Since the 3D printing world works almost exclusively in metric, the appropriate unit used to describe velocity is millimeters travelled per second of time elapsed, or [mm/s].
  12.  
  13. The time-derivative of velocity (aka the second time-derivative of position) is simply the change in velocity over a specific period of time, and we call this "acceleration". Similar to velocity, acceleration is described as the change of velocity per second of time elapsed, which can be rephrased as the change in (millimeters travelled per second) per second, or [mm/s^2].
  14.  
  15. The time-derivative of acceleration (aka the third time-derivative of position) is the change in acceleration over a specific period of time, and we call this "jerk". Again, similar to velocity and acceleration, jerk is described as the change in acceleration per second of time elapsed, or the change in ((millimeteres travelled per second) per second) per second, or [mm/s^3].
  16.  
  17. Confused yet? Believe it or not, there are three more time-derivatives of position, called "snap", "crackle", and "pop", but they're waaaay outside of the scope of this little rant, and certainly of no concern to anybody looking to optimize their 3D printer.
  18.  
  19. So how are these values defined in firmware? Well, let's start with velocity. Despite their extreme usefullness in the world of 3D printing, most slicers are dumb when it comes to kinematics. Yes, there may be kinematic overrides in the list of settings, but if my understanding is correct, these are not considered when the g-code is being compiled. Instead, the slicer will always attempt to achieve whatever print (or travel) speed you specify with the assumption that the printer is infinitely powerful and is physically capable of doing whatever the slicer asks it to.
  20.  
  21. However, there are limits to how fast the printer can move. The printer has to overcome the inertia of the components being moved, which is what motivates Bowden-style hotends (which minimizes the amount of weight on the hotend by relocating the extruder). If the printer isn't strong enough to match the specified speed, it will try as hard as it can anyways, and gives the controller no indication of any incomplete movements. The problem here is that the controller (usually) has no means of double-checking the position, and continues to send print commands like nothing ever happened. This error causes what we call a "layer shift", which is (mostly) unpredictable, instantaneous, irreversible, and catastrophic to the print. In plain english, a single layer shift can ruin the print instantly, and there's not much you can do about it once it happens.
  22.  
  23. And so the only way to correct layer shifting is to prevent it in the first place, and to that end we define limiters in our firmware in order to control and mitigate any wild swings in position or velocity dictated by the slicer, and most firmwares use G-code to accomplish this (except Klipper, but that's for another rant). The specific g-codes of interest here are:
  24.  
  25. - M201 (Set max print acceleration)
  26. - M202 (Set max travel acceleration)
  27. - M203 (Set max print feedrate)
  28. - M205 (Set advanced parameters)
  29.  
  30. Please note that these G-codes are for Marlin only... Neither Smoothie nor Klipper use these commands.
  31.  
  32. Let's start with M203, the feedrate limiter. The term "feedrate" hints at how old G-code actually is. G-code has been used since the 1950s, mostly for controlling CNC mills, lathes, and other heavy equipment. In the 1950s, however, the technology wasn't capable of movements fast enough to justify "millimeters per second" (or inches per second) as the standard unit, and so the phrase "feedrate", while synonymous with velocity, is almost always expressed in [mm/min], not [mm/s].
  33.  
  34. Using M203 is straightforward:
  35.  
  36. > M203 X1200 Y2400 Z600 E30000
  37.  
  38. This command sets the current maximum hotend velocities to 20 mm/s on the X-axis, 40 mm/s on the Y-axis, 10 mm/s on the Z-axis, and a whopping 500 mm/s on the extruder. I made the extruder value that high deliberately, to help me make a point: Like any other coding language, tiny little typos can make big trouble. Always, ALWAYS double-check your g-codes, and then check again for extra zeros specifically! It's not the end of the world if you accidentally mash your nozzle into the bed at 5 mm/s, but you're going to have a bad time if you try it at 50 mm/s!
  39.  
  40. Now, it's handy to be able to adjust print and travel accelerations independently, because otherwise you'd have a difficult choice to make: If the general acceleration is high, your travel moves will short and quick, which doesn't sound important but (excluding vase mode prints) travel moves can make up a significant chunk of your code, and faster travels means faster prints. However, there a two drawbacks: 1) Your print resolution suffers and 2) travel speeds tend to be much higher (I typicaly run around 150 to 170 mm/s), which means large accelerations, which (as discussed) can significantly increase the risk of layer shifts! It goes a little somethine like this:
  41.  
  42. > M201 (or M202) X3000 Y3000 Z2000 E18000
  43.  
  44. The advanced parameters are a slightly different ball of cats...
  45.  
  46. > M205 S300 T600 B[???] X[max XY jerk], and Z[max Z jerk] and E[max E jerk]
  47.  
  48. Now, there are two important facts to consider before jumping in and playing with those values: First, velocity and acceleration are easy enough to visualize, but excessive jerk values has a very powerful effect and should be adjusted cautiously. Second, what Marlin calls "jerk" is not technically jerk, but rather a limit on the step size in which acceleration can change per second (jerk-ish).
  49.  
  50. While it may not be immediately obvious, the relationship between acceleration ad jerk is very similar to the relationship between velocity and acceleration. If the travel distance is long enough, velocity will increase according to the variable acceleration value, until it hits max velocity. Then it stays at maximum velocity until deceleration begins, which is essentially the acceleration phase in reverse order.
  51.  
  52. Similarly, the during the preliminary acceleration phase, the acceleration will increase according the static maximum jerk, until it hits maximum acceleration. Then it stays at maximum acceleration until it begins to approach the desired velocity, at which point the acceleration decays at the same rate defined as maximum jerk. At this point the hotend will be at maximum velocity, and when is hits the deceleration phase that whole process starts in reverse.
  53.  
  54. OK, so now we know what these numbers mean, but how do we optimize them? Good ol' fashioned trial-and-error. Pick a model that prints fast and has a number of sharp corners. Look for "Robathome's Lots 'o Corners" on Thingiverse for the model that I use. I print it in vase mode (aka spiralize outer contour in Cura), with one shell, two bottom layers, no top layers, and 0% infill. Make sure you're printing at the temperature and speeds that you want to actually print with.
  55.  
  56. As for the actual tuning process, Thomas Sanladerer has a really, really good write-up on the process here: https://toms3d.org/…/07/07/3d-printing-guides-tuning-speeds/
  57.  
  58. I was going to try and paraphrase it, but it's pretty concise already, and this post is getting long enough as it is.
  59.  
  60. One last thing to mention: How to commit your new kinematic values to memory. There are 4 important commands to remember here:
  61.  
  62. - M500 (Save current settings)
  63. - M501 (Load saved settings)
  64. - M502 (Restore factory default settings)
  65. - M503 (Display current settings)
  66.  
  67. Hopefully how these commands are used should be self-explanatory. If not, Google is your friend!
  68.  
  69. I hope you found this guide helpful, as always if you have any questions, comments, or constructive criticism, please leave a comment!
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement