Last active
September 10, 2024 21:33
-
-
Save jefflarkin/35b3e9ea42f868be510a701b48374659 to your computer and use it in GitHub Desktop.
Klipper Config
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# | |
# Klipper configuration file for Anycubic i3 MEGA S | |
# | |
# This config file contains settings of all printer pins (steppers, sensors) for Anycubic i3 mega S with TMC2208 Drivers with stock plug orientation | |
# Klipper firmware should be compiled for the atmega2560 | |
# | |
# Config file includes | |
# - Original or 2208(2209) rotated by cable drivers | |
# - Mesh bed leveling: BLtouch (3DTouch sensor from Triangelab) | |
# - Manual meshed bed leveling (commented out) | |
# - 'virtual_sdcard' for fast printing without gaps | |
# - Beeper through M300 gcode | |
# - Pause/Resume through M600 for filament change | |
# - START_PRINT/END_PRINT macros should be start and end g-code in slicer | |
# - Pressure Advance and Input Shaper configured | |
# | |
# 3DTouch code is commented out. Z limit switches are used to home Z axis. | |
# | |
# Video covering installation here: https://youtu.be/cAxEIdThDiQ | |
# | |
# The latest version of the config reference is also available online at: | |
# https://www.klipper3d.org/Config_Reference.html | |
[stepper_x] | |
step_pin = PF0 | |
## "!" for stock and TMC2208 with reversed plugs | |
dir_pin = !PF1 | |
#dir_pin = PF1 | |
enable_pin = !PD7 | |
rotation_distance = 40 | |
Full_Steps_Per_Rotation = 200 | |
Microsteps = 16 | |
endstop_pin = ^!PE5 | |
position_min = -5 | |
position_endstop = -5 | |
position_max = 210 | |
homing_speed = 30 | |
homing_retract_dist = 5 | |
second_homing_speed = 10 | |
[stepper_y] | |
step_pin = PF6 | |
## "" for stock and TMC2208 with reversed plugs | |
dir_pin = PF7 | |
#dir_pin = !PF7 | |
enable_pin = !PF2 | |
rotation_distance = 40 | |
Full_Steps_Per_Rotation = 200 | |
Microsteps = 16 | |
endstop_pin = ^!PL7 | |
position_endstop = 0 | |
position_max = 210 | |
homing_speed = 50 | |
homing_retract_dist = 5 | |
second_homing_speed = 10 | |
[stepper_z] | |
step_pin = PL3 | |
## "" for stock and TMC2208 with reversed plugs | |
dir_pin = PL1 | |
#dir_pin = !PL1 | |
enable_pin = !PK0 | |
rotation_distance = 8 | |
Full_Steps_Per_Rotation = 200 | |
Microsteps = 16 | |
## uncomment below for 3dtouch. comment for mannual mesh bed leveling | |
#endstop_pin = probe:z_virtual_endstop | |
## comment 2 lines below for 3dtouch bed leveling and to disable Z limit switches | |
endstop_pin = ^!PD3 | |
position_endstop = 0.0 | |
position_max = 210 | |
position_min = -5 | |
homing_speed = 10 | |
homing_retract_dist = 5 | |
second_homing_speed = 3 | |
[stepper_z1] | |
step_pin = PC1 | |
## "" for stock and TMC2208 with reversed plugs | |
dir_pin = PC3 | |
#dir_pin = !PC3 | |
## comment below for 3dtouch bed leveling and to disable Z limit switches | |
endstop_pin = ^!PL6 | |
enable_pin = !PC7 | |
#step_distance = .0025 | |
rotation_distance = 8 | |
Full_Steps_Per_Rotation = 200 | |
Microsteps = 16 | |
[extruder] | |
step_pin = PA4 | |
## "" for stock and TMC2208 with reversed plugs | |
dir_pin = PA6 | |
#dir_pin = !PA6 | |
enable_pin = !PA2 | |
#control = pid | |
## original extruder stepper motor | |
rotation_distance = 8 | |
Full_Steps_Per_Rotation = 200 | |
Microsteps = 16 | |
## NEMA17 23mm stepper motor | |
#step_distance = .00236 | |
nozzle_diameter = 0.400 | |
filament_diameter = 1.750 | |
heater_pin = PB4 | |
sensor_type = ATC Semitec 104GT-2 | |
sensor_pin = PK5 | |
min_temp = 0 | |
max_temp = 285 | |
max_extrude_only_distance = 150.0 | |
smooth_time = 1 | |
min_extrude_temp = 180 | |
pressure_advance = 0.3624 | |
max_extrude_cross_section = 150 | |
[heater_fan extruder_fan] | |
pin = PL5 | |
[heater_bed] | |
heater_pin = PH5 | |
sensor_type = EPCOS 100K B57560G104F | |
sensor_pin = PK6 | |
min_temp = 0 | |
max_temp = 110 | |
smooth_time = 1 | |
#control = pid | |
[fan] | |
pin = PH6 | |
[mcu] | |
serial = /dev/serial/by-id/usb-Silicon_Labs_CP2102_USB_to_UART_Bridge_Controller_0001-if00-port0 | |
[printer] | |
kinematics = cartesian | |
max_velocity = 300 | |
max_accel = 4000 #10000 #4000 | |
max_accel_to_decel = 1500 # 10000 #1500 | |
max_z_velocity = 7 #20 #7 | |
max_z_accel = 190 #500 #190 | |
square_corner_velocity = 5 | |
## do your own measurement | |
## https://www.klipper3d.org/Resonance_Compensation.html | |
#[input_shaper] | |
#shaper_freq_x = 85.0 | |
#shaper_freq_y = 48.4 | |
#shaper_type = MVZ #VZ #3hump_ei | |
[heater_fan stepstick_fan] | |
pin = PH4 | |
##[bltouch] | |
##sensor_pin = ^PE4 | |
##control_pin = PB5 | |
### do your own measurement | |
##x_offset = 31.5 | |
##y_offset = -18.5 | |
##z_offset = 1.825 | |
##stow_on_each_sample = False | |
##probe_with_touch_mode = True | |
##Turn ON to adjust home location from 0,0,0 | |
#[safe_z_home] | |
#home_xy_position = 100,100 | |
#speed = 150 | |
#z_hop = 10 | |
#z_hop_speed = 10 | |
## bltouch mesh bed leveling | |
#[bed_mesh] | |
#speed = 200 | |
#horizontal_move_z = 5 | |
#mesh_min = 30,5 #23,28 | |
#mesh_max = 200,190 #190,190 | |
#probe_count = 9,9 | |
##fade_start = 1.0 | |
##fade_end = 10.0 | |
#algorithm = bicubic | |
## manual mesh bed leveling | |
# [bed_mesh] | |
# speed = 50 | |
# horizontal_move_z = 5 | |
# mesh_min = 30,30 | |
# mesh_max = 180,180 | |
# probe_count = 5,5 | |
# fade_start = 1.0 | |
# fade_end = 10.0 | |
# enable moving befor homing | |
## put in terminal: | |
## SET_KINEMATIC_POSITION X=100 Y=100 Z=100 | |
## then move as usual | |
[force_move] | |
enable_force_move: True | |
[virtual_sdcard] | |
path: ~/gcode_files | |
[output_pin BEEPER_pin] | |
pin: PC6 | |
pwm: True | |
value: 0 | |
shutdown_value: 0 | |
cycle_time: 0.001 | |
scale: 1000 | |
[gcode_macro M300] | |
# default_parameter_S: 1000 | |
# default_parameter_P: 100 | |
gcode: | |
{% set S = params.S|default(1000)|float %} | |
{% set P = params.P|default(100)|float %} | |
SET_PIN PIN=BEEPER_pin VALUE=1000 | |
G4 P100 | |
SET_PIN PIN=BEEPER_pin VALUE=0 | |
[display_status] | |
# change filament | |
[pause_resume] | |
[firmware_retraction] | |
retract_length: 6 | |
# 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: 25 | |
# The speed of retraction, in mm/s. The default is 20 mm/s. | |
unretract_extra_length: 1 | |
# 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. | |
[gcode_macro M600] | |
# default_parameter_X: 50 | |
# default_parameter_Y: 0 | |
# default_parameter_Z: 10 | |
gcode: | |
{% set X = params.X|default(50)|float %} | |
{% set Y = params.Y|default(0)|float %} | |
{% set Z = params.Z|default(10)|float %} | |
SAVE_GCODE_STATE NAME=M600_state | |
PAUSE | |
G91 | |
G1 E-.8 F2700 | |
G1 Z{Z} | |
G90 | |
G1 X{X} Y{Y} F3000 | |
G91 | |
G1 E-150 F1000 | |
M300 S299 P200 | |
M300 S299 P200 | |
M300 S299 P200 | |
M300 S299 P200 | |
M300 S299 P200 | |
RESTORE_GCODE_STATE NAME=M600_state | |
[gcode_macro PAUSE] | |
rename_existing: BASE_PAUSE | |
# change this if you need more or less extrusion | |
variable_extrude: 1.0 | |
gcode: | |
##### read E from pause macro ##### | |
{% set E = printer["gcode_macro PAUSE"].extrude|float %} | |
##### set park positon for x and y ##### | |
# default is your max posion from your printer.cfg | |
{% set x_park = printer.toolhead.axis_maximum.x|float - 5.0 %} | |
{% set y_park = printer.toolhead.axis_maximum.y|float - 5.0 %} | |
##### calculate save lift position ##### | |
{% set max_z = printer.toolhead.axis_maximum.z|float %} | |
{% set act_z = printer.toolhead.position.z|float %} | |
{% if act_z < (max_z - 2.0) %} | |
{% set z_safe = 2.0 %} | |
{% else %} | |
{% set z_safe = max_z - act_z %} | |
{% endif %} | |
##### end of definitions ##### | |
SAVE_GCODE_STATE NAME=PAUSE_state | |
BASE_PAUSE | |
G91 | |
G1 E-{E} F2100 | |
G1 Z{z_safe} F900 | |
G90 | |
G1 X{x_park} Y{y_park} F6000 | |
[gcode_macro RESUME] | |
rename_existing: BASE_RESUME | |
gcode: | |
##### read E from pause macro ##### | |
{% set E = printer["gcode_macro PAUSE"].extrude|float %} | |
##### end of definitions ##### | |
G91 | |
G1 E{E} F2100 | |
RESTORE_GCODE_STATE NAME=PAUSE_state | |
BASE_RESUME | |
[gcode_macro CANCEL_PRINT] | |
rename_existing: BASE_CANCEL_PRINT | |
gcode: | |
TURN_OFF_HEATERS | |
G91 #relative positioning | |
# G1 E-.1 | |
G10 | |
G1 Z10 Y50 F1000 #Z axis up 10mm, Y out 50mm | |
G90 #absolute positioning | |
G28 X0 #home X axis | |
CLEAR_PAUSE | |
SDCARD_RESET_FILE | |
BASE_CANCEL_PRINT | |
[gcode_macro START_PRINT] | |
gcode: | |
G28 X0 Y0 ; move X/Y to min endstops | |
G28 Z0 ; move Z to min endstops | |
G1 Z20 Y5 F500 ; move nozzle away from bed | |
G92 E0 ; zero the extruded length | |
G1 E2 F2400 ; extrude 5mm of feed stock | |
G92 E0 ; zero the extruded length again | |
M117 Printing... | |
[gcode_macro END_PRINT] | |
gcode: | |
M400 ; Clear Buffer | |
M104 S0 ; turn off extruder | |
M140 S0 ; turn off bed | |
G10 ; retract | |
G91 ; relative positioning | |
G1 E-0.03 Z1.00 X20.0 Y20.0 ; move nozzle to remove stringing | |
M106 S0 ; turn off fan | |
G1 Z20 ; move nozzle up 20mm | |
G90 ; absolute positioning | |
G0 X0 Y175 ; park nozzle at rear | |
M84 ; steppers off | |
G4 P250 ; dwell | |
#_TIMELAPSE_NEW_FRAME | |
M300 ; Beep | |
[gcode_macro Heat_Hotend] | |
gcode: | |
SET_HEATER_TEMPERATURE HEATER=extruder TARGET=200 | |
#[gcode_macro _TIMELAPSE_NEW_FRAME] | |
#gcode: | |
# {action_call_remote_method("timelapse_newframe")} | |
# ; leave this in a separate macro! | |
#[gcode_macro TIMELAPSE_TAKE_FRAME] | |
#gcode: | |
# G10 | |
# SAVE_GCODE_STATE NAME=SNAPSHOT | |
# G1 X175.0 F10000 | |
# G1 Y100.0 F10000 | |
# G4 P500 ;dwell | |
# M400 ;clear buffer | |
# _TIMELAPSE_NEW_FRAME | |
# G4 P250 ;moar dwelling | |
# M400 | |
# RESTORE_GCODE_STATE NAME=SNAPSHOT MOVE=1 | |
# G11 | |
#[gcode_macro TIMELAPSE_RENDER] | |
#gcode: | |
# {action_call_remote_method("timelapse_render")} | |
#[gcode_macro TOGGLE_LEDLIGHTS] | |
#gcode: | |
# SET_PIN PIN=LEDlights VALUE={(not printer['output_pin LEDlights'].value)|int} | |
## for Measuring Resonances through Raspberry pi | |
## https://www.klipper3d.org/Measuring_Resonances.html | |
## [mcu rpi] | |
## serial: /tmp/klipper_host_mcu | |
## [output_pin LEDlights] | |
## pin: rpi:gpio17 | |
## value: 1 | |
## shutdown_value: 1 | |
## [adxl345] | |
## cs_pin: rpi:None | |
## [resonance_tester] | |
## accel_chip: adxl345 | |
## probe_points: | |
## 100,100,20 # an example | |
#*# <---------------------- SAVE_CONFIG ----------------------> | |
#*# DO NOT EDIT THIS BLOCK OR BELOW. The contents are auto-generated. | |
#*# | |
#*# [heater_bed] | |
#*# pid_kp = 73.517 | |
#*# pid_ki = 2.301 | |
#*# pid_kd = 587.215 | |
#*# control = pid | |
#*# | |
#*# [input_shaper] | |
#*# shaper_type_x = 3hump_ei | |
#*# shaper_type_y = 3hump_ei | |
#*# | |
#*# [extruder] | |
#*# pid_kp = 19.084 | |
#*# pid_ki = 0.790 | |
#*# pid_kd = 115.220 | |
#*# control = pid | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment