I have an unusual Klipper setup (multiple printers in Docker) and found that the docs for the PIS and prind didn't meet my needs. This is what I did for my Sovol SV06.
As always, do everything at your own risk. These steps will could be different for your printer and configuration, so use at your own risk.
Follow the instructions to flash the PIS on prind's Readme.
Plug in the Portable Input Shaper, confirm it appears in Linux:
ls /dev/serial/by-id
This should show something like usb-Klipper_rp2040_E6611CB6975B6821-if00
Now, create a file called pis.cfg
in your Klipper config directory for that printer:
[mcu PIS]
# Obtain definition by "ls -l /dev/serial/by-id/" then unplug to verify
serial: /dev/serial/by-id/usb-Klipper_rp2040_E6611CB6975B6821-if00
[adxl345]
cs_pin: PIS:gpio13
spi_software_sclk_pin: PIS:gpio10
spi_software_mosi_pin: PIS:gpio11
spi_software_miso_pin: PIS:gpio12
axes_map: x,-z,y
[resonance_tester]
accel_chip: adxl345
# you need to change this - this works for the SV-06 with a 220x220 bed (e.g. middle of the bed)
probe_points:
110, 110, 20
Add this to your printer.cfg
for your printer
[include pis.cfg]
Now run ACCELEROMETER_QUERY
from Mainsail or Fluidd console. It should return something like:
// accelerometer values (x, y, z): -1184.329507, 536.266849, 10362.883188
Then home all axis on the printer.
Run TEST_RESONANCES AXIS=X
from the Mainsail or Fluidd console.
It should run through a number of test that start with // Testing frequency 5 Hz
and end with // Testing frequency 133 Hz
, finally returning something that looks like
// Resonances data written to /tmp/resonances_x_20240203_164810.csv file
First make a directory on your docker host machine somewhere not in a shared volume with your docker. Mine is ~/sovol-sv06-calibrate/resonances
Find the correct container for your printer:
docker ps --format "{{ .Names }}"
Mine is unified-prind-sovol-sv06-klipper-1
Then check the tmp
on the container for the file written in the previous step:
docker exec unified-prind-sovol-sv06-klipper-1 ls /tmp
It should be the file mentioned on the Klipper console (e.g. resonances_x_20240203_164810.csv
)
Now, transfer that file to your host machine.
docker cp unified-prind-sovol-sv06-klipper-1:/tmp/resonances_x_20240203_164810.csv ~/sovol-sv06-calibrate/resonances/
It should return something like:
Successfully copied 7.68kB to ...
Remove the file from the Klipper container.
docker exec -it unified-prind-sovol-sv06-klipper-1 /bin/bash
rm /tmp/resonances_x_20240203_164810.csv
Repeat with the other axis by going back to the section 'Gather data from the Accelerometer' and changing the axis values as needed.
In the /prind
directory edit the file docker-compose.extra.calibrate-shaper.yaml
In the original file the last bit of YAML should look like this:
volumes:
- ./resonances:/opt/resonances
Change the part before the :
to the full path of your resonances directory.
Then run the following, replacing <csv>
and <axis>
with your csv file and axis letter respectively
docker compose -f docker-compose.extra.calibrate-shaper.yaml run --rm calibrate_shaper <csv> -o cal_x.png
docker compose -f docker-compose.extra.calibrate-shaper.yaml run --rm calibrate_shaper resonances_y_20240203_173653.csv -o cal_y.png
You'll get an output that looks something like this for each axis.
Here is mine for X:
[+] Building 0.0s (0/0)
[+] Building 0.0s (0/0)
Fitted shaper 'zv' frequency = 55.4 Hz (vibrations = 0.7%, smoothing ~= 0.057)
To avoid too much smoothing with 'zv', suggested max_accel <= 12000 mm/sec^2
Fitted shaper 'mzv' frequency = 56.8 Hz (vibrations = 0.0%, smoothing ~= 0.063)
To avoid too much smoothing with 'mzv', suggested max_accel <= 9500 mm/sec^2
Fitted shaper 'ei' frequency = 67.8 Hz (vibrations = 0.0%, smoothing ~= 0.070)
To avoid too much smoothing with 'ei', suggested max_accel <= 8600 mm/sec^2
Fitted shaper '2hump_ei' frequency = 84.2 Hz (vibrations = 0.0%, smoothing ~= 0.076)
To avoid too much smoothing with '2hump_ei', suggested max_accel <= 7900 mm/sec^2
Fitted shaper '3hump_ei' frequency = 100.8 Hz (vibrations = 0.0%, smoothing ~= 0.081)
To avoid too much smoothing with '3hump_ei', suggested max_accel <= 7400 mm/sec^2
Recommended shaper is zv @ 55.4 Hz
And mine for Y:
[+] Building 0.0s (0/0)
[+] Building 0.0s (0/0)
Fitted shaper 'zv' frequency = 34.6 Hz (vibrations = 31.2%, smoothing ~= 0.130)
To avoid too much smoothing with 'zv', suggested max_accel <= 4500 mm/sec^2
Fitted shaper 'mzv' frequency = 50.8 Hz (vibrations = 5.3%, smoothing ~= 0.079)
To avoid too much smoothing with 'mzv', suggested max_accel <= 7600 mm/sec^2
Fitted shaper 'ei' frequency = 33.0 Hz (vibrations = 6.4%, smoothing ~= 0.296)
To avoid too much smoothing with 'ei', suggested max_accel <= 2000 mm/sec^2
Fitted shaper '2hump_ei' frequency = 63.6 Hz (vibrations = 0.1%, smoothing ~= 0.133)
To avoid too much smoothing with '2hump_ei', suggested max_accel <= 4500 mm/sec^2
Fitted shaper '3hump_ei' frequency = 73.8 Hz (vibrations = 0.0%, smoothing ~= 0.150)
To avoid too much smoothing with '3hump_ei', suggested max_accel <= 4000 mm/sec^2
Recommended shaper is 2hump_ei @ 63.6 Hz
I used scp
to grab the graphs from my docker host on to my laptop.
scp kyle@something.local:/path/to/sovol-sv06-calibrate/resonances/cal_x.png ~/Downloads/sovol_sv06_cal_x.png
Add a section to your printer.cfg
called [input_shaper]
based on the recommended shapers.
Mine looked like this:
[input_shaper]
shaper_freq_x: 55.4
shaper_type_x: zv
shaper_freq_y: 63.6
shaper_type_y: 2hump_ei
Then find the printer.max_accel
value in this file and change it to the lower of the two max acceleration figures for your shaper types.
For example, my x
shaper is zv
and the output from the analysis says this:
Fitted shaper 'zv' frequency = 55.4 Hz (vibrations = 0.7%, smoothing ~= 0.057)
To avoid too much smoothing with 'zv', suggested max_accel <= 12000 mm/sec^2
And my y
is 2hump_ei
and the output from the analysis says:
Fitted shaper '2hump_ei' frequency = 63.6 Hz (vibrations = 0.1%, smoothing ~= 0.133)
To avoid too much smoothing with '2hump_ei', suggested max_accel <= 4500 mm/sec^2
So, I set my max_accel
to 4500
(not 1200
as described in the x
description).
Save the file and restart your Klipper with your tuned printer.