I recommend running Dmitry’s latest resonance testing branch and using the pulses method outlined below:
https://github.com/Klipper3d/klipper/issues/4560
https://github.com/dmbutyugin/klipper/tree/resonance-test-methods
I would only go down this path if you're getting ghosting with really high speed prints. On the Annex Engineering K3 for example, no matter how perfect the graphs looked, I was still getting some ghosting. That prompted me to go down this path. I'm now able to print at 20-30k acceleration, 250-350mm/s, and 15scv with perfect quality that can usually only be seen at significantly slower speeds.
The default settings in Klipper have the damping ratio set to .1. This should be fine for most people with sane settings. I like to go for the insane.
Once you have your graph generated, you can pull the raw CSV values into your favorite graphing software. We will use the half power method to calculate the damping ratio. Find your highest resonant frequency and divide the amplitude at this point 1.41 (or the square root of 2). Note the frequency of the intersects at this amplitude.
The two formulas that we will use are Q=f0/(f2-f1)
where f0 is your highest resonant frequency, f2 is your higher frequency at the half power intersect, and f1 is the lower.
The second formula is Q=1/(2*damping ratio)
From this you can solve for your damping ratio.
Damping ratio = (f2-f1)/(2f0)
Alternatively, look in the comments below for a nice R script and instructions for how to run it in a docker container if you don't have R installed.
You can then test your value. To do this, you need to make a small (hacky) change to input_shaper.py if you want to iterate them both at the same time.
In input_shaper.py
in the extras folder of your klipper directory, change the line damping_ratio_x, damping_ratio_y)
on line 135 to damping_ratio_x, damping_ratio_x)
You’ll need to completely restart your klipper instance with systemctl restart klipper
via ssh. Or just restart your pi completely. Do not just restart via the UI of fluidd/mainsail
You can then use the resonance test STL and iterate your damping value with the tuning tower command.
TUNING_TOWER COMMAND=SET_INPUT_SHAPER PARAMETER=DAMPING_RATIO_X START=<some value> = <some value>
Alternatively, you could create a new macro and iterate through that (from KenadyDawg44)
gcode:
{% set RATIO = params.RATIO|default(0.1) %}
SET_INPUT_SHAPER DAMPING_RATIO_X={RATIO}
SET_INPUT_SHAPER DAMPING_RATIO_Y={RATIO}
I personally iterated from 0 to .11ish with a factor of .002. You can then inspect the output and where you think it looks best. Your calculated value should get you in just about the right space if your IS graphs are clean.
Don't forget to undo the change listed above in input_shaper.py
and restart klipper again.
To apply your newly found value add it to your [input_shaper]
section of your config.
For me, I added the following to it:
[input_shaper]
...
damping_ratio_x: 0.06
damping_ratio_y: 0.06
bIRD#0068 from Discord had the following graphs and was able to calculate their damping ratio. These result images are the same gcode and frequency, but changing the damping ratio from the default of 0.1 to the calculated ones
0.0468 on x
0.0332 on y
Input shaper X | Input Shaper Y |
---|---|
Before | After |
The graph and csv produced by klipper is the PSD of the vibration, which corresponds to power or amplitude squared. The half power method is done by looking for width at half-maximum of the power graph, which corresponds to 1/sqrt(2) of the amplitude graph.
I would expect the correct damping ratio to be measured from 1/2 of the PSD instead of 1/sqrt(2). Were the measurements accurate using 1/sqrt(2)?