• 注册
  • VORON VORON 关注:21 内容:49

    Klipper 下Voron打印机打印头谐振测量与调整

  • 查看作者
  • 打赏作者
    • 1
    • VORON
    • 小钳子。对照直译

      input sharper:我翻译成了输入滤波,输入锐化,输入阵形,请注意。简单说就是对输入波形进行滤波


      Measuring Resonances//谐振测量

      Klipper has built-in support for ADXL345 accelerometer, which can be used to measure resonance frequencies of the printer for different axes, and auto-tune input shapers to compensate for resonances. Note that using ADXL345 requires some soldering and crimping. ADXL345 can be connected to a Raspberry Pi directly, or to an SPI interface of an MCU board (it needs to be reasonably fast).

      Klipper支持ADXL345 加速度传感器,可以用于测量打印机不同轴的谐振,并且自动调整参数适应各自的打印机。 需要注意使用ADXL345需要一点动手能力,包括焊接等。 ADXL345可以直接通过树莓派的SPI接口连接(树莓派直接连接加速度计是为了高速收发数据)。


      Installation instructions//如何连接

      You need to connect ADXL345 to your Raspberry Pi via SPI. Note that the I2C connection, which is suggested by ADXL345 documentation, has too low throughput and will not work. The recommended connection scheme:

      树莓派与ADXL345使用SPI接口进行连接。虽然说ADXL345同样也有I2C接口,但是由于速度较低所以这里不采用。 推荐的连接方式如下图:

      Klipper 下Voron打印机打印头谐振测量与调整

      Double-check your wiring before powering up the Raspberry Pi to prevent damaging it or the accelerometer.


      Mounting the accelerometer//如何安装加速度传感器

      The accelerometer must be attached to the toolhead. One needs to design a proper mount that fits their own 3D printer. It is better to align the axes of the accelerometer with the printer's axes (but if it makes it more convenient, axes can be swapped – i.e. no need to align X axis with X and so forth – it should be fine even if Z axis of accelerometer is X axis of the printer, etc.).

      加速度传感器必须安装的靠近打印头。对于不同的打印机请使用合适的方式安装到自己的打印机上。 安装的时候需要注意,将加速度传感器的xyz轴与打印机的xyz轴对准(当然了,为了方便安装,xy轴可以交换-即便是加速度传感器的Z轴与打印机的x轴对齐也是可以用的//实际上不推荐。)


      An example of mounting ADXL345 on the SmartEffector:


      Klipper 下Voron打印机打印头谐振测量与调整

      Note that on a bed slinger printer one must design 2 mounts: one for the toolhead and one for the bed, and run the measurements twice. See the corresponding section for more details.


      Software installation//软件的安装

      Note that resonance measurements and shaper auto-calibration require additional software dependencies not installed by default. First, you will have to run on your Raspberry Pi the following command:

      由于共振的测量与自动修正需要依赖其它软件,并且默认情况下并没有安装。 首先,我们需要运行下面的代码

      ~/klippy-env/bin/pip install -v numpy
      //上面是安装numpy,一个树莓派python 的运算模块

      to install numpy package. Note that, depending on the performance of the CPU, it may take a lot of time, up to 10-20 minutes. Be patient and wait for the completion of the installation. On some occasions, if the board has too little RAM, the installation may fail and you will need to enable swap.

      为了安装numpy。需要注意的是:取决于CPU的运算性能,上面的过程可能会持续10~20分钟时间。 请耐心的等待完成安装。有时候如果板子的RAM太小,安装可能会失败,那就要重新安装。

      Next, run the following command to install the additional dependencies:

      下一步 ,安装下面的依赖软件:

      sudo apt install python-numpy python-matplotlib



      Afterwards, check and follow the instructions in the RPi Microcontroller document to setup the “linux mcu” on the Raspberry Pi.

      按照引用文档,将树莓派设置为 linux mcu,使得树莓派可以使用SPI接口为下面的步骤做准备。

      Make sure the Linux SPI driver is enabled by running sudo raspi-config and enabling SPI under the “Interfacing options” menu.

      Add the following to the printer.cfg file:

      然后,检查树莓派文档,确定树莓派的SPI接口是否已经打开,可以运行sudo raspi-config在“Interfacing options”里面来使能SPI接口。另外还需增加以下内容到 Klipper 的printer.cfg文件:

      [mcu rpi]serial: /tmp/klipper_host_mcu[adxl345]cs_pin: rpi:None[resonance_tester]accel_chip: adxl345
          100,100,20  # an example

      It is advised to start with 1 probe point, in the middle of the print bed, slightly above it.

      Restart Klipper via the RESTART command.


      Measuring the resonances//测量谐振

      Checking the setup//检查设置

      Now you can test a connection. In Octoprint, run ACCELEROMETER_QUERY. You should see the current measurements from the accelerometer, including the free-fall acceleration, e.g.

      现在可以开始测试加速度传感器和树莓派的连接状态了,在Octoprint上,运行 ACCELEROMETER_QUERY。


      Recv: // adxl345 values (x, y, z): 470.719200, 941.438400, 9728.196800

      If you get an error like Invalid adxl345 id (got xx vs e5), where xx is some other ID, it is indicative of the connection problem with ADXL345, or the faulty sensor. Double-check the power, the wiring (that it matches the schematics, no wire is broken or loose, etc.), and soldering quality.

      如果你看到如下错误比如, xx是一个ID,Invalid adxl345 id (got xx vs e5)指明到一个与加速度传感器ADXL345的连接错误,重复检查电源,接线(是否与原理图对应,没有连线断开或者丢失等),有时需要检查焊接质量。

      Next, try running MEASURE_AXES_NOISE in Octoprint, you should get some baseline numbers for the noise of accelerometer on the axes (should be somewhere in the range of ~1-100).


      Measuring the resonances//测量谐振

      Now you can run some real-life tests. In printer.cfg add or replace the following values:


      [printer]max_accel: 7000max_accel_to_decel: 7000

      (after you are done with the measurements, revert these values to their old, or the newly suggested values). Also, if you have enabled input shaper already, you will need to disable it prior to this test as follows:

      (当你完成所有测量后,可以更改上面的数值多玩玩)并且如果你使能了输入滤波“input shaper”,你需要在测量前将其关闭,关闭方式为:


      as it is not valid to run the resonance testing with the input shaper enabled.


      Run the following command:



      Note that it will create vibrations on X axis.//笔记,这个会让x轴产生振动

      Attention! Be sure to observe the printer for the first time, to make sure the vibrations do not become too violent (M112 command can be used to abort the test in case of emergency; hopefully it will not come to this though). If the vibrations do get too strong, you can attempt to specify a lower than the default value for accel_per_hz parameter in [resonance_tester] section, e.g.

      注意!请全程观察打印机,来确保打印机没有产生与预期不符的动作,比如说撞击打印机框架(可以使用M112命令来紧急停止测试;然而正常情况下不会出现这种状况),如果谐振幅度太大,你可以尝试在[resonance_tester]部分修改accel_per_hz 参数使其低于默认值,比如。

      [resonance_tester]accel_chip: adxl345
      accel_per_hz: 50  # default is 75probe_points: ...

      If it works for X axis, run for Y axis as well: //如果X轴运行正常,请同样运行Y轴


      This will generate 2 CSV files (/tmp/resonancesx.csv and /tmp/resonancesy.csv). These files can be processed with the stand-alone script on a Raspberry Pi. To do that, run running the following commands:

      运行以上命令会在(/tmp/resonancesx.csv and /tmp/resonancesy.csv)里生成两个CSV数据文件。这个文件可以使用下面的命令生成图表。请使用下面的命令来生成相应的图表

      ~/klipper/scripts/calibrate_shaper.py /tmp/resonances_x_*.csv -o /tmp/shaper_calibrate_x.png~/klipper/scripts/calibrate_shaper.py /tmp/resonances_y_*.csv -o /tmp/shaper_calibrate_y.png

      Klipper 下Voron打印机打印头谐振测量与调整

      Fitted shaper 'zv' frequency = 56.7 Hz (vibrations = 23.2%)Fitted shaper 'mzv' frequency = 52.9 Hz (vibrations = 10.9%)Fitted shaper 'ei' frequency = 62.0 Hz (vibrations = 8.9%)Fitted shaper '2hump_ei' frequency = 59.0 Hz (vibrations = 4.9%)Fitted shaper '3hump_ei' frequency = 65.0 Hz (vibrations = 3.3%)Recommended shaper is 2hump_ei @ 59.0 Hz

      The suggested configuration can be added to [input_shaper] section of printer.cfg:

      可以在 printer.cfg文件的 [input_shaper]增加配置:

      [input_shaper]shaper_freq_x: 59.0shaper_type_x: 2hump_ei
      shaper_freq_y: ...shaper_type_y: ...

      or you can choose some other configuration yourself based on the generated charts: peaks in the power spectral density on the charts correspond to the resonance frequencies of the printer.


      Note that alternatively you can run the input shaper autocalibration from Klipper directly, which can be convenient, for example, for the input shaper re-calibration.


      Bed-slinger printers //对于热床运动的打印机 这部分没翻译,因为没啥用

      If your printer is a bed slinger printer, you will need to change the location of the accelerometer between the measurements for X and Y axes: measure the resonances of X axis with the accelerometer attached to the toolhead and the resonances of Y axis – to the bed (the usual bed slinger setup).

      However, you can also connect two accelerometers simultaneously, though they must be connected to different boards (say, to an RPi and printer MCU board), or to two different physical SPI interfaces on the same board (rarely available). Then they can be configured in the following manner:

      [adxl345 adxl345_x]# Assuming adxl345_x is connected to an RPics_pin: rpi:None[adxl345 adxl345_y]# Assuming adxl345_y is connected to a printer MCU boardcs_pin: ...  # Printer board SPI chip select (CS) pin[resonance_tester]accel_chip_x: adxl345_x
      accel_chip_y: adxl345_y
      probe_points: ...

      Then the commands TEST_RESONANCES AXIS=X and TEST_RESONANCES AXIS=Y will use the correct accelerometer for each axis.

      Selecting max_accel//选择最大加速度

      Keep in mind that the input shaper can create some smoothing in parts, especially at high accelerations. Therefore, after the calibration is finished, you will still need to choose the max_accel value that does not create too much smoothing in the printed parts. Follow this part of the input shaper tuning guide and print the test model.

      需要注意的是输入滤波会产生更平滑的打印件,特别是在比较高的加速度下。 因此,当整定结束后,你依然需要选择max_accel值但是并不会产生更平滑的打印件

      The same notice applies to the input shaper auto-calibration with SHAPER_CALIBRATE command: it is still necessary to choose the right max_accel value after the auto-calibration.


      Input Shaper auto-calibration//输入滤波 自动较准


      Besides manually choosing the appropriate parameters for the input shaper feature, it is also possible to run the auto-tuning for the input shaper directly from Klipper. Run the following command via Octoprint terminal:

      除了手动选择合适的输入滤波参数以外,也可以在Klipper上选择自动输入滤波,在Klipper 控制台运行一下命令:


      This will run the full test for both axes and generate the csv output (/tmp/calibrationdata*.csv by default) for the frequency response and the suggested input shapers. You will also get the suggested frequencies for each input shaper, as well as which input shaper is recommended for your setup, on Octoprint console. For example:

      对于频率响应和建议的输入滤波数值,上面的命令会完整的运行xy两个轴的测试并且生成CSV文件(默认保存在/tmp/calibrationdata*.csv)。在Octoprint 控制台上,你也会得到输入滤波的建议值,并且推荐使用的输入滤波值。比如:

      Fitted shaper 'zv' frequency = 56.7 Hz (vibrations = 23.2%)Fitted shaper 'mzv' frequency = 52.9 Hz (vibrations = 10.9%)Fitted shaper 'ei' frequency = 62.0 Hz (vibrations = 8.9%)Fitted shaper '2hump_ei' frequency = 59.0 Hz (vibrations = 4.9%)Fitted shaper '3hump_ei' frequency = 65.0 Hz (vibrations = 3.3%)Recommended shaper_type_y = 2hump_ei, shaper_freq_y = 59.0 Hz

      If you agree with the suggested parameters, you can execute SAVE_CONFIG now to save them and restart the Klipper.

      如果你接受建议的数值,请使用SAVE_CONFIG 命令保存并且重启Klipper。

      If your printer is a bed slinger printer, you can specify which axis to test, so that you can change the accelerometer mounting point between the tests (by default the test is performed for both axes):

      如果你的打印机为 bed slinger printer(比如ender3 那种热床动的)。。。。不翻译了,corexy热床不动


      You can execute SAVE_CONFIG twice – after calibrating each axis.

      However, if you connected two accelerometers simultaneously, you simply run SHAPER_CALIBRATE without specifying an axis to calibrate the input shaper for both axes in one go.

      Input Shaper re-calibration

      SHAPER_CALIBRATE command can be also used to re-calibrate the input shaper in the future, especially if some changes to the printer that can affect its kinematics are made. One can either re-run the full calibration using SHAPER_CALIBRATE command, or restrict the auto-calibration to a single axis by supplying AXIS= parameter, like



      Warning! It is not advisable to run the shaper autocalibration very frequently (e.g. before every print, or every day). In order to determine resonance frequencies, autocalibration creates intensive vibrations on each of the axes. Generally, 3D printers are not designed to withstand a prolonged exposure to vibrations near the resonance frequencies. Doing so may increase wear of the printer components and reduce their lifespan. There is also an increased risk of some parts unscrewing or becoming loose. Always check that all parts of the printer (including the ones that may normally not move) are securely fixed in place after each auto-tuning.

      Also, due to some noise in measurements, it is possible that the tuning results will be slightly different from one calibration run to another one. Still, it is not expected that the noise will affect the print quality too much. However, it is still advised to double-check the suggested parameters, and print some test prints before using them to confirm they are good.

      Offline processing of the accelerometer data

      It is possible to generate the raw accelerometer data and process it offline (e.g. on a host machine), for example to find resonances. In order to do so, run the following commands via Octoprint terminal:



      ignoring any errors for SET_INPUT_SHAPER command. For TEST_RESONANCES command, specify the desired test axis. The raw data will be written into /tmp directory on the RPi.

      The raw data can also be obtained by running the command ACCELEROMETER_MEASURE command twice during some normal printer activity – first to start the measurements, and then to stop them and write the output file. Refer to G-Codes for more details.

      The data can be processed later by the following scripts: scripts/graph_accelerometer.py and scripts/calibrate_shaper.py. Both of them accept one or several raw csv files as the input depending on the mode. The graph_accelerometer.py script supports several modes of operation:

      • plotting raw accelerometer data (use -r parameter), only 1 input is supported;

      • plotting a frequency response (no extra parameters required), if multiple inputs are specified, the average frequency response is computed;

      • comparison of the frequency response between several inputs (use -c parameter); you can additionally specify which accelerometer axis to consider via -a x-a y or -a z parameter (if none specified, the sum of vibrations for all axes is used);

      • plotting the spectrogram (use -s parameter), only 1 input is supported; you can additionally specify which accelerometer axis to consider via -a x-a y or -a z parameter (if none specified, the sum of vibrations for all axes is used).

      Note that graph_accelerometer.py script supports only the raw_data.csv files and not resonances.csv or calibration_data*.csv files.

      For example,

      ~/klipper/scripts/graph_accelerometer.py /tmp/raw_data_x_*.csv -o /tmp/resonances_x.png -c -a z


      will plot the comparison of several /tmp/raw_datax*.csv files for Z axis to /tmp/resonances_x.png file.

      The shaper_calibrate.py script accepts 1 or several inputs and can run automatic tuning of the input shaper and suggest the best parameters that work well for all provided inputs. It prints the suggested parameters to the console, and can additionally generate the chart if -o output.png parameter is provided, or the CSV file if -c output.csv parameter is specified.

      Providing several inputs to shaper_calibrate.py script can be useful if running some advanced tuning of the input shapers, for example:

      • Running TEST_RESONANCES AXIS=X OUTPUT=raw_data (and Y axis) for a single axis twice on a bed slinger printer with the accelerometer attached to the toolhead the first time, and the accelerometer attached to the bed the second time in order to detect axes cross-resonances and attempt to cancel them with input shapers.

      • Running TEST_RESONANCES AXIS=Y OUTPUT=raw_data twice on a bed slinger with a glass bed and a magnetic surfaces (which is lighter) to find the input shaper parameters that work well for any print surface configuration.

      • Combining the resonance data from multiple test points.

      • Combining the resonance data from 2 axis (e.g. on a bed slinger printer to configure X-axis input_shaper from both X and Y axes resonances to cancel vibrations of the bed in case the nozzle 'catches' a print when moving in X axis direction).


      root@fluiddpi:/home/pi# apt install python-numpy python-matplotlib

      Reading package lists... Done

      Building dependency tree... Done

      Reading state information... Done

      Package python-matplotlib is not available, but is referred to by another package.

      This may mean that the package is missing, has been obsoleted, or

      is only available from another source

      Package python-numpy is not available, but is referred to by another package.

      This may mean that the package is missing, has been obsoleted, or

      is only available from another source

      E: Package 'python-numpy' has no installation candidate

      E: Package 'python-matplotlib' has no installation candidate



      帖子间隔 侧栏位置: