This commit is contained in:
Sgr A* VMT
2024-03-17 21:51:33 +08:00
7 changed files with 430 additions and 70 deletions

View File

@@ -0,0 +1,50 @@
## CAN Frequency Switching
First, connect to the host computer.
Recompile the firmware for the CAN communication device (U2C or Can Bridge) directly connected to the host computer and set the frequency to 1M to communicate with IDM.
Use the following command to query IDM's UUID:
```bash
~/klippy-env/bin/python ~/klipper/lib/canboot/flash_can.py -q
```
Download the required frequency IDM firmware and canboot overlay firmware from the cloud drive.
Execute the following command:
```bash
~/klippy-env/bin/python ~/klipper/lib/canboot/flash_can.py -f <path to canboot update firmware> -u <UUID obtained>
```
For example, `<path to canboot update firmware>` could be ~/Canboot 1M.bin. Fill in your data and remember to remove the `< >` brackets.
Wait for the execution to complete, then enter:
```bash
~/klippy-env/bin/python ~/klipper/lib/canboot/flash_can.py -f <path to new frequency IDM firmware> -u <UUID obtained>
```
For example, `<path to new frequency IDM firmware>` could be ~/IDM_CAN_8kib_offset_1M.bin. Fill in your data and remember to remove the `< >` brackets.
If you want to switch to USB communication, you can flash firmware with the USB label using the same method and solder the mode-setting jumper on the back of IDM to the side with USB.
## If you are currently using USB firmware and want to update or switch to CAN mode:
```bash
cd ~/klipper/scripts
~/klippy-env/bin/python -c 'import flash_usb as u; u.enter_bootloader("<your device serial port address>")'
cd ~
~/klippy-env/bin/python ~/klipper/lib/canboot/flash_can.py -f <firmware path> -d <your device serial port address>
```
The device serial port address refers to the address in the format /dev/serial/by-id/****. Please note that the serial port number for the second time should be different. Re-query it.
Fill in your data and remember to remove the `< >` brackets.
#### via DFU
if you managed to get your idm into dfu mode,
you can use the command below to upload canboot
```
sudo dfu-util -d ,0483:df11 -R -a 0 -s 0x8000000:leave -D <Where The Firmware Is>
```
and the command below to upload main firmware
```
sudo dfu-util -d ,0483:df11 -R -a 0 -s 0x8002000:leave -D <Where The Firmware Is>
```
Fill in your data and remember to remove the `< >` brackets.Please note that these two commands are different

View File

@@ -0,0 +1,9 @@
**Q1: I encountered an "Internal error during connect: IDM model convergence" error. What does it mean, and how can I resolve it?**
**A:** If you encounter this error, it indicates that the Z-offset value is too large. Please set the `model_offset` in the configuration file to 0 and readjust the Z-offset. If you are unable to control the Z-offset to within 1mm, redo the `idm_calibrate` calibration process.
**Q2: I received an error message at the bottom with content similar to the image below. What should I do?**
![error1](/imgs/error1.png)
**A:** If you see this error, it suggests that you need to update the IDM firmware to the latest version available on the provided cloud storage.

View File

@@ -0,0 +1,187 @@
### Notice
##### First of all:make sure you are using klipper based on python3.6 or above
Using this module requires a certain level of knowledge and experience with Klipper. Ensure that you have the ability to configure and modify it before installation.
To maintain accuracy, install the sensor coil board with its top surface as low as possible below the bottom surface of the heater block.
## Important Instructions
- Follow the tutorial strictly, especially regarding commands like G28. Only perform the mentioned steps.
- Execute the following git command in the user directory to download the accompanying script:
```bash
git clone https://gitee.com/NBTP/IDM.git
```
- Run `chmod +x IDM/install.sh` after downloading.
- If unsure about your pip source or unaware of what pip is, set pip to Tsinghua source using:
```bash
~/klippy-env/bin/pip config set global.index-url https://pypi.tuna.tsinghua.edu.cn/simple
```
Then install with:
```bash
IDM/install.sh
```
### Configuration Example for printer.cfg
```ini
[idm]
serial:
#canbus_uuid:
# Path to the serial port for the idm device. Typically has the form
# /dev/serial/by-id/usb-idm_idm_...
speed: 40.
# Z probing dive speed.
lift_speed: 5.
# Z probing lift speed.
backlash_comp: 0.5
# Backlash compensation distance for removing Z backlash before measuring
# the sensor response.
x_offset: 0.
# X offset of idm from the nozzle.
y_offset: 21.1
# Y offset of idm from the nozzle.
trigger_distance: 2.
# idm trigger distance for homing.
trigger_dive_threshold: 1.5
# Threshold for range vs dive mode probing. Beyond `trigger_distance +
# trigger_dive_threshold` a dive will be used.
trigger_hysteresis: 0.006
# Hysteresis on trigger threshold for untriggering, as a percentage of the
# trigger threshold.
cal_nozzle_z: 0.1
# Expected nozzle offset after completing manual Z offset calibration.
cal_floor: 0.1
# Minimum z bound on sensor response measurement.
cal_ceil:5.
# Maximum z bound on sensor response measurement.
cal_speed: 1.0
# Speed while measuring response curve.
cal_move_speed: 10.
# Speed while moving to position for response curve measurement.
default_model_name: default
# Name of the default idm model to load.
mesh_main_direction: x
# Primary travel direction during mesh measurement.
#mesh_overscan: -1
# Distance to use for direction changes at mesh line ends. Omit this setting
# and a default will be calculated from line spacing and available travel.
mesh_cluster_size: 1
# Radius of mesh grid point clusters.
mesh_runs: 1
# Number of passes to make during mesh scan.
```
Adjust the x and y direction offsets in the configuration. Ensure that during calibration, the nozzle moves the coils to the original xy position of the nozzle.
Add this configuration to printer.cfg and modify serial to your IDM's serial number. To find the IDM serial, use the command:
```bash
ls /dev/serial/by-id/*
```
### For CAN Version
Replace serial with canbus_uuid.
Use the following command to search for the CAN UUID and fill it in:
```bash
~/klippy-env/bin/python ~/klipper/lib/canboot/flash_can.py -q
```
Note: After adding the UUID, remove serial.
-------------------------------------------------
Include the following in the configuration (optional but recommended):
```ini
[force_move]
enable_force_move: true
```
### Remove the [probe] Module
Remove the [probe] module from your configuration.
If you've used Klicky, remove references to its scripts. Modify z limit (after stepper_z's endstop_pin:) to probe:z_virtual_endstop.
Also, set:
```ini
[safe_z_home]
home_xy_position: <your_x_axis_center_coordinate>,<your_y_axis_center_coordinate>
z_hop: 10
```
If you've configured safe_z_home or homing_override, you can skip this step.
#### Don't forget to set up [bed_mesh] to avoid errors.
Omit the zero_reference_position in bed_mesh.
After restarting, home x and y (g28 x y, don't home z), and move the nozzle to the center of the bed. Then enter SET_KINEMATIC_POSITION z=80.
Now, you can control the z-axis movement and bring the nozzle close to the bed (or place an A4 paper for the right gap). Enter SET_KINEMATIC_POSITION z=0 (note that it's different from the previous command).
Execute idm_calibrate. In the offset control box, click -0.1 for offset and confirm. It will automatically calibrate.
If, after calibration, you encounter
issues like not zeroing after a restart or reporting "no model," there might be a format error in your configuration file's auto-generated configuration. Correct the format.
For 4Z machines like VORON2.4, add the following configuration to the file:
```ini
[gcode_macro QUAD_GANTRY_LEVEL]
rename_existing: _QUAD_GANTRY_LEVEL
gcode:
    SAVE_GCODE_STATE NAME=STATE_QGL
    BED_MESH_CLEAR
    {% if not printer.quad_gantry_level.applied %}
      _QUAD_GANTRY_LEVEL horizontal_move_z=10 retry_tolerance=1
    {% endif %}
    _QUAD_GANTRY_LEVEL horizontal_move_z=2
    G28 Z
    RESTORE_GCODE_STATE NAME=STATE_QGL
```
For 3Z machines like VORON Trident, add the following configuration:
```ini
[gcode_macro Z_TILT_ADJUST]
rename_existing: _Z_TILT_ADJUST
gcode:
    SAVE_GCODE_STATE NAME=STATE_Z_TILT
    BED_MESH_CLEAR
    {% if not printer.z_tilt.applied %}
      _Z_TILT_ADJUST horizontal_move_z=10 retry_tolerance=1
    {% endif %}
    _Z_TILT_ADJUST horizontal_move_z=2
    G28 Z
    RESTORE_GCODE_STATE NAME=STATE_Z_TILT
```
It's recommended to add the following configuration to the moonraker.conf file for easy script updates:
```ini
[update_manager idm]
type: git_repo
channel: dev
path: ~/IDM
origin: https://gitee.com/NBTP/IDM.git
env: ~/klippy-env/bin/python
requirements: requirements.txt
install_script: install.sh
is_system_service: False
managed_services: klipper
info_tags:
  desc=idm
```
For versions with an accelerometer (lis2dw), add the following to enable it:
```ini
[lis2dw]
cs_pin: idm:PA3
spi_bus: spi1
[resonance_tester]
accel_chip: lis2dw
probe_points:
    125, 125, 20  #set your prefered calibrating position
```
Configure and use shaper_calibrate for resonance testing.
Adjust the z offset before printing. The z offset is saved in the model_offset variable.
### Note
Before adjusting the z offset, ensure to disable the bed mesh, complete mechanical leveling, and zero once again.
#### We also recommend using [[axis_twist_compesation]](https://www.klipper3d.org/Config_Reference.html?h=axis#axis_twist_compensation) to ensure the effectiveness of the mesh bed compensation

View File

@@ -0,0 +1,89 @@
**Optimizing Temperature Compensation Parameters Tutorial**
This tutorial aims to optimize temperature compensation parameters to reduce temperature drift. The optimization process is time-consuming (over 1 hour). If your printer's temperature compensation meets your requirements, this operation may not be necessary.
**Step 1:** Paste the following macro into your configuration file:
```ini
[gcode_macro DATA_SAMPLE]
gcode:
{% set bed_temp = params.BED_TEMP|default(90)|int %}
{% set nozzle_temp = params.NOZZLE_TEMP|default(250)|int %}
{% set min_temp = params.MIN_TEMP|default(40)|int %}
{% set max_temp = params.MAX_TEMP|default(70)|int %}
M106 S255
TEMPERATURE_WAIT SENSOR='temperature_sensor IDM_coil' MAXIMUM={min_temp}
M106 S0
G28
G0 Z1
M104 S{nozzle_temp}
M140 S{bed_temp}
TEMPERATURE_WAIT SENSOR='temperature_sensor IDM_coil' MINIMUM={min_temp}
IDM_STREAM FILENAME=data1
TEMPERATURE_WAIT SENSOR='temperature_sensor IDM_coil' MINIMUM={max_temp}
IDM_STREAM FILENAME=data1
M104 S0
M140 S0
M106 S255
G0 Z80
TEMPERATURE_WAIT SENSOR='temperature_sensor IDM_coil' MAXIMUM={min_temp}
M106 S0
G28 Z0
G0 Z2
M104 S{nozzle_temp}
M140 S{bed_temp}
G4 P1000
IDM_STREAM FILENAME=data2
TEMPERATURE_WAIT SENSOR='temperature_sensor IDM_coil' MINIMUM={max_temp}
IDM_STREAM FILENAME=data2
M104 S0
M140 S0
M106 S255
G0 Z80
TEMPERATURE_WAIT SENSOR='temperature_sensor IDM_coil' MAXIMUM={min_temp}
M106 S0
G28 Z0
G0 Z3
M104 S{nozzle_temp}
M140 S{bed_temp}
G4 P1000
IDM_STREAM FILENAME=data3
TEMPERATURE_WAIT SENSOR='temperature_sensor IDM_coil' MINIMUM={max_temp}
IDM_STREAM FILENAME=data3
M104 S0
M140 S0
M106 S255
G0 Z80
TEMPERATURE_WAIT SENSOR='temperature_sensor IDM_coil' MAXIMUM={min_temp}
M106 S0
G28 Z0
G0 Z5
M104 S{nozzle_temp}
M140 S{bed_temp}
G4 P1000
IDM_STREAM FILENAME=data4
TEMPERATURE_WAIT SENSOR='temperature_sensor IDM_coil' MINIMUM={max_temp}
IDM_STREAM FILENAME=data4
M104 S0
M140 S0
```
**Step 2:** Execute `DATA_SAMPLE BED_TMEP=<target bed temperature> NOZZLE_TEMP=<target nozzle temperature> MIN_TEMP=<minimum temperature of sampling range> MAX_TEMP=<maximum temperature of samping range>`
if you dont input any parameter,it will run with default parameters(BED_TMEP=90 NOZZLE_TEMP=250 MIN_TEMP=40 MAX_TEMP=70).
This will generate four files (data1, data2, data3, data4) in the klipper folder. This process takes a long time.
**Step 3:** Move the four generated files to the IDM folder in your user directory.
**Step 4:** Execute the following commands:
```bash
cd ~/IDM
~/klippy-env/bin/python arg_fit.py
```
(Ensure that you are using the latest script package before running. If not, git clone again.)
This will generate three parameters and an image named fit_result.png in the IDM folder. Note that this process requires significant computational power and time.
**Step 5:** Check the fit_result.png image for the fitting result. The first row shows the original data, and the second row shows the data after temperature compensation. Ensure that the fit is effective, and the offsets are controlled within a reasonable range.
**Step 6:** Copy the generated parameters to the [IDM] block in your configuration file. See the example below:
![Example](/imgs/example.jpg)

View File

@@ -24,9 +24,23 @@
```
cd ~/klipper/scripts
~/klippy-env/bin/python -c 'import flash_usb as u; u.enter_bootloader("<你的设备串口地址>")'
```
```
cd ~
~/klippy-env/bin/python ~/klipper/lib/canboot/flash_can.py -f <固件所在路径> -d <你的设备串口地址>
```
设备串口地址指的是/dev/serial/by-id/****这种格式的地址
请注意第二次串口号应与第一次不同,请重新查询
上述的内容填写自己的数据,记得删除”<>”括号
#### 通过dfu上传固件
如果你通过短接boot0再上电的方式使得你的idm进入了dfu模式
可以通过下方指令上传canboot
```
sudo dfu-util -d ,0483:df11 -R -a 0 -s 0x8000000:leave -D <文件路径>
```
还可以通过下方指令上传主固件
```
sudo dfu-util -d ,0483:df11 -R -a 0 -s 0x8002000:leave -D <文件路径>
```
上述的内容填写自己的数据,记得删除”<>”括号,请注意两个指令是不一样的

View File

@@ -1,4 +1,4 @@
#### 开始前请确保你是用的是python3.6以上的klipper
### 使用本模块需要对klipper使用有一定知识和经验积累请在使用前确保你具备自己进行配置修改的能力
为了保证精度,请安装时尽可能让传感器线圈板的顶面低于加热块的底面。
## 教程里没有提到的不要做尤其是G28提到的请务必做
@@ -6,7 +6,10 @@
```
git clone https://gitee.com/NBTP/IDM.git
```
执行chmod +x IDM/install.sh
执行下方指令赋予文件可执行权限:
```
chmod +x IDM/install.sh
```
如果你不确定自己的pip源是否是国内源或者能否正常下载新的库或者你完全不知道pip是什么,建议使用以下命令将pip设置为清华源:
```
~/klippy-env/bin/pip config set global.index-url https://pypi.tuna.tsinghua.edu.cn/simple
@@ -60,10 +63,10 @@ mesh_main_direction: x
#   and a default will be calculated from line spacing and available travel.
mesh_cluster_size: 1
#   Radius of mesh grid point clusters.
mesh_runs: 2
mesh_runs: 1
#   Number of passes to make during mesh scan.
```
请注意调整配置中的x y方向偏移。确保校准过程中喷头会将线圈移动到原先喷嘴所在xy位置。
请注意调整配置中的x y方向偏移。确保校准过程中喷头会将线圈移动到原先喷嘴所在xy位置。
将这段配置放进printer.cfg并将serial修改为你查询到的idm的串口号查询指令为
```
ls /dev/serial/by-id/*
@@ -83,8 +86,8 @@ enable_force_move: true
```
### 之后把[probe]模块删除
如果你是用过klicky请记得移除它的相关脚本的引用
并将z限位(stepper_z的endstop_pin:后面)修改为probe:z_virtual_endstop
如果你是用过klicky请记得移除它的相关脚本的引用
并将z限位(stepper_z的endstop_pin:后面)修改为probe:z_virtual_endstop
还需要设置
```
[safe_z_home]
@@ -95,13 +98,13 @@ z_hop: 10
#### 记得设置[bed_mesh]不然会报错
bed_mesh中的zero_reference_position不要配置
重启之后归零x和yg28 x y ,不要归零z
然后输入SET_KINEMATIC_POSITION z=80
之后就可以控制z方向移动将喷嘴贴到平台上也可以垫A4纸确保间隙合适
再输入SET_KINEMATIC_POSITION z=0注意这和之前那条不一样
之后执行idm_calibrate的指令
弹出的偏移控制框,请点击-0.1的偏移后确认,会自动进行校准
如果校准后重启之后无法归零报错no model那么你的配置文件的自动生成配置格式错误请修正格式。
重启之后归零x和yg28 x y ,不要归零z,并将打印头移动到热床正中央
然后输入SET_KINEMATIC_POSITION z=80
之后就可以控制z方向移动将喷嘴贴到平台上也可以垫A4纸确保间隙合适
再输入SET_KINEMATIC_POSITION z=0注意这和之前那条不一样
之后执行idm_calibrate的指令
弹出的偏移控制框,请点击-0.1的偏移后确认,会自动进行校准
如果校准后重启之后无法归零报错no model那么你的配置文件的自动生成配置格式错误请修正格式。
如果你的机器是诸如VORON2.4这样的4z机器请加入以下配置到配置文件中
```
@@ -162,4 +165,6 @@ probe_points:
配置好之后使用shaper_calibrate进行共振测量
准备工作结束后调一下z偏移再打印z偏移保存在model_offset变量中
### 调整z偏移前请务必关闭网床完成机械调平调平后要再归零一次
### 调整z偏移前请务必关闭网床完成机械调平调平后要再归零一次
#### 推荐使用 [[axis_twist_compesation]](https://www.klipper3d.org/Config_Reference.html?h=axis#axis_twist_compensation) 来确保网床的效果

View File

@@ -3,64 +3,70 @@
```
[gcode_macro DATA_SAMPLE]
gcode:
  M106 S255
  TEMPERATURE_WAIT SENSOR='temperature_sensor IDM_coil' MAXIMUM=40
  M106 S0
  G28
  G0 Z1
  M104 S250
  M140 S95
  G4 P1000
  IDM_STREAM FILENAME=data1
  TEMPERATURE_WAIT SENSOR='temperature_sensor IDM_coil' MINIMUM=70
  IDM_STREAM FILENAME=data1
  M104 S0
  M140 S0
  M106 S255
  G0 Z80
  TEMPERATURE_WAIT SENSOR='temperature_sensor IDM_coil' MAXIMUM=40
  M106 S0
  G28 Z0
  G0 Z2
  M104 S250
  M140 S95
  G4 P1000
  IDM_STREAM FILENAME=data2
  TEMPERATURE_WAIT SENSOR='temperature_sensor IDM_coil' MINIMUM=70
  IDM_STREAM FILENAME=data2
  M104 S0
  M140 S0
  M106 S255
  G0 Z80
  TEMPERATURE_WAIT SENSOR='temperature_sensor IDM_coil' MAXIMUM=40
  M106 S0
  G28 Z0
  G0 Z3
  M104 S250
  M140 S95
  G4 P1000
  IDM_STREAM FILENAME=data3
  TEMPERATURE_WAIT SENSOR='temperature_sensor IDM_coil' MINIMUM=70
  IDM_STREAM FILENAME=data3
  M104 S0
  M140 S0
  M106 S255
  G0 Z80
  TEMPERATURE_WAIT SENSOR='temperature_sensor IDM_coil' MAXIMUM=40
  M106 S0
  G28 Z0
  G0 Z5
  M104 S250
  M140 S95
  G4 P1000
  IDM_STREAM FILENAME=data4
  TEMPERATURE_WAIT SENSOR='temperature_sensor IDM_coil' MINIMUM=70
  IDM_STREAM FILENAME=data4
  M104 S0
  M140 S0
{% set bed_temp = params.BED_TEMP|default(90)|int %}
{% set nozzle_temp = params.NOZZLE_TEMP|default(250)|int %}
{% set min_temp = params.MIN_TEMP|default(40)|int %}
{% set max_temp = params.MAX_TEMP|default(70)|int %}
M106 S255
TEMPERATURE_WAIT SENSOR='temperature_sensor IDM_coil' MAXIMUM={min_temp}
M106 S0
G28
G0 Z1
M104 S{nozzle_temp}
M140 S{bed_temp}
TEMPERATURE_WAIT SENSOR='temperature_sensor IDM_coil' MINIMUM={min_temp}
IDM_STREAM FILENAME=data1
TEMPERATURE_WAIT SENSOR='temperature_sensor IDM_coil' MINIMUM={max_temp}
IDM_STREAM FILENAME=data1
M104 S0
M140 S0
M106 S255
G0 Z80
TEMPERATURE_WAIT SENSOR='temperature_sensor IDM_coil' MAXIMUM={min_temp}
M106 S0
G28 Z0
G0 Z2
M104 S{nozzle_temp}
M140 S{bed_temp}
G4 P1000
IDM_STREAM FILENAME=data2
TEMPERATURE_WAIT SENSOR='temperature_sensor IDM_coil' MINIMUM={max_temp}
IDM_STREAM FILENAME=data2
M104 S0
M140 S0
M106 S255
G0 Z80
TEMPERATURE_WAIT SENSOR='temperature_sensor IDM_coil' MAXIMUM={min_temp}
M106 S0
G28 Z0
G0 Z3
M104 S{nozzle_temp}
M140 S{bed_temp}
G4 P1000
IDM_STREAM FILENAME=data3
TEMPERATURE_WAIT SENSOR='temperature_sensor IDM_coil' MINIMUM={max_temp}
IDM_STREAM FILENAME=data3
M104 S0
M140 S0
M106 S255
G0 Z80
TEMPERATURE_WAIT SENSOR='temperature_sensor IDM_coil' MAXIMUM={min_temp}
M106 S0
G28 Z0
G0 Z5
M104 S{nozzle_temp}
M140 S{bed_temp}
G4 P1000
IDM_STREAM FILENAME=data4
TEMPERATURE_WAIT SENSOR='temperature_sensor IDM_coil' MINIMUM={max_temp}
IDM_STREAM FILENAME=data4
M104 S0
M140 S0
```
然后执行该宏之后会在klipper文件夹中生成data1,data2,data3,data4 四个文件,耗时很长。
使用`DATA_SAMPLE BED_TEMP=指定热床温度 NOZZLE=指定喷嘴温度 MIN_TEMP=采集温度范围最小值 MAX_TEMP=采集温度范围最大值`
(若不输入自定义参数,宏将按默认值运行(BED_TMEP=90 NOZZLE_TEMP=250 MIN_TEMP=40 MAX_TEMP=70))
即可开始采集数据之后会在klipper文件夹中生成data1,data2,data3,data4 四个文件,耗时较长。
完成后将4个文件移动到用户目录下的IDM文件夹中。
然后执行
```