K-Factor Calibration Pattern

The below Javascript will generate gcode that will support the user in calibrating the K-Factor for Marlin's Linear Advance Feature. The default values should work for a standard PLA material with a 0.4 mm nozzle.

Notes on the settings:

  • Fast and slow speed should be significantly different or the K-Factor effect will barely be visible
  • Use bed levelling requires a probe
  • The printer's bed is assumed to be rectangular. For round beds use the diameter as approximation but extra care should be taken that the pattern size matches the bed. The overall width (X-direction) of the print is always 100 mm. The length (Y-direction) depends on the K-Factor Settings. The sanity check will only work for rectangular beds.
  • Start and End value for the K-Factor determines the range that the test pattern will cover. For example a start value of 50 and an end value of 150 will test a range of 100.
  • The K-Factor stepping determines how many test lines are printed for the above range. For example, a Stepping of 10 and a range of 100 results in 10 test lines. A stepping of 3 would not work in this example as 100 cannot be exactly divided by 3. The script will throw an error message if an exact division is not possible. In this case either the range or the stepping needs to be adjusted.
  • The proper K-Factor depends on the filament, nozzle size, nozzle geometry and printing temperature. If any of these values change, the calibration might need to be repeated.

Settings

GCode:

Printer Settings:

Diameter of the used filament in mm
Diameter of the nozzle in mm
Nozzle Temperature in °C
Bed Temperature in °C
Retraction distance in mm
Size in mm of the bed in X
Size in mm of the bed in Y
Layer Height in mm

Speed Settings:

Use mm/s instead of mm/min
Slow printing speed
Fast printing speed.
Movement speed

K-Factor Settings:

Start value for the K-Factor. Usually 0 but for bowden setups you might want to start higher, e.g. 30
End value of the K-Factor. Bowden setups may be higher than 100
Stepping of the K-Factor in the test pattern. Needs to be an exact divisor of the K-Factor Range (End - Start)

Advanced Settings:

Ratio between nozzle diameter and extruded line width. Should be between 1.05 and 1.2
Activate UBL and level bed before printing
Usually 1.0