Linear Advance - Marlin Firmware
Linear advance is one of the most powerful tools for optimizing your print quality. Many people, however, have a difficult time understanding how it works and what it does.
Simply stated, it is about synchronizing the X and Y motion of your nozzle with the filament that is actually extruded from the tip of your nozzle. It is different than calibrating your e-steps because this is tuning how much filament your extruder feeds. While the amount of filament your extruder feeds and the amount that comes out of the nozzle should be the same, it isn't.
Prerequisite: Marlin 1.1.9 or higher
Keeping Everything In Sync
Linear advance can be utilized on direct drive machines, but it provides the most improvement on bowden type setups. This is because there is a bigger lag between what the extruder does and what the filament at the hotend does. As the extruder begins to extrude quickly, the filament is compressed momentarily before it begins to flow from the hotend (region 2). The opposite is true when the extruder slows down. Moments after the extruder stops or slows down, the filament will continue to feed because it is compressed and wants to decompress (region 4/5).
Even though the extruder and X and Y stepper motors complete each of their roles in sync, the result will not reflect this because of the tendency of filament to compress and decompress. This will cause both over and under extrusion in your prints. This is where linear advance comes in.
Calibrating Linear Advance
To determine your linear advance k-factor you first need to go to the K-factor Calibration Pattern Generator and configure it for your machine and filament type. I find that a k-factor stepping value of 0.01 works well to ensure you accurately dial in your machine. Most of the default values will likely work with the exception of retraction, print temps, and bed size. For these values use what you are currently using in your slicer.
The k-factor generator will create a g-code file for your machine which will be a series of straight lines. The line will start slow, speed up, then slow back down. The only difference between each line is the k-factor it uses. At the end, it will mark each line with the k-factor value so that you know which k-factor was used for each line.
Once the print is complete you want to analyze the shape of each line. You will find that most of them are very uneven and look more like the first image on this page. You want to pick the line that has the most consistent width from start to finish. Once you make your decision on which one looks the best, write down the value that correlates to the line you selected.
Finally, you will add this value to your start g-code in your slicer. For example, if the line you picked was 0.20 then you would place M900 K0.20 into your starting g-code.
Final Thoughts
Linear advance k-factor is something that can vary depending on the filament you are using. This means your PLA might have a different value than your PETG. It is a good idea to run this test on each filament type you print and store them under your slicer profile for that material. Also, I recommend using a color that contrasts with your build surface for the tests. Because my build surface is black, I like to use white filament so that it is easier to see the profile of the line. Since this is just a visual test it is important to be able to see each line clearly.
Once you get your K-factor dialed in you will find that your print quality will improve. You will have sharper corners, more consistent extrusion, and you will likely be able to increase your print speeds without losing print quality. Linear advance is a great way to improve your print quality without spending a penny on upgrades.
-3DMaker