thinkyhead

M493 - Fixed-Time Motion

2.2.0 motion Enable/disable and configure Fixed-Time Motion, Linear Advance, and Input Shaping FT_MOTION

Description

The Fixed-Time Motion Planner is an additional motion planning system provided by Ulendo.io as an add-on to Marlin Firmware. It currently supports Cartesian and Core kinematics. It may be extended for Delta in the future. The FT_MOTION feature can be enabled at the same time as Marlin’s integrated ZV Input Shaper, but these features do not share settings. It has its own implementation of Linear Advance (aka Pressure Advance) with its own gain parameter separate from M900.

One interesting feature of this add-on is that it can be enabled and disabled while the machine is running (and maybe even within a single print job). So if you prefer the integrated ZV Input Shaper for some prints and 2HEI Input Shaping for others you don’t need to re-flash the firmware.

G-code M493 allows you to enable or disable Fixed-Time Motion, change the current Input Shaper mode, and set parameters for its own Linear Advance and Input Shaping.

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.

1. 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.

2. 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 the the Starting G-code enable Fixed-Time Motion with something like:
    M493 S11 D0 ; Enable ZVD Input Shaping
    
  • 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:

    M493 A{(layer < 2 ? 0 : 15 + 45.0 * (layer - 2) / 297)} ; (Hz) X Input Shaping Test
    M493 B{(layer < 2 ? 0 : 15 + 45.0 * (layer - 2) / 297)} ; (Hz) Y 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:

    M493 A{(layer_num < 2 ? 0 : 15 + 45.0 * (layer_num - 2) / 297)} ; (Hz) X Input Shaping Test
    M493 B{(layer_num < 2 ? 0 : 15 + 45.0 * (layer_num - 2) / 297)} ; (Hz) Y 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 M493. The default frequency settings will let you test a range of 15Hz to 60Hz.
3. 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.

4. 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.
  • Send the command M493 A29.84 to apply the frequency to X motion. (For Y you would use M493 B29.84.)

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.

Dynamic Shaping

Once you have the basic Input Shaping tuned, you may want to do further testing to see how the resonance changes as the Z height increases. Z height can affect the machine resonance whether the bed or the gantry moves in Z due to changes in the center of mass. Tuning according to the changing Z-height is more complicated than just printing a test model, and is best done with an accelerometer. Machine vendors should consider tuning at the factory and provide tuned profile settings for the popular slicers.

Usage

M493 [A<Hz>] [B<Hz>] [D<0|1|2>] [F<scale>] [H<scale>] [K<gain>] [P<state>] [S<0|1|10|11|12|13|14|15|16|17>]

Parameters

[A<Hz>]

Set the Base Frequency for Input Shaping on the X axis.

    [B<Hz>]

    Set the Base Frequency for Input Shaping on the Y axis.

      [D<0|1|2>]

      Set the Dynamic Frequency mode.

      • D0:

        Disabled

      • D1:

        Z-based

      • D2:

        Mass-based

      [F<scale>]

      Set the Frequency Scaling factor for Input Shaping on the X axis.

        [H<scale>]

        Set the Frequency Scaling factor for Input Shaping on the Y axis.

          [K<gain>]

          Set the gain for Linear Advance.

            [P<state>]

            Enable / disable Linear Advance.

              [S<0|1|10|11|12|13|14|15|16|17>]

              Set the current motion mode and/or Input Shaper.

              • S0:

                Standard Motion

              • S1:

                Fixed-Time Motion

              • S10:

                ZV Input Shaping

              • S11:

                ZVD Input Shaping

              • S12:

                ZVDD Input Shaping

              • S13:

                ZVDDD Input Shaping

              • S14:

                EI Input Shaping

              • S15:

                2HEI Input Shaping

              • S16:

                3HEI Input Shaping

              • S17:

                MZV Input Shaping

              Examples

              Enable Fixed-Time motion with Linear Advance gain 0.22

              M493 S1 P1 K0.22

              Enable Fixed-Time motion with ZVD Input Shaping

              M493 S11 A37 B37 D0 P1 K0.18

              This also sets the IS Frequency to 37Hz for X and Y, disables Dynamic Frequency mode, and enables Linear Advance with a gain of 0.18.