Skip to content

Instantly share code, notes, and snippets.

@ssorgatem
Created March 24, 2021 18:29
Show Gist options
  • Select an option

  • Save ssorgatem/afe796a276a2db1059a450f95f781e0e to your computer and use it in GitHub Desktop.

Select an option

Save ssorgatem/afe796a276a2db1059a450f95f781e0e to your computer and use it in GitHub Desktop.
Modded Ender 5 klipper printer.cfg
##### AUTOCREATED BY KIAUH #####
[include kiauh.cfg]
################################
# This file contains common pin mappings for the 2019 Creality
# Ender 5. To use this config, the firmware should be compiled for the
# AVR atmega1284p.
# Note, a number of Melzi boards are shipped with a bootloader that
# requires the following command to flash the board:
# avrdude -p atmega1284p -c arduino -b 57600 -P /dev/ttyUSB0 -U out/klipper.elf.hex
# If the above command does not work and "make flash" does not work
# then one may need to flash a bootloader to the board - see the
# Klipper docs/Bootloaders.md file for more information.
# See the example.cfg file for a description of available parameters.
[virtual_sdcard]
path: /home/pi/sdcard
[stepper_x]
step_pin: PD7
dir_pin: !PC5
enable_pin: !PD6
#step_distance: .012500
microsteps: 16
rotation_distance: 40
endstop_pin: ^PC2
position_endstop: 225
position_max: 225
homing_speed: 50
second_homing_speed: 20
[stepper_y]
step_pin: PC6
dir_pin: !PC7
enable_pin: !PD6
#step_distance: .012500
microsteps: 16
rotation_distance: 40
endstop_pin: ^PC3
position_endstop: 225
position_max: 225
homing_speed: 50
second_homing_speed: 20
[stepper_z]
step_pin: PB3
dir_pin: !PB2
enable_pin: !PA5
#step_distance: .00125
microsteps: 16
rotation_distance: 4
endstop_pin: probe:z_virtual_endstop
position_max: 300
position_min: -3
[safe_z_home]
#home_xy_position: 159,128.2
#home_xy_position: 139,148.2
#home_xy_position: 225,225
#home_xy_position: 222,225
home_xy_position: 222,20
speed: 200
z_hop: 10.0
z_hop_speed: 10.0
[bltouch]
sensor_pin: ^PC4
control_pin: PA4
x_offset: -45
y_offset: -7
#z_offset: 0.150
#z_offset: 3
speed: 3.0
pin_up_touch_mode_reports_triggered: False
[bed_mesh]
speed: 300
horizontal_move_z: 8
mesh_min: 20,20
mesh_max: 180,218
#mesh_min: 20,57
#mesh_max: 180,218
probe_count: 6
fade_start: 1.0
mesh_pps: 1,1
#mesh_pps: 0
#algorithm: lagrange
#bicubic_tension: .05
algorithm: bicubic
bicubic_tension: 0.2
[bed_screws]
screw1: 31,37
screw1_name: Front left screw
screw2: 31,208
screw2_name: Rear left screw
screw3: 201,208
screw3_name: Rear right screw
screw4: 201,37
screw4_name: Front right screw
[pause_resume]
[firmware_retraction]
retract_length: 2.5
# The length of filament (in mm) to retract when G10 is activated, and to
# unretract when G11 is activated (but see unretract_extra_length below).
# The default is 0 mm.
retract_speed: 20
# The speed of retraction, in mm/s. The default is 20 mm/s.
#unretract_extra_length: 0
# The length (in mm) of *additional* filament to add when unretracting.
unretract_speed: 10
# The speed of unretraction, in mm/s. The default is 10 mm/s.
#z_hop: 1 #@invalid?
# The amount of lift applied to the Z axis (in mm) on retract and
# restored on unretract. The default is 0
[gcode_arcs]
[respond]
default_type: echo
# This enables a 'force_move' command ignoring all homing, Z-stops etc. Useful in debugging.
[force_move]
enable_force_move: True
[extruder]
min_extrude_temp: 0
max_extrude_only_distance: 3000.0
step_pin: PB1
dir_pin: !PB0
enable_pin: !PD6
#step_distance: 0.010983 # Wall test 2: 0.8mm
microsteps: 16
rotation_distance: 35.145
nozzle_diameter: 0.3
filament_diameter: 1.750
heater_pin: PD5
sensor_type: EPCOS 100K B57560G104F
sensor_pin: PA7
#control: pid
# tuned for stock hardware with 200 degree Celsius target
#pid_Kp: 21.527
#pid_Ki: 1.063
#pid_Kd: 108.982
min_temp: 0
max_temp: 400
max_extrude_only_velocity: 220
max_extrude_only_accel: 6400
pressure_advance: 0.12
# The amount of raw filament to push into the extruder during
# extruder acceleration. An equal amount of filament is retracted
# during deceleration. It is measured in millimeters per
# millimeter/second. The default is 0, which disables pressure
# advance.
pressure_advance_smooth_time: 0.040
# A time range (in seconds) to use when calculating the average
# extruder velocity for pressure advance. A larger value results in
# smoother extruder movements. This parameter may not exceed 200ms.
# This setting only applies if pressure_advance is non-zero. The
# default is 0.040 (40 milliseconds).
[heater_bed]
heater_pin: PD4
sensor_type: EPCOS 100K B57560G104F
sensor_pin: PA6
#control: pid
# tuned for stock hardware with 50 degree Celsius target
#pid_Kp: 54.027
#pid_Ki: 0.770
#pid_Kd: 948.182
min_temp: 0
max_temp: 130
[fan]
pin: PB4
[mcu]
serial: /dev/serial/by-id/usb-1a86_USB_Serial-if00-port0
[mcu host]
serial: /tmp/klipper_host_mcu
[adxl345]
cs_pin: host:None
[resonance_tester]
accel_chip: adxl345
probe_points:
100,100,20 # an example
[filament_switch_sensor filament_sensor]
pause_on_runout: True
runout_gcode: FILAMENT_RUNOUT
event_delay: 3.0
pause_delay: 0.5
switch_pin: host:gpio4
[printer]
kinematics: cartesian
max_velocity: 300
max_accel: 1500
#max_accel: 7000
#max_accel_to_decel: 7000
max_z_velocity: 10
max_z_accel: 100
[display]
lcd_type: st7920
cs_pin: PA3
sclk_pin: PA1
sid_pin: PC1
encoder_pins: ^PD2, ^PD3
click_pin: ^!PC0
[input_shaper]
#shaper_freq_x: 71.43
#shaper_freq_y: 46.15
#shaper_type: mzv
#shaper_freq_x: 27.2
#shaper_type_x: mzv
#shaper_freq_y: 58.8
#shaper_type_y: 3hump_ei
############MACROS#############
# Adds print macros such as start print and end print.
# in cura, as start gcode you can define "START_PRINT" and end gcode "END_PRINT"
[gcode_macro G29]
gcode:
G1 Z10 F600
BED_MESH_CLEAR
BED_MESH_CALIBRATE
BED_MESH_OUTPUT
BED_MESH_PROFILE SAVE=bedmesh
G0 X0 Y0 Z10 F6000
[gcode_macro M204]
rename_existing: M204.1
default_parameter_F: 0.75
gcode:
{% if 'S' in params %}
SET_VELOCITY_LIMIT ACCEL={ S } ACCEL_TO_DECEL={ S|float * F|float }
{% endif %}
[gcode_macro M205]
gcode:
{% if 'X' in params %}
SET_VELOCITY_LIMIT SQUARE_CORNER_VELOCITY={ X }
{% endif %}
######################################################################
# Start Print and End Print
######################################################################
# Replace the slicer's custom start and end g-code scripts with
# START_PRINT and END_PRINT.
[gcode_macro START_PRINT T_BED T_EXTRUDER]
variable_parameter_T_BED: 60
variable_parameter_T_EXTRUDER: 190
gcode:
M117 Homing
# Use absolute coordinates
G90
# Reset the G-Code Z offset (adjust Z offset if needed)
SET_GCODE_OFFSET Z=0.0
# Home the printer
G28
# Use the bed mesh
BED_MESH_PROFILE LOAD=bedmesh
# Move the nozzle near the bed
G1 X15 Y20 Z5 F6000
M117 Waiting for temperature
# Start bed heating and continue
M140 S{T_BED}
{% if printer.heater_bed.temperature < params.T_BED|float*0.85 %}
M190 S{params.T_BED|float*0.85} # wait till 0.85 of bed temp is reached, then continue
{% endif %}
M140 S{T_BED}
M109 S{T_EXTRUDER}
M190 S{T_BED}
# Prime line
PRIME_LINE
M117 Printing...
[gcode_macro END_PRINT]
gcode:
M117 Done printing :)
# move z up
G91
G1 E-3 Z+10 F3000
# absolute xy
G90
G1 X10 Y220 F2000
#disable hotend and heated bed
M104 S0
M140 S0
# disable steppers
M84
BED_MESH_CLEAR
# prime the nozzle
[gcode_macro PRIME_LINE]
gcode:
M117 Prime Line
G92 E0 ;Reset Extruder
# move z axis
G1 Z2.0 F3000 ;Move Z Axis up
# move to prime position
G1 X20 Y30 Z0.28 F5000.0 ;Move to start position
G1 X20 Y200.0 Z0.28 F1500.0 E15 ;Draw the first line
G1 X22 Y200.0 Z0.28 F5000.0 ;Move to side a little
G1 X22 Y50 Z0.28 F1500.0 E30 ;Draw the second line
G92 E0 ;Reset Extruder
G1 Z2.0 F3000 ;Move Z Axis up
# [homing_override]
# gcode:
# G90 ; Use absolute position mode
# G1 Z10 ; Move up 10mm
# G28 X Y
# G1 X117 Y150 F6000 ; Change the X and Y coordinates to the center of your print bed
# G28 Z
# set_position_z: 0.0
# Park toolhead
[gcode_macro M125]
gcode:
SAVE_GCODE_STATE NAME=parking
M117 Parking toolhead
G91
G1 Z10 F600 # move up 5 mm
G90
G1 X125 Y0 F4000 # move to park position
G91
G1 Z-10 F600 # move down 5 mm
G90
RESTORE_GCODE_STATE NAME=parking
# LOW_TEMP_CHECK checks if there is a setpoint for the extruder. Untested!
# - If this setpoint is reached, continue.
# - If not, heat to setpoint.
# - If no setpoint, heat to parameter T (default@200)
[gcode_macro LOW_TEMP_CHECK T]
default_parameter_T: 200
gcode:
{% if printer.extruder.target != 0 %} # if there is a setpoint for extruder
{% if printer.extruder.temperature < printer.extruder.target %} # if not reached, heat
M118 Heating from {printer.extruder.temperature} to {printer.extruder.target}.
M109 S{printer.extruder.target|float}
{% endif %}
{% else %} # if no setpoint for extruder
{% if printer.extruder.target < T %} # heat to T.
M118 No setpoint, heating to {T}.
M109 S{T}
{% endif %}
{% endif %}
# load filament
[gcode_macro M701]
gcode:
SAVE_GCODE_STATE NAME=loading_filament
M117 Loading Filament
M83
G92 E0.0
LOW_TEMP_CHECK
G1 E40 F6000 # length of bowden tube till cold-end (~420mm)
G1 E100 F200 # some extra to prime the nozzle --> slower
G92 E0.0
RESTORE_GCODE_STATE NAME=loading_filament
# unload filament
[gcode_macro M702]
gcode:
SAVE_GCODE_STATE NAME=unloading_filament
M125 # park
M117 Unloading Filament
#LOW_TEMP_CHECK
G91 # set relative
#G1 E10 F100
G92 E0.0
G1 E-40 F6000 # the E is the length of the bowden tube (420mm) + 100 mm.
G92 E0.0
RESTORE_GCODE_STATE NAME=unloading_filament
# filament change
[gcode_macro FILAMENT_RUNOUT]
gcode:
M118 Filament runout
M117 Out of filament!
SAVE_GCODE_STATE NAME=filament_out
M118 Pausing...
PAUSE
G91 # relative
G1 E-1 F300 # retract 1
M118 Unloading...
M702 # unload
M118 Setting hotend to 0
M109 S0
M117 Replace Filament!
RESTORE_GCODE_STATE NAME=filament_out
[gcode_macro M600]
gcode:
M117 Filament Change
M118 Filament Change
SAVE_GCODE_STATE NAME=filament_change
PAUSE
LOW_TEMP_CHECK
G91 # relative
G1 E-1 F300 # retract 1
M702 # unload
RESTORE_GCODE_STATE NAME=filament_change
M117 New filament
M118 New filament
COUNTDOWN TIME=25 MSG="Switch"
M701
COUNTDOWN TIME=10 MSG="Clean"
RESUME
M117 Resuming
M118 Resuming
RESTORE_GCODE_STATE NAME=filament_change
M117 Printing..
M118 Printing..
[gcode_macro COUNTDOWN]
default_parameter_MSG: "Time: "
default_parameter_TIME: 10
gcode:
# countdown
{% for s in range(TIME|int, 0, -1) %}
# dwell 1 second
G4 P1000
# echo
M117 {params.MSG} {s}s
M118 {params.MSG} {s}s
{% endfor %}
[idle_timeout]
gcode:
{% if printer.pause_resume.is_paused %}
M104 S0
{% else %}
TURN_OFF_HEATERS
M84
{% endif %}
[gcode_macro RESTART_ALL]
gcode:
RUN_SHELL_COMMAND CMD=restart_klipper_services
[gcode_shell_command restart_klipper_services]
command: sudo restart_klipper
timeout: 2.
verbose: True
[gcode_macro FIRMWARE_RESTART]
gcode:
RESTART_ALL
rename_existing: FIRMWARE_RESTART_OG
#*# <---------------------- SAVE_CONFIG ---------------------->
#*# DO NOT EDIT THIS BLOCK OR BELOW. The contents are auto-generated.
#*#
#*# [extruder]
#*# control = pid
#*# pid_kp = 26.566
#*# pid_ki = 1.904
#*# pid_kd = 92.647
#*#
#*# [heater_bed]
#*# control = pid
#*# pid_kp = 74.871
#*# pid_ki = 1.815
#*# pid_kd = 772.106
#*#
#*# [bed_mesh default]
#*# version = 1
#*# points =
#*# -0.016250, -0.050000, -0.043750, -0.038750, -0.043750, -0.042500
#*# -0.043750, -0.078750, -0.078750, -0.048750, -0.068750, -0.053750
#*# -0.093750, -0.101250, -0.107500, -0.081250, -0.075000, -0.058750
#*# -0.116250, -0.111250, -0.123750, -0.087500, -0.072500, -0.075000
#*# -0.103750, -0.108750, -0.108750, -0.102500, -0.086250, -0.080000
#*# -0.115000, -0.110000, -0.106250, -0.082500, -0.067500, -0.078750
#*# tension = 0.2
#*# min_x = 20.0
#*# algo = bicubic
#*# y_count = 6
#*# mesh_y_pps = 1
#*# min_y = 20.0
#*# x_count = 6
#*# max_y = 218.0
#*# mesh_x_pps = 1
#*# max_x = 180.0
#*#
#*# [bltouch]
#*# z_offset = 2.525
#*#
#*# [bed_mesh bedmesh]
#*# version = 1
#*# points =
#*# -0.016250, -0.050000, -0.043750, -0.038750, -0.043750, -0.042500
#*# -0.043750, -0.078750, -0.078750, -0.048750, -0.068750, -0.053750
#*# -0.093750, -0.101250, -0.107500, -0.081250, -0.075000, -0.058750
#*# -0.116250, -0.111250, -0.123750, -0.087500, -0.072500, -0.075000
#*# -0.103750, -0.108750, -0.108750, -0.102500, -0.086250, -0.080000
#*# -0.115000, -0.110000, -0.106250, -0.082500, -0.067500, -0.078750
#*# tension = 0.2
#*# min_x = 20.0
#*# algo = bicubic
#*# y_count = 6
#*# mesh_y_pps = 1
#*# min_y = 20.0
#*# x_count = 6
#*# max_y = 218.0
#*# mesh_x_pps = 1
#*# max_x = 180.0
#*#
#*# [bed_mesh flipped]
#*# version = 1
#*# points =
#*# 0.551250, 0.481250, 0.398750, 0.341250, 0.257500, 0.175000
#*# 0.591250, 0.502500, 0.411250, 0.341250, 0.248750, 0.160000
#*# 0.637500, 0.526250, 0.418750, 0.330000, 0.231250, 0.128750
#*# 0.660000, 0.542500, 0.413750, 0.316250, 0.203750, 0.087500
#*# 0.680000, 0.545000, 0.400000, 0.280000, 0.148750, 0.018750
#*# 0.701250, 0.552500, 0.391250, 0.253750, 0.111250, -0.036250
#*# tension = 0.2
#*# min_x = 20.0
#*# algo = bicubic
#*# y_count = 6
#*# mesh_y_pps = 1
#*# min_y = 57.0
#*# x_count = 6
#*# max_y = 218.0
#*# mesh_x_pps = 1
#*# max_x = 180.0
#*#
#*# [input_shaper]
#*# shaper_type_x = zv
#*# shaper_freq_x = 24.0
#*# shaper_type_y = 3hump_ei
#*# shaper_freq_y = 50.0
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment