Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Save dz0ny/c0ca41e7eaa7b5c55a9181a5e4f62580 to your computer and use it in GitHub Desktop.
Save dz0ny/c0ca41e7eaa7b5c55a9181a5e4f62580 to your computer and use it in GitHub Desktop.
Klipper MK3S/+ Config including optional Bondtech Extruder, Bear Extruder, etc.
# This file contains pin mappings and reasonable defaults for Prusa i3 MK3S
# printers. It will work with MK3 (non-S) by selecting the alternative filament
# sensor. References to common community mods are included as well.
#
[include mainsail.cfg]
[skew_correction]
[force_move]
[temperature_sensor raspberry_pi]
sensor_type: temperature_host
min_temp: 10
max_temp: 100
[probe]
pin: PB4
x_offset: 24
y_offset: 5
speed: 10.0
samples: 3 #Sampling, primarily for bed mesh. 3 is fine for normal PINDA probes.
samples_result: average
[bed_mesh]
speed: 200
horizontal_move_z: 5
mesh_min: 35, 6
mesh_max: 240,198
probe_count: 4,4
[homing_override]
gcode:
G1 Z3
G28 X0 Y200
G1 X1 Y0 F5000
G28 Z0
axes: Z
set_position_x: 0
set_position_y: 0
set_position_z: 0
[gcode_macro G80]
gcode:
BED_MESH_CALIBRATE
G1 X0 Y0 Z0.4 F4000
[gcode_macro G81]
gcode:
BED_MESH_OUTPUT
[stepper_x]
step_pin: PC0
dir_pin: !PL0
enable_pin: !PA7
microsteps: 16
rotation_distance: 32
endstop_pin: tmc2130_stepper_x:virtual_endstop
position_endstop: 0
position_max: 250
homing_speed: 50
homing_retract_dist: 0
[tmc2130 stepper_x]
cs_pin: PG0
interpolate: True
run_current: .281738
hold_current: .281738
sense_resistor: 0.220
diag1_pin: !PK2
driver_IHOLDDELAY: 8
driver_TPOWERDOWN: 0
driver_TBL: 2
driver_TOFF: 3
driver_HEND: 1
driver_HSTRT: 5
driver_PWM_FREQ: 2
driver_PWM_GRAD: 2
driver_PWM_AMPL: 230
driver_PWM_AUTOSCALE: True
driver_SGT: 3
[stepper_y]
step_pin: PC1
dir_pin: PL1
enable_pin: !PA6
microsteps: 16
rotation_distance: 32
endstop_pin: tmc2130_stepper_y:virtual_endstop
position_endstop: -4
position_max: 210
position_min: -4
homing_speed: 50
homing_retract_dist: 0
[tmc2130 stepper_y]
cs_pin: PG2
interpolate: True
run_current: .281738
hold_current: .281738
sense_resistor: 0.220
diag1_pin: !PK7
driver_IHOLDDELAY: 8
driver_TPOWERDOWN: 0
driver_TBL: 2
driver_TOFF: 3
driver_HEND: 1
driver_HSTRT: 5
driver_PWM_FREQ: 2
driver_PWM_GRAD: 2
driver_PWM_AMPL: 230
driver_PWM_AUTOSCALE: True
driver_SGT: 3
[stepper_z]
step_pin: PC2
dir_pin: !PL2
enable_pin: !PA5
microsteps: 16
rotation_distance: 8
endstop_pin: probe:z_virtual_endstop
# Please update the Z height in the Tram_Z macro below.
#position_max: 200 #This is the MK3S default.
position_max: 210 #Use this for a stock MK3 non-S, BMG, or Bear extruders for the MK3S.
position_min: -2
homing_speed: 13.333
[tmc2130 stepper_z]
cs_pin: PK5
interpolate: True
run_current: .53033
hold_current: .53033
sense_resistor: 0.220
diag1_pin: !PK6
driver_IHOLDDELAY: 8
driver_TPOWERDOWN: 0
driver_TBL: 2
driver_TOFF: 3
driver_HEND: 1
driver_HSTRT: 5
driver_PWM_FREQ: 2
driver_PWM_GRAD: 4
driver_PWM_AMPL: 200
driver_PWM_AUTOSCALE: True
driver_SGT: 4
[extruder]
step_pin: PC3
dir_pin: PL6
enable_pin: !PA4
microsteps: 16
full_steps_per_rotation: 200
rotation_distance: 22.172
gear_ratio: 50:17
nozzle_diameter: 0.400
filament_diameter: 1.750
# The max extrude cross section is increased for the purge line, but in theory
# its probably a bad idea to have it this large, as its purpose is to catch
# poorly sliced objects that extrude too much for small moves.
max_extrude_cross_section: 50.0
# Allows to load filament and purge up to 500mm
max_extrude_only_distance: 500.0
max_extrude_only_velocity: 120.0
max_extrude_only_accel: 1250.0
heater_pin: PE5
sensor_type: ATC Semitec 104GT-2
sensor_pin: PF0
min_temp: 0
max_temp: 305
[tmc2130 extruder]
cs_pin: PK4
interpolate: True
run_current: .513757
hold_current: .513757
sense_resistor: 0.220
diag1_pin: !PK3
driver_IHOLDDELAY: 8
driver_TPOWERDOWN: 0
driver_TBL: 2
driver_TOFF: 3
driver_HEND: 1
driver_HSTRT: 5
driver_PWM_FREQ: 2
driver_PWM_GRAD: 4
driver_PWM_AMPL: 240
driver_PWM_AUTOSCALE: True
driver_SGT: 3
[heater_bed]
heater_pin: PG5
sensor_type: EPCOS 100K B57560G104F
sensor_pin: PF2
min_temp: 0
max_temp: 125
[heater_fan nozzle_cooling_fan]
pin: PH5
heater: extruder
heater_temp: 50.0
fan_speed: 1.0
# Part Cooling Fan
[fan]
pin: PH3
[mcu]
serial: /dev/ttyACM0 #Default to USB.
[display]
lcd_type: hd44780
rs_pin: PD5
e_pin: PF7
d4_pin: PF5
d5_pin: PG4
d6_pin: PH7
d7_pin: PG3
encoder_pins: ^PJ1,^PJ2
click_pin: ^!PH6
[printer]
kinematics: cartesian
max_velocity: 300
max_accel: 1500
max_z_velocity: 10
max_z_accel: 200
#MK3S Filament IR Barrier Sensor.
[filament_switch_sensor fsensor]
pause_on_runout: True
runout_gcode:
M118 Filament Runout Detected
M600
insert_gcode:
M118 Filament Load Detected
LOAD_FILAMENT
event_delay: 3.0
pause_delay: 0.01
switch_pin: !PK0
[respond]
default_type: command
[pause_resume]
# Keeps Debug LED off / not floating
[static_digital_output debug_led]
pins: !PB7
[output_pin BEEPER_pin]
pin: PH2
pwm: True
value: 0
shutdown_value:0
cycle_time: 0.001
scale: 1000
[gcode_macro M300]
gcode:
# Use a default 1kHz tone if S is omitted.
{% set S = params.S|default(1000)|int %}
# Use a 10ms duration is P is omitted.
{% set P = params.P|default(100)|int %}
SET_PIN PIN=BEEPER_pin VALUE=0.5 CYCLE_TIME={ 1.0/S if S > 0 else 1 }
G4 P{P}
SET_PIN PIN=BEEPER_pin VALUE=0
[gcode_macro _M600]
gcode:
{% set X = params.X|default(230)|int %}
{% set Y = params.Y|default(230)|int %}
{% set Z = params.Z|default(10)|int %}
PAUSE
G91
G1 E-.8 F2700
G1 Z{Z}
G90
G1 X{X} Y{Y} F3000
#Load and Unload Macros.
[gcode_macro LOAD_FILAMENT]
gcode:
M117 Loading Filament...
G92 E0.0
G91
G1 E40 F400
G1 E30 F400
G1 E25 F200
G90
G92 E0.0
M400
M117 Load Complete
UPDATE_DELAYED_GCODE ID=clear_display DURATION=5
[gcode_macro UNLOAD_FILAMENT]
gcode:
M117 Unloading Filament...
G92 E0.0
G91
G1 E-45 F5200
G1 E-15 F1000
G1 E-20 F1000
G90
G92 E0.0
M400
M117 Remove Filament Now!
M300 S300 P1000
UPDATE_DELAYED_GCODE ID=clear_display DURATION=5
[delayed_gcode clear_display]
initial_duration: 0.
gcode:
M117
[gcode_macro PAUSE]
rename_existing: BASE_PAUSE
gcode:
{% set X = params.X|default(230)|int %}
{% set Y = params.Y|default(230)|int %}
{% set Z = params.Z|default(10)|int %}
{% set E = params.E|default(1)|int %}
SAVE_GCODE_STATE NAME=PAUSE_state
BASE_PAUSE
G91
G1 E-{E} F2100
G1 Z{Z}
G90
G1 X{X} Y{Y} F6000
[gcode_macro RESUME]
rename_existing: BASE_RESUME
gcode:
{% set E = params.E|default(1)|int %}
G91
G1 E{E} F2100
G90
RESTORE_GCODE_STATE NAME=PAUSE_state MOVE=1
BASE_RESUME
[gcode_macro CANCEL_PRINT]
rename_existing: BASE_CANCEL_PRINT
gcode:
TURN_OFF_HEATERS
CLEAR_PAUSE
SDCARD_RESET_FILE
BASE_CANCEL_PRINT
# Raise nozzle by 10mm
G1 Z60 F3000
G90
# Disable steppers
M84
[display_status]
[force_move]
enable_force_move: TRUE
#This replicates Prusa's calibrate Z funtionality.
[gcode_macro Tram_Z]
gcode:
G28
G1 X125 Y105
G1 Z200 F1000 #Update with Z height.
FORCE_MOVE STEPPER=stepper_z Distance=10 Velocity=10
G28 Z
[virtual_sdcard]
path: ~/gcode_files
#If not using with Octoprint remove the menu.
[menu __main __octoprint]
type: disabled
[gcode_macro ZUP]
gcode:
SET_GCODE_OFFSET Z_ADJUST=0.025 MOVE=1
[gcode_macro ZDOWN]
gcode:
SET_GCODE_OFFSET Z_ADJUST=-0.025 MOVE=1
[menu __calibrate __up]
type: command
name: Change Filament
gcode:
ZUP
[menu __calibrate __down]
type: command
name: Resume
gcode:
DOWN
[menu __filament __change]
type: command
name: Change Filament
gcode:
M600
[menu __filament __resume]
type: command
name: Resume
gcode:
RESUME
[gcode_macro M900]
gcode:
SET_PRESSURE_ADVANCE ADVANCE=0.052
#*# <---------------------- SAVE_CONFIG ---------------------->
#*# DO NOT EDIT THIS BLOCK OR BELOW. The contents are auto-generated.
#*#
#*# [bed_mesh default]
#*# version = 1
#*# points =
#*# 0.017500, 0.070000, -0.020000, -0.140000, -0.305000
#*# 0.232500, 0.321667, 0.349167, 0.303333, 0.189167
#*# 0.278333, 0.468333, 0.580833, 0.557500, 0.551667
#*# tension = 0.2
#*# min_x = 35.0
#*# algo = lagrange
#*# y_count = 3
#*# mesh_y_pps = 2
#*# min_y = 6.0
#*# x_count = 5
#*# max_y = 198.0
#*# mesh_x_pps = 2
#*# max_x = 240.0
#*#
#*# [probe]
#*# z_offset = 1.015
#*#
#*# [heater_bed]
#*# control = pid
#*# pid_kp = 52.289
#*# pid_ki = 0.826
#*# pid_kd = 827.481
#*#
#*# [extruder]
#*# control = pid
#*# pid_kp = 33.163
#*# pid_ki = 2.664
#*# pid_kd = 103.220
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment