IDM Scanner for Klipper – Quick install, update and configuration
Credits:
Aldo Alessi
Marco Formenton
Telegram Group VzBot Italia
https://t.me/vzbotitalia
ModularPrintingSystem
Killajoedotcom
Sgr A* VMT NBTP on GITEE
Prerequisites for Klipper
Connect to you Raspberry or TvBox with Armbian with a Client SSH (Putty), login and type these commands:
/home/pi/klippy-env/bin/python -m pip install --upgrade pip
python3 -m pip install --upgrade pip
pip3 install pyserial
cd ~
rm -rf ~/IDM
Choose GITEE or MPS/Killajoedotcom repository
- from GITEE IDM Scanner
rm -rf ~/IDM
git clone https://gitee.com/NBTP/IDM.git
- from Killajoedotcom or MPS IDM Scanner (USB/CAN Bootloaders and Firmwares included)
rm -rf ~/IDM
git clone https://github.com/Killajoedotcom/IDM.git
# Deprecated
# git clone https://github.com/ModularPrintingSystem/IDM.git
Give permission to execute the script
sudo chmod +x IDM/install.sh
IDM/install.sh
To find the IDM USB SERIAL, use the command
ls /dev/serial/by-id/*
take note of your #Serial_USB# like this:
/dev/serial/by-id/usb-IDM_614e_2C0013001743565537353020-if00
If you want only update the firmware/bootloader, search the paragraph below.
Find the the IDM CAN UUID
cd ~
git clone https://github.com/Arksine/katapult.git
To enable the canbus on the raspberry pi you need to create the interface file:
sudo nano /etc/network/interfaces.d/can0
paste the following content:
allow-hotplug can0
iface can0 can static
bitrate 1000000
up ifconfig $IFACE txqueuelen 1024
Canbus Query
~/klippy-env/bin/python ~/klipper/lib/canboot/flash_can.py -q
Update Manager
Add this to your moonraker.conf
[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
Accelerometer
Add this in your printer.cfg
[lis2dw]
cs_pin: idm:PA3
spi_bus: spi1
[resonance_tester]
accel_chip: lis2dw
probe_points:
125, 125, 20 #set your preferred calibrating position
For 2Z (Sapphire Plus) or 3Z Z-Tilt (RatRig) add this to your printer.cfg
[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
For Quad Gantry (Voron) add this to your printer.cfg
[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
Prerequisites printer.cfg
In your printer.cfg remove the section [probe] and add
[force_move]
enable_force_move: true
If you want use IDM as Z Endstop
[stepper_z]
endstop_pin: probe:z_virtual_endstop
homing_retract_dist: 0 # idm needs this to be set to 0
# position_endstop:
[stepper_z1] ... [stepper_zn]
endstop_pin: probe:z_virtual_endstop
[safe_z_home]
home_xy_position: 100,100 # your X,Y axis center coordinates
z_hop: 10
[bed_mesh]
#configure it correctly
If you use other Z Endstops (microswitch or optical) and use the IDM only for mesh,
you can use IDM to calibrate the Z-offset with
Automatic Z-Calibration
https://github.com/protoloft/klipper_z_calibration
[idm] section in printer.cfg
Add in your printer.cfg the [idm] section
An example here:
https://github.com/Travis90x/Klipper-configuration/blob/main/config/sensors/probe/IDM.cfg
First Use of IDM Scanner
In your printer.cfg edit your [stepper_z] position_min: -5
Remember: at the end of the calibration reset position_min to your previuous value, to zero or comment it).
Put an A4 paper on the center of the bed, move manually the toolhead at the center of the bed or with
Klipper Console:
BED_MESH_CLEAR
G28 X
G28 Y
G0 X150 Y150 # Use your XY center coordinates
Move manually the bed near the nozzle or with the command
WARNING: using SET_KINEMATIC_POSITION is dangerous, so be careful when moving the bed using klipper commands
SET_KINEMATIC_POSITION z=50
G0 Z-1
bring the nozzle close to the bed with G0 Z-1 or smaller movements with G0 Z-0.1
If you got errors like “Move out of range“, redo SET_KINEMATIC_POSITION z=50
When the nozzle touch the A4 paper
SET_KINEMATIC_POSITION Z=0
remove the A4 paper and
IDM_CALIBRATE
If “Move out of range” occurs, you are calibrating near Y0 edge, IDM need to move in Y to calibrate.
In the Manual Probe box, simply click on [ -0.1 ] and ACCEPT.
Press on SAVE CONFIG (or interminal SAVE_CONFIG) to apply the paramenters to IDM and restart the firmware.
At the end of your printer.cfg appear a code to not modify.
#*# [idm model default]
#*# model_coef = 1.3583554887304647,
#*# 1.786028882815275,
#*# 0.8194468241239814,
#*# 0.4864248836133853,
#*# 0.28801485739900096,
#*# 0.018835898527372833,
#*# -0.21416051598772393,
#*# 0.05112239679907108,
#*# 0.29905809937167754,
#*# 0.11025627427006675
#*# model_domain = 3.2158934947231884e-07,3.3540612416377475e-07
#*# model_range = 0.100000,5.000000
#*# model_temp = 24.126179
#*# model_offset = 0.00000
First Tests
G28 Z
IDM_QUERY
IDM_PROBE
PROBE_ACCURACY
IDM_ESTIMATE_BACKLASH
If change the Z Offset, to apply click on SAVE in Toolhead or :
Z_OFFSET_APPLY_PROBE
To set permanently, use SAVE_CONFIG
Write in the console IDM and press the “tab key” to see all supported commands.
To test Z screws backlash
IDM_ESTIMATE_BACKLASH
Axis twist compensation
We also recommend using [axis_twist_compensation] to ensure the effectiveness of the mesh bed compensation
Update IDM USB – Firmware and Bootloader
Please follow “Prerequisites for Klipper” at the beginning of this guide, then take note of your #Serial_USB#
Example: /dev/serial/by-id/usb-IDM_614e_2C0013001743565537353020-if00
ls /dev/serial/by-id/*
Put IDM USB in Bootloader Mode
cd ~/klipper/scripts
~/klippy-env/bin/python -c 'import flash_usb as u; u.enter_bootloader("#Serial_USB#")'
cd
Example:
~/klippy-env/bin/python -c ‘import flash_usb as u; u.enter_bootloader(“/dev/serial/by-id/usb-IDM_614e_2C0013001743565537353020-if00″)’
ls /dev/serial/by-id/*
Now take note of the #Serial_Boot# (different from #Serial_USB#)
Example: /dev/serial/by-id/usb-katapult_stm32f042x6_2C0013001743565537353020-if00
This is the serial when IDM is in Bootloader mode, now you can flash firmware or bootloader.
Update IDM USB Firmware with GITEE
If you git the installation script from GITEE, download IDM Firmware USB with
cd ~
mkdir -p ~/IDM/Firmware
wget -P ~/IDM/Firmware "https://gitee.com/NBTP/idm-documents/blob/master/IDM%E5%9B%BA%E4%BB%B6(Main%20firmware)/IDM_USB_8kib_offset.bin"
put IDM in Bootloader Mode (if you haven’t done before) and take note of your #Serial_Boot#
~/klippy-env/bin/python ~/klipper/lib/canboot/flash_can.py -f ~/IDM/Firmware/IDM_USB_8kib_offset.bin -d #Serial_Boot#
ls /dev/serial/by-id/*
Now take note of NEW #Serial_USB# anf put it in your pritner.cfg in [idm] serial:
To update from DFU mode, read the section “via DFU“
Update IDM USB Bootloader with Gitee
If you git the installation script from Gitee,
put IDM in Bootloader Mode (if you haven’t done before) and take note of your #Serial_Boot#
cd ~
git clone https://github.com/Arksine/katapult.git
mkdir -p ~/IDM/Canboot
wget -P ~/IDM/Canboot "https://gitee.com/NBTP/idm-documents/blob/master/Canboot%E9%80%9A%E8%AE%AF%E9%A2%91%E7%8E%87%E8%A6%86%E5%86%99%E7%94%A8%E5%9B%BA%E4%BB%B6(canboot%20deployer%20firmware)/canboot_USB.bin"
python3 ~/katapult/scripts/flashtool.py -f ~/IDM/Canboot/canboot_USB.bin -d #Serial_Boot#
Now the command “ls /dev/serial/by-id/*” show
/dev/serial/by-id/usb-katapult_stm32f042x6_xxxxxxxx
so reflash the USB Firmware to see
/dev/serial/by-id/usb-IDM_xxxxxxxxx
Now unplug and re-plug the USB connector
Update IDM USB Firmware with MPS
Put IDM in Bootloader Mode (if you haven’t done before) and take note of your #Serial_Boot#
python3 ~/katapult/scripts/flashtool.py -f ~/IDM/Firmware/IDM_USB_8kib_offset.bin -d #Serial_Boot#
ls /dev/serial/by-id/*
Now take note of NEW #Serial_USB# anf put it in your printer.cfg in [idm] serial:
Error MCU in Klipper
If you got errors in Klipper because of IDM, update the IDM firmware or bootloader+firmware.
Check your MCU has a Klipper version compatibile wih Host (Raspberry/TVbox) Klipper version,
otherwise update Klipper on the MCU (recompile the firmware for you board: SKR, Mellow, MKS etc.)
Set Firmware Type
https://github.com/ModularPrintingSystem/IDM/tree/master?tab=readme-ov-file#12-set-firmware-type