Skip to content

Conversation

@narno2202
Copy link
Contributor

@narno2202 narno2202 commented Nov 3, 2025

Description

As FT_MOTION has recently improved, it's perhaps time to introduce a resonnance test to calibrate the shapers. @rondlh has posted 2 PRs with preliminary support for can bus and ADXL345. This test generates a sine wave pulse for the FT_MOTION system. FT_MOTION and FTM_RESONANCE_TEST must be enabled in Configuration_adv.h; EMERGENCY_PARSER is also mandatory to stop prematurely the test if needed. The test can be launched for X or Y axis (via gcode, default is X axis). If you have a USB accelerometer connected to your printer, you can start the test and then calculate the resonance frequency via the menu or a gcode giving the time value of your vibration peak. Now, There is no function to caculate the damping ratio.

Introduces 2 new G-codes:

  • M495 to set parameters and launch the test.
  • M496 to abort it via emergency parser which must be enabled.

Default parameters are largely inspired by Klipper. If no parameters are given M495 S launches the test on the X axis.

    AxisEnum axis       = X_AXIS;     // Axis to test
    float min_freq      = 5.0f;       // Minimum frequency [Hz]
    float max_freq      = 100.0f;     // Maximum frequency [Hz]
    float hz_per_sec    = 1.0f;       // Frequency change rate [Hz/sec]
    float accel_per_hz  = 60.0f;      // Acceleration per Hz [mm/sec^2/Hz] or [g/Hz]
    int16_t amplitude_correction = 5; // Amplitude correction factor

A menu is provided to launch the test on X or Y axis with the default values and to abort it. You can also simply compute the resonance frequency by giving the timeline value of your peak vibration either in the menu or via M495 G xx.xxx (in seconds and milliseconds)

/**
 * M495: Configure and run the resonance test
 * M495 S       : Start the test with default values or with last set parameters
 * M495 X S     : Start the test on X axis with default values or with last set parameters
 * M495 Y S     : Start the test on Y axis with default values or with last set parameters
 * M495 G <val> : Get resonance frequency from timeline value
 *
 *   [A<accel/Hz>] Accel per Hz (default 60.00f).
 *   [F<Hz>]       Start frequency (default 5.0f).
 *   [R<Hz/s>]     Frequency increase rate (default 1.0f).
 *   [S]           Start the test.
 *   [T<Hz>]       End frequency (default 100.0f).
 *   [C<int>]      Amplitude correction factor (default 2).
 *   [X]           Select X axis.
 *   [Y]           Select Y axis.
 *   [G<float>]    Get Resonnance frequency with timeline value (seconds and milliseconds ie 12.345)
 *   If no parameters are given, the current configuration is reported.
 **/
resonance_test.mp4

Requirements

FT_MOTION and FTM_RESONANCE_TEST enabled in Configuration_adv.h

@dbuezas
Copy link
Contributor

dbuezas commented Nov 3, 2025

Oh cool, you used the new exchangeable trajectory generators for it

@narno2202
Copy link
Contributor Author

The first version was before the merge of your last FT_MOTION changes (great changes). Finally, it was simpler to code than before, once I understood the changes.

@oliof
Copy link
Contributor

oliof commented Nov 3, 2025

Can we warn for peaks below the minimum shaper requency set for FT_MOTION?

@narno2202 narno2202 changed the title FTM: Preliminary Resoance Testing support FTM: Preliminary Resonance Testing support Nov 3, 2025
@narno2202
Copy link
Contributor Author

@oliof, This is not possible as we don't have the data from the accelerometer in Marlin. Data must be recorded by an external accelerometer (for now) and then you can get the resonance frequency in Marlin when you enter the timeline value via the menu or the gcode. Or perhaps you talk about a warning when the frequency is calculated?

@thinkyhead
Copy link
Member

It's so much fun to watch the frequency test when it gets close to the refresh rate of the camera CCD.

@dbuezas
Copy link
Contributor

dbuezas commented Nov 4, 2025

Z support would ve fantastic too, its currently the hardest to calibrate, and very useful in some machines. Video example (in this other pr

@oliof
Copy link
Contributor

oliof commented Nov 4, 2025

@oliof Or perhaps you talk about a warning when the frequency is calculated?

Yes

@oliof
Copy link
Contributor

oliof commented Nov 4, 2025

Side note: it might be worth revisiting https://github.com/pfn/stickc-accel for machines without CAN support for a detachable sensor.

@Nuck-TH
Copy link

Nuck-TH commented Nov 4, 2025

May want to check out how calibration movements implemented in klipper - they recently moved from "shaking in place" to sweeping motions which works better if there is friction in axis where just vibration may not move toolhead/bed at all.

@narno2202
Copy link
Contributor Author

@dbuezas , for Z testing do we need to change default parameters to match Z axis?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

5 participants