--- tag: m0593 title: "M593: ZV Input Shaping" short_title: ZV Input Shaping brief: Get or set Marlin's integrated ZV Input Shaping parameters author: thinkyhead contrib: tombrazier, JonBr306 parent: G-code Commands group: motion since: 2.1.2 requires: INPUT_SHAPING_[XYZ] eeprom: true codes: [ M593 ] related: [ M493 ] parameters: - tag: D optional: true description: Set the zeta/damping factor for the specified axes. If `X`, `Y`, and `Z` are omitted, all will be set. values: - type: float tag: zeta - tag: F optional: true description: Set the damping frequency for the specified axes. If `X`, `Y`, and `Z` are omitted, all will be set. values: - type: float tag: hertz - tag: X optional: true description: Flag to set the X axis value. values: - type: flag - tag: Y optional: true description: Flag to set the Y axis value. values: - type: flag - tag: Z since: 2.1.3 optional: true description: Flag to set the Z axis value. values: - type: flag videos: - 7VLuz3hReYw - 6zMNwiJX2CQ - 2A27N8qfgZU examples: - pre: Set the frequency for X to 18.4Hz code: M593 X F18.4 - pre: Set the frequency for X, Y, and Z to 36.2Hz code: M593 F36.2 - pre: Disable Input Shaping code: M593 F0 --- 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. #### Tuning with Frequency Sweep This procedure is the fastest and uses the least amount of filament. With the Frequency Sweep method you'll print three zigzag calibration patterns. As patterns are printed with increasing speed, vibration frequency increases as well. Change in pattern should be clearly visible at resonant frequency. ##### 1. Generate calibration patterns Use the [Input Shaping Calibration Tool](/tools/input_shaping/freq-calibr.html) on this website. This tool generates optimized G-code files that you can use to determine the proper Damping Frequency and Damping/zeta factors for the X and Y axes. ##### 2. Print and Analyze Damping Frequency pattern First pattern prints zigzag patterns along the front of the build plate for Y resonance followed by along the Y-axis for X resonance. During these patterns, input shaping is set off and acceleration and jerk/junction are set to very high values. Measure the distance from start of axis pattern to change. For example: - The pattern changes or breaks at 62mm from the start. So we calculate `62 ÷ 2` and get a result of 31Hz. - Set this value with `M593 X F31` then save with `M500` and it will apply to all motion from now on. ##### 3. Print and Analyze Damping/zeta factor patterns The second and third patterns print multiple zigzag patterns for the X or Y axis. Damping/zeta factor is increased by 0.05 for each pass, starting from 0.05. Select the pattern that has the most uniform appearance below the resonant frequency. For example: - The seventh X-axis pattern is the most uniform up to 62mm from the start. So we calculate `7 x 0.05` for a damping factor of 0.35. - Set this value with `M593 X D0.35`, save with `M500`, and it will apply to all motion from now on. - Repeat the same test for the Y axis. #### Tuning with Ringing Tower 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. - For *Kiri:Moto* (testing 15Hz to 60Hz): - Enable **Infill** ⏵ **Fill Type** ⏵ **Vase**. - Under **Setup** ⏵ **Machine** ⏵ **Gcode Macros** ⏵ **Layer** add: ``` M593 F{(layer < 2 ? 0 : 15 + 45.0 * (layer - 2) / 297)} ; Hz Input Shaping Test ``` - For *Prusa Slicer* (testing 15Hz to 60Hz): - Enable **Spiral vase**. - Under **Printer Settings** ⏵ **After layer change G-code** add: ``` 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 `InputShaping.py` file [located here](//www.github.com/dsdanielko/cura-ringing-tower-script) 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. ##### 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. - 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](//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.