Skip to content

Instantly share code, notes, and snippets.

@Qteb
Last active December 6, 2023 20:33
Show Gist options
  • Save Qteb/64baab2e57d65697633cc884dc783beb to your computer and use it in GitHub Desktop.
Save Qteb/64baab2e57d65697633cc884dc783beb to your computer and use it in GitHub Desktop.
Klipper configuration for SKR 1.4 PRO + 4x TMC2209 UART
# Specs:
# - SKR 1.4 PRO
# - TMC2209 UART
# - 1.8 stepper on XYZ
# - Physical endstops on XYZ
# - Fysetc Mini 12864 LCD Display v2.1 RGB
#
# Link to current version of this config: https://gist.github.com/Qteb/64baab2e57d65697633cc884dc783beb
# Klipper config reference: https://www.klipper3d.org/Config_Reference.html
# Gcode templates syntax: https://jinja.palletsprojects.com/en/2.10.x/templates/
# Gcode math: https://manual.slic3r.org/advanced/conditional-gcode
[mcu]
# https://www.raspberrypi.org/documentation/configuration/uart.md
# https://github.com/KevinOConnor/klipper/issues/2913
#serial: /dev/ttyAMA0
#restart_method: command
serial: /dev/serial/by-id/usb-Klipper_lpc1769_0FD0001880A037AF1AE6BF5BC62000F5-if00
[printer]
kinematics: cartesian
max_velocity: 360
max_accel: 3000
max_accel_to_decel: 1500
max_z_velocity: 5
max_z_accel: 100
#square_corner_velocity: 5.0
[board_pins]
aliases:
EXP1_1=P1.30, EXP1_3=P1.18, EXP1_5=P1.20, EXP1_7=P1.22, EXP1_9=<GND>,
EXP1_2=P0.28, EXP1_4=P1.19, EXP1_6=P1.21, EXP1_8=P1.23, EXP1_10=<5V>,
EXP2_1=P0.17, EXP2_3=P3.26, EXP2_5=P3.25, EXP2_7=P1.31, EXP2_9=<GND>,
EXP2_2=P0.15, EXP2_4=P0.16, EXP2_6=P0.18, EXP2_8=<RST>, EXP2_10=<NC>
# https://github.com/KevinOConnor/klipper/blob/master/docs/Measuring_Resonances.md#bed-slinger-printers
# https://github.com/KevinOConnor/klipper/blob/master/docs/RPi_microcontroller.md
[mcu rpi]
serial: /tmp/klipper_host_mcu
[adxl345]
cs_pin: rpi:None
[resonance_tester]
accel_chip: adxl345
#max_smoothing: 0.1
#accel_per_hz: 75
probe_points: 100,100
[input_shaper]
shaper_type_x: 2hump_ei
shaper_freq_x: 55.2
shaper_type_y: mzv
shaper_freq_y: 25.8
##############################
# X/Y Stepper Settings
# https://github.com/KevinOConnor/klipper/blob/master/docs/Rotation_Distance.md
##############################
[stepper_x]
step_pin: P2.2
dir_pin: !P2.6
enable_pin: !P2.1
endstop_pin: P1.29
microsteps: 16
rotation_distance: 40
position_endstop: 0
position_min: 0
position_max: 200
homing_speed: 200
second_homing_speed: 8
[tmc2209 stepper_x]
uart_pin: P1.10
run_current: 1.200
hold_current: 0.950
# https://github.com/KevinOConnor/klipper/issues/1363
stealthchop_threshold: 500
[stepper_y]
step_pin: P0.19
dir_pin: P0.20
enable_pin: !P2.8
endstop_pin: P1.28
microsteps: 16
rotation_distance: 40
position_endstop: 0
position_min: 0
position_max: 200
homing_speed: 200
second_homing_speed: 8
[tmc2209 stepper_y]
uart_pin: P1.9
run_current: 1.200
hold_current: 0.950
# https://github.com/KevinOConnor/klipper/issues/1363
stealthchop_threshold: 500
#####################################################################
# Z Stepper Settings
#####################################################################
[stepper_z]
step_pin: P0.22
dir_pin: P2.11
enable_pin: !P0.21
endstop_pin: P1.27
microsteps: 16
rotation_distance: 2
position_endstop: 0
position_min: 0
position_max: 260
homing_speed: 5
homing_retract_speed: 2
homing_retract_dist: 1
second_homing_speed: 0.5
[tmc2209 stepper_z]
uart_pin: P1.8
run_current: 0.650
hold_current: 0.450
# https://github.com/KevinOConnor/klipper/issues/1363
stealthchop_threshold: 500
# https://github.com/KevinOConnor/klipper/blob/master/docs/Endstop_Phase.md
#[endstop_phase stepper_z]
#trigger_phase:29/64
##############################
# Extruder
# https://voron.dozuki.com/Guide/Extruder+Calibration+(ESTEPS)/1
# https://github.com/KevinOConnor/klipper/blob/master/docs/Pressure_Advance.md
##############################
[extruder]
step_pin: P2.13
dir_pin: P0.11
enable_pin: !P2.12
heater_pin: P2.7
sensor_pin: P0.24
sensor_type: PT1000
pullup_resistor: 1000
microsteps: 16
rotation_distance: 21
nozzle_diameter: 0.400
filament_diameter: 1.750
min_extrude_temp: 180
max_extrude_only_distance: 1000
max_extrude_cross_section: 50.0
min_temp: 0
max_temp: 450
#control = pid
# pid_kp = 23.716
# pid_ki = 1.363
# pid_kd = 103.165
[tmc2209 extruder]
uart_pin: P1.4
run_current: 0.800
hold_current: 0.500
# https://github.com/KevinOConnor/klipper/issues/1363
stealthchop_threshold: 5000
##############################
# Bed Heater
##############################
[heater_bed]
heater_pin: P2.5
sensor_pin: P0.25
sensor_type: EPCOS 100K B57560G104F
min_temp: 0
max_temp: 130
#control: pid
#pid_Kp=64.240
#pid_Ki=3.858
#pid_Kd=267.397
##############################
# Fans
# https://github.com/KevinOConnor/klipper/blob/master/docs/Config_Reference.md#fans
##############################
[fan]
pin: P2.3
kick_start_time: 0.500
off_below: 0.25 #for Pengda
[heater_fan extruder_fan]
pin: P2.4
heater_temp: 50.0
#fan_speed: 1.0
##############################
# Probe & Mesh
# https://github.com/KevinOConnor/klipper/blob/master/docs/Manual_Level.md#fine-grained-bed-screw-adjustments
##############################
[bed_screws]
screw1_name: front left screw
screw1: 5,5
screw2_name: front right screw
screw2: 195,5
screw3_name: rear center screw
screw3: 100,200
horizontal_move_z: 2
probe_height: 0.05
speed: 200
probe_speed: 2
##############################
# Display
##############################
[display]
lcd_type: uc1701
cs_pin: EXP1_3
a0_pin: EXP1_4
rst_pin: EXP1_5
click_pin: ^!EXP1_2
encoder_pins: ^EXP2_5, ^EXP2_3
spi_software_miso_pin: EXP2_1
spi_software_mosi_pin: EXP2_6
spi_software_sclk_pin: EXP2_2
contrast: 63
menu_timeout: 90
# [display_data _default_16x4 print_progress]
# position: 2, 0
# text:
# {% if printer["gcode_macro START_PRINT"].value|default(0, true) == 1 %}
# { "{:^10.0%}".format(printer.display_status.progress) }
# {% else %}
# ----------------
# {% endif %}
# [display_data _default_16x4 progress_bar]
# position: 2, 1 # Draw graphical progress bar after text is written
# text:
# {% if printer["gcode_macro START_PRINT"].value|default(0, true) == 1 %}
# { draw_progress_bar(2, 0, 9, printer.display_status.progress) }
# {% endif %}
# # Render remaining time taken from M73
# [display_data _default_16x4 printing_time]
# position: 2, 10
# text:
# {% if printer["gcode_macro START_PRINT"].value|default(0, true) == 1 %}
# {% set ptime = printer["gcode_macro M73"].r %}
# { "R%02d:%02d" % (ptime // 60, ptime % 60) }
# {% endif %}
[neopixel fysetc_mini12864]
pin: EXP1_6
chain_count: 3
color_order: RGB
initial_RED: 1.0
initial_GREEN: 0.3
initial_BLUE: 0.0
[neopixel bottom_neopixel]
pin: P1.24
chain_count: 18
color_order: RGB
initial_RED: 0
initial_GREEN: 0
initial_BLUE: 0
[output_pin beeper]
pin: EXP1_1
pwm: True
value: 0
shutdown_value: 0
cycle_time: 0.0024
[gcode_macro SET_NEOPIXEL_RGB]
default_parameter_R: 0.0
default_parameter_G: 0.0
default_parameter_B: 0.0
gcode:
SET_LED LED=bottom_neopixel RED={params.G} GREEN={params.R} BLUE={params.B}
[gcode_macro SET_DISPLAY_RGB]
default_parameter_R: 0.0
default_parameter_G: 0.0
default_parameter_B: 0.0
gcode:
SET_LED LED=fysetc_mini12864 RED={params.R} GREEN={params.G} BLUE={params.B} INDEX=1 TRANSMIT=0
SET_LED LED=fysetc_mini12864 RED={params.R} GREEN={params.G} BLUE={params.B} INDEX=2 TRANSMIT=0
SET_LED LED=fysetc_mini12864 RED={params.R} GREEN={params.G} BLUE={params.B} INDEX=3
##############################
# Misc
##############################
[force_move]
enable_force_move: True
[pause_resume]
[respond]
[include /home/pi/klipper-config/macros/*.cfg]
#*# <---------------------- SAVE_CONFIG ---------------------->
#*# DO NOT EDIT THIS BLOCK OR BELOW. The contents are auto-generated.
#*#
#*# [extruder]
#*# control = pid
#*# pid_Kp = 15.625
#*# pid_Ki = 0.628
#*# pid_Kd = 97.269
#*#
#*# [heater_bed]
#*# control: pid
#*# pid_Kp = 64.240
#*# pid_Ki = 3.858
#*# pid_Kd = 267.397
#####################################################################
# Macros
#####################################################################
[delayed_gcode INIT_STATE]
initial_duration: 1
gcode:
READY_STATE
[gcode_macro READY_STATE]
gcode:
SET_DISPLAY_RGB R=1.0 G=0.3 B=0.0
SET_NEOPIXEL_RGB R=1.0 G=0.3 B=0.0
M117 Printer is ready
BEEP_READY
[gcode_macro BEEP_ALERT]
gcode:
M300 S200 P200
M300 S200 P200
M300 S200 P200
[gcode_macro BEEP_READY]
gcode:
M300 S500 P50
M300 S600 P50
M300 S700 P50
[gcode_macro BEEP_CONFIRM]
gcode:
M300 S1000 P100
M300 S1200 P100
M300 S1400 P100
[gcode_macro COLOR_CHANGE]
variable_extr_temp: 0
gcode:
{% if printer.idle_timeout.state == "Printing" and not printer.pause_resume.is_paused %}
PAUSE
M118 COLOR_CHANGE: Unloading filament...
M117 Unloading filament...
UNLOAD_FILAMENT
M118 COLOR_CHANGE: Insert new filament and load it with LOAD_FILAMENT command
M118 COLOR_CHANGE: After load new filament continue printing using RESUME command
M117 Insert new filament
{% else %}
M118 COLOR_CHANGE: No print started yet...
{% endif %}
[gcode_macro M300]
default_parameter_S=1000
default_parameter_P=100
gcode:
{% if S|float != 0 %}
SET_PIN PIN=beeper VALUE=0.5 CYCLE_TIME={1/S|float}
{% endif %}
G4 P{P}
SET_PIN PIN=beeper VALUE=0
[gcode_macro M900]
default_parameter_K: 0
gcode:
SET_PRESSURE_ADVANCE ADVANCE={K}
[gcode_macro M73]
rename_existing: M773
variable_p: 0.0
variable_r: 0.0
default_parameter_P: 0.0
default_parameter_R: 0.0
gcode:
M773 P{P}
SET_GCODE_VARIABLE MACRO=M73 VARIABLE=p VALUE={P}
SET_GCODE_VARIABLE MACRO=M73 VARIABLE=r VALUE={R}
#########
[gcode_macro MOVE_FILAMENT]
default_parameter_ACTION: RETRACT
default_parameter_LENGTH: 2
default_parameter_SPEED: 2100
gcode:
{% set MIN_TEMP = (printer.configfile.config["extruder"]["min_extrude_temp"] | min) %}
{% if (printer.extruder.temperature >= (MIN_TEMP|int)) %}
G91 ; relative positioning
{% if ACTION == 'RETRACT' %}
M118 FILAMENT: Retracting filament by {LENGTH}mm
G1 E-{LENGTH} F{SPEED} ; retract filament
{% elif ACTION == 'FEED' %}
M118 FILAMENT: Feeding filament by {LENGTH}mm
G1 E{LENGTH} F{SPEED} ; detract filament
{% else %}
M118 FILAMENT: Unknown action: {ACTION}
{% endif %}
G90 ; absolute positioning
{% else %}
M118 START_PRINT: Skipped retracting filamant due to min-temp condition {MIN_TEMP}, current extruder temperature is {printer.extruder.temperature}
{% endif %}
[gcode_macro PARKING_POSITION]
default_parameter_RAISE_Z_POSITION: 50
default_parameter_Z_SPEED: 600
default_parameter_XY_SPEED: 4500
default_parameter_PARKING_POSITION_X: 5
default_parameter_PARKING_POSITION_Y: 5
gcode:
# calculating X and Y
{% if ('x' in printer.toolhead.homed_axes) and ('y' in printer.toolhead.homed_axes) %}
G90 ; Absolute positioning
G1 X{PARKING_POSITION_X} Y{PARKING_POSITION_Y} F{XY_SPEED}
{% else %}
M118 PARKING_POSITION: X and/or Y position is unknown, moving not possible
{% endif %}
# calculating Z
{% if 'z' in printer.toolhead.homed_axes %}
{% if printer.gcode_move.gcode_position.z < (RAISE_Z_POSITION | float) %}
M118 PARKING_POSITION: Z axis is below {RAISE_Z_POSITION}mm
G90 ; Absolute positioning
G1 Z{RAISE_Z_POSITION} F{Z_SPEED}
{% endif %}
# {% endif %}
{% else %}
M118 PARKING_POSITION: Z position is unknown, moving not possible
{% endif %}
#########
[gcode_macro START_PRINT]
variable_value: 0
gcode:
CLEAR_PAUSE
SET_GCODE_VARIABLE MACRO=START_PRINT VARIABLE=value VALUE=1
M117 Printing...
[gcode_macro STOP_PRINT]
gcode:
M400 ; wait for buffer to clear
SET_GCODE_VARIABLE MACRO=START_PRINT VARIABLE=value VALUE=0
TURN_OFF_HEATERS
M107 ; turn off fan
[gcode_macro READ_STATE]
gcode:
M118 CANCEL_PRINT: {printer["gcode_macro START_PRINT"].value|default(0, true)}
M0 You're up, mate ; in your G-code file
[gcode_macro CANCEL_PRINT]
rename_existing: BASE_CANCEL_PRINT
default_parameter_RAISE_Z_POSITION: 200
default_parameter_RETRACT_LENGTH: 1.5
default_parameter_PARKING_POSITION_X: 5
default_parameter_PARKING_POSITION_Y: 5
gcode:
M118 CANCEL_PRINT: Canceling print...
M117 Canceling print
{% if printer["gcode_macro START_PRINT"].value|default(0, true) == 0 %}
M118 CANCEL_PRINT: Printer is not printing
{% elif printer.pause_resume.is_paused %}
M118 CANCEL_PRINT: Printer is paused, no parking needed
{% else %}
MOVE_FILAMENT ACTION=RETRACT
PARKING_POSITION PARKING_POSITION_X={PARKING_POSITION_X} PARKING_POSITION_Y={PARKING_POSITION_Y} RAISE_Z_POSITION={RAISE_Z_POSITION}
{% endif %}
# SDCARD_RESET_FILE
BASE_CANCEL_PRINT
STOP_PRINT
READY_STATE
[gcode_macro FINISH_PRINT]
gcode:
SET_GCODE_VARIABLE MACRO=START_PRINT VARIABLE=value VALUE=0
SET_PRESSURE_ADVANCE ADVANCE=0
BEEP_CONFIRM
M117 Done!
[gcode_macro PAUSE]
rename_existing: BASE_PAUSE
gcode:
{% if printer.idle_timeout.state == "Printing" and not printer.pause_resume.is_paused %}
M117 Pausing print...
M118 PAUSE: Pausing print...
M118 PAUSE: Position before BASE_PAUSE: {printer.gcode_move.gcode_position}
SAVE_GCODE_STATE NAME=PAUSE_state
BASE_PAUSE
M118 PAUSE: Position after BASE_PAUSE: {printer.gcode_move.gcode_position}
M220 S100
MOVE_FILAMENT ACTION=RETRACT
PARKING_POSITION
M400 ; finish moves
G91 ; relative positioning
M118 PAUSE: Position when done: {printer.gcode_move.gcode_position}
M118 PAUSE: Print paused...
M117 Print paused...
{% else %}
M118 PAUSE: Printer is not printing
{% endif %}
[gcode_macro RESUME]
rename_existing: BASE_RESUME
default_parameter_FEED_LENGTH: 10
default_parameter_FEED_SPEED: 150
gcode:
{% if printer.pause_resume.is_paused %}
M118 RESUME: Resuming print...
M117 Resuming print
MOVE_FILAMENT ACTION=FEED LENGTH={FEED_LENGTH} SPEED={FEED_SPEED}
M400 ; finish moves
M300 S1000 P100 ; beep
RESTORE_GCODE_STATE NAME=PAUSE_state MOVE=1 MOVE_SPEED=4500
BASE_RESUME
M118 RESUME: Print resumed
{% else %}
M118 PAUSE: Printer is not paused
{% endif %}
#########
[gcode_macro LOAD_FILAMENT]
gcode:
M83
G1 E50 F3600
G1 E100 F4500
G1 E550 F6000
G1 E35 F1800
G1 E50 F300
# M82
M117 Load Complete!
[gcode_macro UNLOAD_FILAMENT]
gcode:
M83
G1 E20 F1500
G1 E-750 F20000
# M82
##############################
# Menu
##############################
### menu octoprint ###
[menu __main __octoprint]
type: disabled
### menu control ###
[menu __main __control __pause]
type: command
index: 0
enable: {printer.idle_timeout.state == "Printing" and not printer.pause_resume.is_paused}
name: Pause printing
gcode:
{menu.exit()}
PAUSE
[menu __main __control __resume]
type: command
index: 1
enable: {printer.pause_resume.is_paused}
name: Resume printing
gcode:
{menu.exit()}
RESUME
[menu __main __control __clearpause]
type: command
index: 2
enable: {printer.pause_resume.is_paused}
name: Clear pause
gcode:
{menu.exit()}
CLEAR_PAUSE
[menu __main __control __cancelprint]
type: command
index: 3
enable: {printer["gcode_macro START_PRINT"].value|default(0, true) == 1}
name: Cancel print
gcode:
{menu.exit()}
CANCEL_PRINT
### menu filament ###
[menu __main __filament __loadf]
type: disabled
[menu __main __filament __loads]
type: disabled
[menu __main __filament __unloadf]
type: disabled
[menu __main __filament __unloads]
type: disabled
[menu __main __filament __load]
type: command
index: 1
enable: {printer["gcode_macro START_PRINT"].value|default(0, true) == 0 or printer.pause_resume.is_paused}
name: Load Filament
gcode:
{menu.exit()}
LOAD_FILAMENT
[menu __main __filament __unload]
type: command
index: 2
enable: {printer["gcode_macro START_PRINT"].value|default(0, true) == 0 or printer.pause_resume.is_paused}
name: Unload Filament
gcode:
{menu.exit()}
UNLOAD_FILAMENT
### menu prepare ###
[menu __main __prepare]
type: list
enable: {not printer.idle_timeout.state == "Printing"}
name: Prepare
[menu __main __prepare __bedScrew]
type: list
name: Bed Screw Tune
[menu __main __prepare __bedScrew __Start]
type:command
name: Start Screw Adjust
gcode:
G28
BED_SCREWS_ADJUST
[menu __main __prepare __bedScrew __Accept]
type:command
name: Accept
gcode:
ACCEPT
[menu __main __prepare __bedScrew __Adjusted]
type:command
name: Adjusted
gcode:
ADJUSTED
[menu __main __prepare __bedScrew __Abort]
type:command
name: Abort
gcode:
ABORT
G1 Z2 F5000
G28 X Y
@tiagomaricate
Copy link

Hey my friend, can I use this file with an SKR 1.4 Turbo? Or only for SKR PRO?

@damanbaird
Copy link

Hey my friend, can I use this file with an SKR 1.4 Turbo? Or only for SKR PRO?

Over a year late, but it does seam to have simular pinouts, as i used parts of this for my skr 1.4 turbo

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment