6.10. Calibrating linear advance with PrusaSlicer

Linear Advance corrects for the non-linearity in 3D printer extrusion that results in over extrusion at the start and end of motion, particularly at higher print speeds. If you notice uneven extrusions, particularly bulges at corners, calibrating Linear Advance for your filament may improve your print quality.

Note

These notes are based on my experiences with the Prusa i3 Mk3 and Artillery/Evnovo Sidewinder X1 printers. If you are using a different printer, please verify the hardware details are similar.

As with most things in 3D printing, the best settings will vary depending on your printer, your filament, and other unique factors relating to your setup.

  • If your printer uses a Bowden extruder setup, your values will be very different from those that work best on a direct drive extruder.

  • Different filament types have different printing characteristics and ideal settings can vary widely.

Important

Linear Advance is not enabled in all printer firmware. Check to be sure LA is enabled, and determine what version of LA is used. LA1.0 values vary considerably from LA1.5 values.

If enabled in firmware, Linear Advance is adjusting using the M900 Kxx gcode command. These “K value” will vary depending on the LA version.

  • Linear Advance 1.0 uses values in the 10-80 range (e.g., M900 K80).

  • Linear Advance 1.5 uses values in the -0.02-0.30 range (e.g., M900 K0.04).

Calibrating Linear Advance is a good final step in the process of calibrating filament settings.

  • If LA is set too low you’ll see “dog bone” bulges in corners rather than neat squares.

  • If LA is set too high, corners will look rounded off.

Here’s a test print showing the effect of changing the K value from -0.02 to 0.30 over the course of a print.

The effect of changing Linear Advance

Fig. 6.61 The effect of changing Linear Advance

The effect on the z-seam is also dramatic.

The effect of Linear Advance on the z-seam

Fig. 6.62 The effect of Linear Advance on the z-seam

6.10.1. Calibrating Linear Advance using the Marlin K-factor Calibration pattern

You can do a quick test using the Marlin K-factor Calibration Pattern generator. However, the settings can be confusing to set up, results can be messy, and the test print difficult to interpret.

6.10.2. Calibrating Linear Advance using Prusa gcode

Prusa provides a set of test prints for their Mk3 printers. This can be a quick way to get started if you are using a Prusa printer. I find their process a bit rigid and inflexible.

6.10.3. Calibrating Linear Advance using the custom test print

I generated this calibration procedure to produce a print that is easy to interpret and compare to others regardles of the printer and filament you are using. This print will take considerably longer to print than the Marlin test print, but you can store the print for easy comparison and easily view the impact of changes to the Linear Advance setting. It’s a bit of overkill for a simple calibration, but it makes visualizing the effect of LA much easier than a single-line print.

I’ve created a 3MF project file for a Prusa i3 Mk3 with PLA. To run these tests for different printers or filaments, follow these steps:

Note

Many thanks to @Ringarn67 over on the Prusa forums who alerted me to an important omission in my latest edits. If this test didn’t work for you previously, please pay attention to the cooling adjustment step!

  1. Download and unzip the test print for the Prusa i3 Mk3.

  2. Load the test print into PrusaSlicer.

  3. Add the layer change gcode to the Before layer change G-code section under Printer Settings->Custom G-Code in PrusaSlicer.

  4. The test print consists of 10mm tall sections for K values from -0.02 to 0.30 in increments of 0.02. You can cut the tower down to test a smaller range. You will need to adjust the layer change gcode if you want to start with a higher value.

  5. To see the effect of Linear Advance, print speeds must be sufficiently high to allow the nozzle to transition from low to high speed and back. Set Filament Settings->Speed->External perimeters to 60mm/s or faster.

  6. By default, most filament presets have the automatic slowdown cooling feature enabled. Change Filament Settings->Cooling->Cooling thresholds->Slow down if layer print time is below to 1.

After you slice the print, verify that the external perimeters have been printed at 60mm/s or faster:

Verfiy external perimeter print speed

Fig. 6.63 Verfiy external perimeter print speed

Here’s the layer change gcode for calibrating Linear Advance values for LA1.5:

Listing 6.1 PrusaSlicer layer change g-code for linear advance calibration
 1;BEFORE_LAYER_CHANGE
 2; layer_z is height of current layer in mm
 3; first match wins
 4G92 E0.0
 5;[layer_z]
 6{if layer_z <= 1}
 7M900 K0
 8{elsif layer_z <= 11}
 9M900 K-0.02
10{elsif layer_z <= 21}
11M900 K0
12{elsif layer_z <= 31}
13M900 K0.02
14{elsif layer_z <= 41}
15M900 K0.04
16{elsif layer_z <= 51}
17M900 K0.06
18{elsif layer_z <= 61}
19M900 K0.08
20{elsif layer_z <= 71}
21M900 K0.10
22{elsif layer_z <= 81}
23M900 K0.12
24{elsif layer_z <= 91}
25M900 K0.14
26{elsif layer_z <= 101}
27M900 K0.16
28{elsif layer_z <= 111}
29M900 K0.18
30{elsif layer_z <= 121}
31M900 K0.20
32{elsif layer_z <= 131}
33M900 K0.24
34{elsif layer_z <= 141}
35M900 K0.26
36{elsif layer_z <= 151}
37M900 K0.28
38{elsif layer_z <= 161}
39M900 K0.30
40{endif}

Once you’ve identified a good K value, you can add it to your filament gcode using the M900 Kxx gcode command. Set the desired K value in Filament Settings->Custom G-Code-> Start G-Code. Near the bottom, you’ll find a line that looks similar to:

M900 K{if printer_notes=~/.*PRINTER_MODEL_MINI.*/ and nozzle_diameter[0]==0.6}0.12{elsif printer_notes=~/.*PRINTER_MODEL_MINI.*/ and nozzle_diameter[0]==0.8}0.06{elsif printer_notes=~/.*PRINTER_MODEL_MINI.*/}0.2{elsif nozzle_diameter[0]==0.8}0.01{elsif nozzle_diameter[0]==0.6}0.04{else}0.05{endif} ; Filament gcode LA 1.5 {if printer_notes=~/.*PRINTER_MODEL_MINI.*/};{elsif printer_notes=~/.*PRINTER_HAS_BOWDEN.*/}M900 K200{elsif nozzle_diameter[0]==0.6}M900 K18{elsif nozzle_diameter[0]==0.8};{else}M900 K30{endif} ; Filament gcode LA 1.0

Replace the LA value (0.06, 0.2, etc.) with the new value. If you only have one printer, you can just replace this line with something like:

M900 K0.05; Filament gcode LA 1.5

Just replace 0.05 with your preferred value.

Contact and feedback

You can find me on the Prusa support forums or Reddit where I lurk in many of the 3D printing-related subreddits. I occasionally drop into the Official Prusa 3D discord server where I can be reached as bobstro (bobstro#9830). You can email me directly at projects@ttlexceeded.com.

Last modified Aug 11, 2021. Last build on Oct 22, 2021.