Skip to content

Instantly share code, notes, and snippets.

@mpalpha
Created December 14, 2021 03:56
Show Gist options
  • Save mpalpha/dbd66bf1b7bdb85067757fbff03469e4 to your computer and use it in GitHub Desktop.
Save mpalpha/dbd66bf1b7bdb85067757fbff03469e4 to your computer and use it in GitHub Desktop.
klipper config for Creativity ELF - raspberry pi 4 + dragonfly BMS hotend + orbiter 1.5 + 5x TMC2209 (uart) + FYSTEC black pei magnetic bed + bltouch no-deploy abl + internal serial pi4 connection.
[input_shaper]
shaper_type_y: ei
shaper_freq_y: 47.8
shaper_type_x: 2hump_ei
shaper_freq_x: 60.8
shaper_type: mzv
[static_digital_output reset_display]
pins: !PC6, !PD13 # disable unsupported display
[stepper_x]
step_pin: PE3
dir_pin: PE2
enable_pin: !PE4
microsteps: 16
rotation_distance: 40
endstop_pin: PA15
position_endstop: 300
position_max: 300
homing_speed: 100
homing_retract_dist: 3
[tmc2209 stepper_x]
uart_pin:PC13
interpolate: True
run_current: 0.600
hold_current: 0.300
stealthchop_threshold: 30
driver_SGTHRS: 105
uart_address:3
[stepper_y]
step_pin: PE0
dir_pin: PB9
enable_pin: !PE1
microsteps: 16
rotation_distance: 40
endstop_pin: PA12
position_endstop: 300
position_max: 300
homing_speed: 100
homing_retract_dist: 3
[tmc2209 stepper_y]
uart_pin:PC13
interpolate: True
run_current: 0.600
hold_current: 0.300
stealthchop_threshold: 30
driver_SGTHRS: 105
uart_address:2
[stepper_z]
step_pin: PB5
dir_pin: !PB4
enable_pin: !PB8
microsteps: 16
rotation_distance: 8
endstop_pin: probe:z_virtual_endstop
position_min: -3
position_max: 340
homing_speed: 10
second_homing_speed: 5
homing_retract_dist: 2
[tmc2209 stepper_z]
uart_pin: PC13
interpolate: true
run_current: 0.300
hold_current: 0.200
stealthchop_threshold: 30
uart_address: 1
[stepper_z1]
step_pin: PA6
dir_pin: !PA1
enable_pin: !PA3
microsteps: 16
rotation_distance: 8
[tmc2209 stepper_z1]
uart_pin: PC13
interpolate: true
run_current: 0.300
hold_current: 0.200
stealthchop_threshold: 30
uart_address: 0
[extruder]
step_pin: PD6
dir_pin: !PD3
enable_pin: !PB3
microsteps: 16
rotation_distance: 4.582
nozzle_diameter: 0.450
filament_diameter: 1.750
heater_pin: PC3
sensor_type: ATC Semitec 104GT-2
sensor_pin: PC1
control = pid
pid_kp = 26.580
pid_ki = 1.656
pid_kd = 106.654
pressure_advance: 0.03
min_temp: 0
max_temp: 300
max_extrude_only_distance: 151
max_extrude_cross_section:5
pwm_cycle_time:.05
[tmc2209 extruder]
uart_pin:PC7
interpolate: True
run_current: 0.30
hold_current: 0.2
stealthchop_threshold: 5
driver_HSTRT: 0
driver_TBL: 2
driver_HEND: 2
driver_TOFF: 6
uart_address:0
driver_SGTHRS: 100 #related to homing speed
[heater_bed]
heater_pin: PA0
sensor_type: EPCOS 100K B57560G104F
sensor_pin: PC0
pwm_cycle_time: 0.017
max_power: 0.6
min_temp: 0
max_temp: 120
control = pid
pid_kp = 65.362
pid_ki = 1.175
pid_kd = 909.344
[fan]
pin: PB1
# adxl345 section
#[mcu rpi]
#serial: /tmp/klipper_host_mcu
[mcu]
serial: /dev/ttyAMA0
restart_method: command
[printer]
kinematics: corexy
max_velocity: 300
max_accel: 5300 #Max 4000
max_accel_to_decel: 3975
max_z_velocity: 25 #Max 15 for 12V TMC Drivers, can increase for 24V
max_z_accel: 250
square_corner_velocity: 5.0
#[adxl345]
#cs_pin: rpi:None
#[resonance_tester]
#accel_chip: adxl345
#probe_points:
# 150,150,20 # an example
# Keeps Debug LED off / not floating
#[static_digital_output debug_led]
#pins: !PB7
[bltouch]
sensor_pin: ^PE6
control_pin: PA8
x_offset: 0
y_offset: -20
#z_offset: 1.024
pin_move_time: 0.5
# This determines if Klipper should command the pin to move up between each probe attempt when performing a multiple probe
# sequence. Setting this to False can allow for faster probing, but using this mode requires careful tuning of probing speed parameters. The default is True.
stow_on_each_sample: false
# Set if the BLTouch consistently reports the probe in a "not triggered" state after a successful "pin_up" command. This should
# be True for all genuine BLTouch devices. Read the directions in docs/BLTouch.md before setting this to False. The default is True.
pin_up_reports_not_triggered: true
# Set if the BLTouch consistently reports a "triggered" state after the commands "pin_up" followed by "touch_mode". This should be
# True for all genuine BLTouch devices. Read the directions in docs/BLTouch.md before setting this to False. The default is True.
pin_up_touch_mode_reports_triggered: true
speed: 3
samples: 3
sample_retract_dist: 2
# unsure if this affects bltouch or just probes
lift_speed: 5
samples_tolerance_retries: 3
#z_offset: 1.9
[force_move]
enable_force_move: True
[safe_z_home]
home_xy_position: 150,200 # Change coordinates to the center of your print bed
speed: 150
z_hop: 2 # Move up 10mm
z_hop_speed: 10
[gcode_macro TMC_SENDDELAY]
gcode:
SET_TMC_FIELD STEPPER=stepper_x FIELD=SENDDELAY VALUE=2
SET_TMC_FIELD STEPPER=stepper_y FIELD=SENDDELAY VALUE=2
SET_TMC_FIELD STEPPER=stepper_z FIELD=SENDDELAY VALUE=2
SET_TMC_FIELD STEPPER=stepper_z1 FIELD=SENDDELAY VALUE=2
SET_TMC_FIELD STEPPER=extruder FIELD=SENDDELAY VALUE=2
[stable_z_home]
gcode:
# The G-code to run before each probe attempt. The default is none.
retries: 25
# The maximum number of probe attempts allowed. The default is 20.
#window:
# The number of samples to use in the tolerance window. The default is 4.
retry_tolerance: 0.0025
# The maximum range between the min and max values of the Z offset in the window
# to consider the offset stable and complete the procedure. The default is
# 0.0025mm.
#[homing_heaters
#steppers: stepper_z
#heaters: extruder, heater_bed
#[homing_override]
#set_position_z: 5
#axes: z
#gcode:
# G90 ; Uncomment these 2 lines to blindly lift the Z 3mm at start
# G1 Z5 F600 ; Move Z up a bit to prevent scratching
# G28 X0 Y0
# G0 X150 Y200 F3000 ; Go to X100,Y200
# SET_HOME_CURRENT
# STABLE_Z_HOME
# SET_PRINT_CURRENT
[z_tilt]
z_positions:
#Nozzle position over leadscrews
325,150
-25,150
points:
10,200
290,200
speed: 50
#horizontal_move_z: 3
retries: 10
retry_tolerance: 0.0025
[bed_mesh]
#horizontal_move_z: 3
mesh_min: 40, 40
mesh_max: 260,260
fade_start: 0.6
fade_end: 10.0
speed: 50
probe_count: 5,5
algorithm: bicubic
relative_reference_index: 12
#[safe_z_home]
#home_xy_position: 150,200
#speed: 75
#z_hop: 3
#z_hop_speed: 3
[pause_resume]
recover_velocity: 50.
[gcode_arcs]
resolution: .25
[bed_screws]
screw1: 30,20
screw2: 270,20
screw3: 270,280
screw4: 30,280
[screws_tilt_adjust]
screw1: 30,50
screw1_name: front left screw
screw2: 270,50
screw2_name: front right screw
screw3: 270,290
screw3_name: rear right screw
screw4: 30,290
screw4_name: rear left screw
horizontal_move_z: 10
speed: 40
screw_thread: CCW-M4
[verify_heater extruder]
hysteresis: 10
[virtual_sdcard]
path: /home/pi/sdcard
# For konovo pwc v1.0 or mks 3.0 PWC (model 2019)
#
# use psu control plugin and externally power rpi
# set auto on and off in psu control plugin
# set mcu power to usb 5v via jumper on robin nano v1.2
# on gcode command = SET_PIN PIN=power VALUE=1
# off gcode command = SET_PIN PIN=power VALUE=0
# uncomment the following
#[output_pin power]
#pin:PB2
#value: 0
#shutdown_value: 0
#
#
#
# For elf pwc v2.0 (model 2020+)
#
# use psu control plugin and externally power rpi
# set auto on and off in psu control plugin
# set mcu power to usb 5v via jumper on robin nano v1.2
# on gcode command = SET_PIN PIN=power VALUE=0
# off gcode command = SET_PIN PIN=power VALUE=1
# uncomment the following
[output_pin power]
pin:!PB2
#value: 1
shutdown_value: 1.0
[gcode_macro M80]
gcode:
SET_PIN PIN=power VALUE=0
STATUS
[gcode_macro M81]
gcode:
SET_PIN PIN=power VALUE=1
STATUS
# This adds the 'respond' G-Code that you can use to send M118 commands back to host
[respond]
[gcode_macro NOTIFY]
# Notify macro
gcode:
{% if 'MSG' in params %}
RESPOND TYPE=command MSG="action:notification {params.MSG}"
{% endif %}
[gcode_macro ZUP]
gcode:
SET_GCODE_OFFSET Z_ADJUST=0.01 MOVE=1
[gcode_macro ZDOWN]
gcode:
SET_GCODE_OFFSET Z_ADJUST=-0.01 MOVE=1
[gcode_macro SET_HOME_CURRENT]
gcode:
# read driver configs
{% set XCFG = printer.configfile.settings['tmc2209 stepper_x'] %}
{% set YCFG = printer.configfile.settings['tmc2209 stepper_y'] %}
{% set ZCFG = printer.configfile.settings['tmc2209 stepper_z'] %}
{% set Z1CFG = printer.configfile.settings['tmc2209 stepper_z1'] %}
{% set ECFG = printer.configfile.settings['tmc2209 extruder'] %}
SET_TMC_CURRENT STEPPER=stepper_x CURRENT={XCFG.hold_current}
SET_TMC_CURRENT STEPPER=stepper_y CURRENT={YCFG.hold_current}
SET_TMC_CURRENT STEPPER=stepper_z CURRENT={ZCFG.hold_current}
SET_TMC_CURRENT STEPPER=stepper_z1 CURRENT={Z1CFG.hold_current}
SET_TMC_CURRENT STEPPER=extruder CURRENT={ECFG.hold_current}
# Pause to ensure driver stall flag is clear
G4 P1000
[gcode_macro SET_PRINT_CURRENT]
gcode:
# read driver configs
{% set XCFG = printer.configfile.settings['tmc2209 stepper_x'] %}
{% set YCFG = printer.configfile.settings['tmc2209 stepper_y'] %}
{% set ZCFG = printer.configfile.settings['tmc2209 stepper_z'] %}
{% set Z1CFG = printer.configfile.settings['tmc2209 stepper_z1'] %}
{% set ECFG = printer.configfile.settings['tmc2209 extruder'] %}
# reset all steppers current
SET_TMC_CURRENT STEPPER=stepper_x CURRENT={XCFG.run_current}
SET_TMC_CURRENT STEPPER=stepper_y CURRENT={YCFG.run_current}
SET_TMC_CURRENT STEPPER=stepper_z CURRENT={ZCFG.run_current}
SET_TMC_CURRENT STEPPER=stepper_z1 CURRENT={Z1CFG.run_current}
SET_TMC_CURRENT STEPPER=extruder CURRENT={ECFG.run_current}
# Pause to ensure driver stall flag is clear
G4 P1000
[gcode_macro LAZY_HOME]
gcode:
{% if "x" not in printer.toolhead.homed_axes %}
G28 X
{% endif %}
{% if "y" not in printer.toolhead.homed_axes %}
G28 Y
{% endif %}
{% if "z" not in printer.toolhead.homed_axes %}
G28 Z
{% endif %}
#G90 ; Uncomment these 2 lines to blindly lift the Z 2mm at start
#G1 Z5 F300 ; Move Z up a bit to prevent scratching
G0 X150 Y200 F1500 ; Go to X100,Y100 at 25mm/s
[gcode_macro G29]
gcode:
BED_MESH_CLEAR
#now proceed to home as normal
LAZY_HOME
#mesh bed level
BED_MESH_CALIBRATE METHOD=automatic
## Raise Z for safe parking/transit
G0 Z5 F1500
[gcode_macro G34]
gcode:
#now proceed to home as normal
LAZY_HOME
SET_HOME_CURRENT
Z_TILT_ADJUST
SET_PRINT_CURRENT
G28 Z
## Raise Z for safe parking/transit
G0 Z5 F1500
#[gcode_macro M280 P0 S160]
#gcode:
# BLTOUCH_DEBUG COMMAND=reset
[gcode_macro CANCEL_PRINT]
rename_existing: BASE_CANCEL_PRINT
default_parameter_X: 230
default_parameter_Y: 230
default_parameter_Z: 10
gcode:
M104 S0
M140 S0
M141 S0
M106 S0
CLEAR_PAUSE
RESET_SD
BASE_CANCEL_PRINT
[gcode_macro PAUSE]
rename_existing: BASE_PAUSE
default_parameter_X: 230
default_parameter_Y: 230
default_parameter_Z: 10
gcode:
SAVE_GCODE_STATE NAME=PAUSE_state
BASE_PAUSE
G91
G1 E-1.7 F2100
G1 Z{Z}
G90
G1 X{X} Y{Y} F6000
G91
[gcode_macro RESUME]
rename_existing: BASE_RESUME
gcode:
G91
G1 E1.7 F2100
G91
RESTORE_GCODE_STATE NAME=PAUSE_state MOVE=1
BASE_RESUME
#*# <---------------------- SAVE_CONFIG ---------------------->
#*# DO NOT EDIT THIS BLOCK OR BELOW. The contents are auto-generated.
#*#
#*# [bed_mesh default]
#*# version = 1
#*# points =
#*# 0.098333, -0.095000, -0.255000, -0.309167, -0.347500
#*# 0.100000, -0.049167, -0.179167, -0.187500, -0.204167
#*# 0.208333, 0.097500, 0.000000, 0.040833, 0.088333
#*# 0.297500, 0.234167, 0.189167, 0.250000, 0.364167
#*# 0.497500, 0.429167, 0.427500, 0.502500, 0.657500
#*# tension = 0.2
#*# min_x = 40.0
#*# algo = bicubic
#*# y_count = 5
#*# mesh_y_pps = 2
#*# min_y = 40.0
#*# x_count = 5
#*# max_y = 260.0
#*# mesh_x_pps = 2
#*# max_x = 260.0
#*#
#*# [bltouch]
#*# z_offset = 1.274
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment