---
tag: m0493
title: Fixed-Time Motion
brief: Enable/disable and configure Fixed-Time Motion and Input Shaping
author: thinkyhead
contrib: narno2202, dbuezas

group: motion
category: [ motion, wip ]
since: 2.1.3
requires: FT_MOTION
eeprom: true

codes: [ M493 ]
related: [ M494, M593, M900 ]

notes:
- The K factor for FTM Linear Advance is now set with [`M900 K`](/docs/gcode/M900.html).

parameters:

- tag: S
  optional: true
  description: Set Fixed-Time Motion mode enabled / disabled.
  values:
  - tag: 0
    description: Disabled
  - tag: 1
    description: Enabled

- tag: H
  optional: true
  description: Set the state for Axis Synchronization.
  values:
  - tag: 0
    description: Disabled
  - tag: 1
    description: Enabled

- tag: C
  optional: true
  description: |
    Set the vibration compensator [input shaper] mode for the specified axes.<br/>
    NOTE: Users and slicers must remember to set the mode for both X and Y!
  values:
  - tag: 0
    description: No Input Shaper
  - tag: 1
    description: ZV (Zero Vibration)
  - tag: 2
    description: ZVD (Zero Vibration and Derivative)
  - tag: 3
    description: ZVDD (Zero Vibration, Derivative, and Double Derivative)
  - tag: 4
    description: ZVDDD (Zero Vibration, Derivative, Double Derivative, and Triple Derivative)
  - tag: 5
    description: EI (Extra-Intensive)
  - tag: 6
    description: 2HEI (2-Hump Extra-Intensive)
  - tag: 7
    description: 3HEI (3-Hump Extra-Intensive)
  - tag: 8
    description: MZV (Mass-based Zero Vibration)

- tag: D
  optional: true
  description: Set the Dynamic Frequency mode. (Available when there is a Z axis and/or Extruder to follow.)
  values:
  - tag: 0
    description: Disabled
  - tag: 1
    description: Z-based
  - tag: 2
    description: Mass-based

- tag: A
  optional: true
  description: Set the Base Frequency for Input Shaping on the specified axes.
  values:
  - type: float
    tag: Hz

- tag: F
  optional: true
  description: |
    Set the Frequency Scaling factor for Input Shaping on the specified axes.<br/>
    (Available when there is a Z axis and/or Extruder to follow.)
  values:
  - type: float
    tag: scale

- tag: I
  optional: true
  description: Set the Zeta for Input Shaping on the specified axes.
  values:
  - type: float
    tag: zeta
    range: [ 0.01, 1.0 ]

- tag: Q
  optional: true
  description: Set the Vibration Tolerance for Input Shaping on the specified axes.
  values:
  - type: float
    tag: vtol
    range: [ 0.0, 1.0 ]

- tag: X
  optional: true
  description: Flag to apply `A`,`C`,`F`,`I`,`Q` to the X axis. (If no axis parameters are given then XY is assumed.)
  values:
  - type: flag

- tag: Y
  optional: true
  description: Flag to apply `A`,`C`,`F`,`I`,`Q` to the Y axis. (If no axis parameters are given then XY is assumed.)
  values:
  - type: flag

- tag: Z
  optional: true
  description: Flag to apply `A`,`C`,`F`,`I`,`Q` to the Z axis. (If no axis parameters are given then XY is assumed.)
  values:
  - type: flag

- tag: E
  optional: true
  description: Flag to apply `A`,`C`,`F`,`I`,`Q` to the E axis. (If no axis parameters are given then XY is assumed.)
  values:
  - type: flag

example:

- pre: Enable Fixed-Time Motion with Linear Advance gain 0.22
  code: |
    M493 S1
    M900 K0.22

- pre: Enable Fixed-Time Motion with ZVD Input Shaping on X and Y
  code: |
    M493 S1 XY C2 A37 D0
    M900 K0.18
  post: 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.

---
The Fixed-Time Motion planner (FTM) is a successor to the Marlin optimized planner. FTM was originally developed by [Ulendo.io](//www.ulendo.io/) as an add-on to support their Filtered B-Spline motion solution.

FTM 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`](/docs/gcode/M900.html).

FTM can be enabled and disabled while the machine is running — and even within a print job if that helps! So if you prefer the integrated ZV Input Shaper for some prints and 2HEI Input Shaping for others you won'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 easy to attach an accelerometer to most printer boards, so Marlin doesn't provide accelerometor-based tuning. If you have a device that can record acceleration 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](/assets/stl/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](//grid.space/kiri/) or download [Prusa Slicer](//www.prusa3d.com/page/prusaslicer_424). If you use [Cura](//ultimaker.com/software/ultimaker-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 S1 XY C2 D0 ; Enable ZVD Input Shaping
  ```

- For *Kiri:Moto* (testing 15Hz to 60Hz):
  - Enable **Infill** ⏵ **Fill Type** ⏵ **Vase**.
  - Under **Setup** ⏵ **Machine** ⏵ **Gcode Macros** ⏵ **Layer** add:
    ```
    M493 XY A{(layer < 2 ? 0 : 15 + 45.0 * (layer - 2) / 297)} ; (Hz) XY Input Shaping Test
    ```

- For *Prusa Slicer* (testing 15Hz to 60Hz):
  - Enable **Spiral vase**.
  - Under **Printer Settings** ⏵ **After layer change G-code** add:
    ```
    M493 XY A{(layer_num < 2 ? 0 : 15 + 45.0 * (layer_num - 2) / 297)} ; (Hz) XY Input Shaping Test
    ```

- In *Cura*, you'll first need to add the `InputShaping.py` file [located here](//github.com/thinkyhead/cura-ringing-tower-script/tree/ftm-m493-version-2) 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 X A29.84` to apply the frequency to X motion. (For Y you would use `M493 Y A29.84`.)

#### More Resources
TH3D Studio has created an [Input Shaper Calculator](//www.th3dstudio.com/marlin-input-shaping-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.
