thinkyhead

M593 - Input Shaping

2.1.2 motion Get or set Input Shaping parameters INPUT_SHAPING_[XY]

Description

This G-code pertains to Marlin’s integrated ZV Input Shaper. For the Fixed-Time Motion Planner Input Shaper see M493.

Set the Input Shaping damping factor and/or frequency (in Hertz) for axes that support it. Use M593 with no parameters to report the current settings.

Input Shaper Tuning

It’s not always easy to attach an accelerometer to most printer boards, so Marlin doesn’t provide accelerator-based tuning. If you have that information you can use it. But the easiest way to tune Input Shaping is to print a ringing tower that goes through a range of frequencies, then examine the appearance of the ringing tower to choose the best frequencies for each axis.

Get the Test Model

Download the Ringing Tower STL which you will slice and use for the print test. For a CoreXY printer you should rotate the model 45 degrees, which isolates the A and B components of the motion system.

Prepare the Slicer

Use a slicer that provides custom G-code macros for layer change. For example you can open Kiri:Moto or download Prusa Slicer. If you use Cura you may need to install the Post Processing Plugin from the Cura Marketplace if it is not already installed.

  • In Kiri:Moto enable Infill > Fill Type > Vase. Then add the following under Setup > Machine > Gcode Macros > Layer to run a test range of 15Hz to 60Hz:
    M593 F{(layer < 2 ? 0 : 15 + 45.0 * (layer - 2) / 297)} ; Hz Input Shaping Test
    
  • In Prusa Slicer you’ll enable Spiral vase. Then add the following to your Printer Settings > After layer change G-code to run a test range of 15Hz to 60Hz:
    M593 F{(layer_num < 2 ? 0 : 15 + 45.0 * (layer_num - 2) / 297)} ; Hz Input Shaping Test
    
  • In Cura, you’ll first need to add the .py file in this repository to your Cura “scripts” folder. Reopen Cura, enable Spiralize Outer Contour and set Minimum Layer Time to 0. Then go to Extensions > Post Processing > Modify G-Code. Click Add a script in the window that opens and use the dropdown menu to find Input Shaping. Make sure the Motion planning type dropdown is set to M593. The default frequency settings will let you test a range of 15Hz to 60Hz.
Slice and Print

Slice and print the tower using 0.2mm layer height using the highest reasonable speed. When you examine the results it should be obvious where ringing is reduced the most on each axis. To get the Hz value for a given Z height, use the formula 15 + 45 * (z / 0.2 - 2) / 297.

Analyze the Result

Measure the height of the best looking layer, divide by the layer height, subtracting two layers. For example:

  • The least X ringing appears at height 20mm. So we calculate 15 + 45 * (20 / 0.2 - 2) / 297 and get a result of 29.84Hz.
  • Set this value with M593 X F29.84 then save with M500 and it will apply to all motion from now on.

More Resources

TH3D Studio has created an Input Shaper Calculator that you can use to get the Slicer G-code you need and calculate the Hz value based on the best-looking layers.

Usage

M593 [D<zeta>] [F<hertz>] [X] [Y]

Parameters

[D<zeta>]

Set the zeta/damping factor for the specified axes. If X and Y are omitted, both will be set.

[F<hertz>]

Set the damping frequency for the specified axes. If X and Y are omitted, both will be set.

[X]

Flag to set the X axis value. If X and Y are omitted, both will be set.

[Y]

Flag to set the Y axis value. If X and Y are omitted, both will be set.

Related Media