# JUST A NOTE, THIS REQUIRES THE FOLLOWING KLIPPER MODULE TO FUNCTION: https://github.com/Annex-Engineering/klipper/blob/master/klippy/extras/dockable_probe.py # Documentation can be found here: https://github.com/Annex-Engineering/klipper/blob/master/docs/Dockable_Probe.md # This file has been created by Trails, of Annex Engineering, for the K2 3D Printer. # Please change settings for your specific build or ensure you place your items in the same spots on the same MCU as I have. # I've added as many options as I can think of for different displays as well as listed the available commands you can use via the terminal at the bottom of this configuration file. #THIS CONFIG IS FOR A 250mm x 250mm x 250mm K1 PRINTER ONLY FOR THE FYSETC SPIDER 2.0 CONTROLLER with a BTT Motor Expander Connected to the display ports #PLEASE READ THE WHOLE CONFIG BEFORE ATTEMPTING TO DO ANYTHING #CONNECTORS/PORTS ON THE CONTROLLERS ARE NOTED WITH COMMENTS FOR EACH LOCATION/INPUT/OUTPUT # use the following modifiers before the pin definition (ex: ^!ar99) # ! invert the logic # ^ activate 5v pullup (does not apply to all pins) # mcu_name: use pins on additional MCU (ex: z:ar10) # MCU SPIDER [mcu] serial: /dev/serial/by-id/usb-Klipper_stm32f446xx_32000A000250305538333620-if00 restart_method: command [mcu rpi] serial: /tmp/klipper_host_mcu # EXP1 / EXP2 (display) pins [board_pins] aliases: # EXP2 header EXP1_1=<5V>, EXP1_2=, EXP1_3=PD1, EXP1_4=PD0, EXP1_5=PC12, EXP1_6=PC10, EXP1_7=PD2, EXP1_8=PC11, EXP1_9=PA8, EXP1_10=PC9, # EXP1 header EXP2_1=<5V>, EXP2_2=, EXP2_3=, EXP2_4=PB10, EXP2_5=PA7, EXP2_6=PC7, EXP2_7=PA4, EXP2_8=PC6, EXP2_9=PA5, EXP2_10=PA6 #virtual sdcard settings [virtual_sdcard] path: ~/gcode_files #enable display status for moonraker [display_status] # Enable Pause/Resume Functionality [pause_resume] #Printer Speeds and Accels [printer] kinematics: cartesian max_velocity: 350 #change this to 500 after comissioning max_accel: 2000 #change this to 7500 after commissioning max_z_velocity: 8 #change this to 15 after comissioning max_z_accel: 500 #change this to 1000 after comissioning square_corner_velocity: 5.0 #Gcode G2/G3 Arc Support [gcode_arcs] resolution: 0.1 #Input Shaper Settings # you need to tune your printer for this, if your lazy you can use these values as a starting point # [input_shaper] # shaper_freq_x: 59 #(100*8)/13.5 # shaper_freq_y: 51 #(100*8)/15.75 # shaper_type: mzv # Stepper Configs [stepper_x] # connected to X Stepper on SPIDER step_pin: PE11 dir_pin: PE10 enable_pin: !PE9 # 20t Pulley, 2mm Pitch on a 0.9deg Motor rotation_distance: 40 microsteps: 16 full_steps_per_rotation: 400 # connected to virtual endstop endstop_pin: tmc2209_stepper_x:virtual_endstop position_min: 0 position_endstop: 0 position_max: 310 homing_retract_dist: 0 homing_speed: 50.0 homing_positive_dir: false [stepper_x1] # connected to Y Stepper on SPIDER step_pin: PD8 dir_pin: !PB12 enable_pin: !PD9 # 20t Pulley, 2mm Pitch on a 0.9deg Motor rotation_distance: 40 microsteps: 16 full_steps_per_rotation: 400 # connected to virtual endstop endstop_pin: tmc2209_stepper_x1:virtual_endstop [stepper_y] # connected to Z Stepper on SPIDER step_pin: PD14 dir_pin: !PD13 enable_pin: !PD15 # 20t Pulley, 2mm Pitch on a 0.9deg Motor rotation_distance: 40 microsteps: 16 full_steps_per_rotation: 400 # connected to virtual endstop endstop_pin: tmc2209_stepper_y:virtual_endstop position_min: 0 position_endstop: 0 position_max: 310 homing_retract_dist: 0 homing_speed: 50.0 homing_positive_dir: false [stepper_y1] # connected to E0 Stepper on SPIDER step_pin: PD5 dir_pin: !PD6 enable_pin: !PD4 # 20t Pulley, 2mm Pitch on a 0.9deg Motor rotation_distance: 40 microsteps: 16 full_steps_per_rotation: 400 # connected to virtual endstop endstop_pin: tmc2209_stepper_y1:virtual_endstop [probe] ## Inductive Probe ## This probe is not used for Z height, only Quad Gantry Leveling ## Z_MAX on mcu_z ## If your probe is NO instead of NC, add change pin to !z:P0.10 pin: ^PA2 x_offset: 0 y_offset: 30.0 z_offset: 2.54 speed: 3.0 samples: 3 samples_result: median sample_retract_dist: 5 samples_tolerance: 0.006 samples_tolerance_retries: 3 [stepper_z] # connected to E1 Stepper on SPIDER (Front Left Stepper, from top) step_pin: PE6 dir_pin: PC13 enable_pin: !PE5 # 20t Pulley, 2mm Pitch on a 1.8deg Motor with a 40:1 worm drive attached rotation_distance: 40 microsteps: 4 full_steps_per_rotation: 200 gear_ratio: 40:1 # connected to E1 (Y-Max Port) Endstop on SPIDER endstop_pin: probe:z_virtual_endstop position_max: 270 #this is set here on purpose, your actual travel will vary based on spring compression holding the bed, adjust at your own risk position_min: -5 homing_speed: 10.0 second_homing_speed: 5.0 homing_retract_dist: 15.0 homing_positive_dir: false [stepper_z1] # connected to E2 Stepper on SPIDER (Rear Left Stepper, from top) step_pin: PE2 dir_pin: !PE4 enable_pin: !PE3 # 20t Pulley, 2mm Pitch on a 1.8deg Motor with a 40:1 worm drive attached rotation_distance: 40 microsteps: 4 full_steps_per_rotation: 200 gear_ratio: 40:1 [stepper_z2] # connected to E3 Stepper on SPIDER (Rear Right Stepper, from top) step_pin: PD12 dir_pin: !PC4 enable_pin: !PE8 # 20t Pulley, 2mm Pitch on a 1.8deg Motor with a 40:1 worm drive attached rotation_distance: 40 microsteps: 4 full_steps_per_rotation: 200 gear_ratio: 40:1 [stepper_z3] # connected to E4 Stepper on SPIDER (Front Right Stepper, from top) step_pin: PE1 dir_pin: PE0 enable_pin: !PC5 # 20t Pulley, 2mm Pitch on a 1.8deg Motor with a 40:1 worm drive attached rotation_distance: 40 microsteps: 4 full_steps_per_rotation: 200 gear_ratio: 40:1 # TMC Stepper Configurations for All Motors [tmc2209 stepper_x] # connected to X Stepper on SPIDER uart_pin: PE7 interpolate: true run_current: 1.0 sense_resistor: 0.110 stealthchop_threshold: 0 # Place a jumper on the two pin header near the endstop for sensorless homing diag_pin: PB14 #connected to X Endstop (X Jumper Header) driver_SGTHRS: 150 [tmc2209 stepper_x1] # connected to Y Stepper on SPIDER uart_pin: PE15 interpolate: true run_current: 1.0 sense_resistor: 0.110 stealthchop_threshold: 0 # Place a jumper on the two pin header near the endstop for sensorless homing diag_pin: PB13 #connected to Y Endstop (Y Jumper Header) driver_SGTHRS: 150 [tmc2209 stepper_y] # connected to Z Stepper on SPIDER uart_pin: PD10 interpolate: true run_current: 1.0 sense_resistor: 0.110 stealthchop_threshold: 0 # Place a jumper on the two pin header near the endstop for sensorless homing diag_pin: PA0 #connected to Z Endstop (Z Jumper Header) driver_SGTHRS: 150 [tmc2209 stepper_y1] # connected to E0 Stepper on SPIDER uart_pin: PD7 interpolate: true run_current: 1.0 sense_resistor: 0.110 stealthchop_threshold: 0 # Place a jumper on the two pin header near the endstop for sensorless homing diag_pin: PA3 #connected to E0 Endstop (E0 Jumper Header) driver_SGTHRS: 150 [tmc2209 stepper_z] # connected to E1 Stepper on SPIDER (Front Left Stepper, from top) uart_pin: PC14 interpolate: true run_current: 1.2 hold_current: 1.0 sense_resistor: 0.110 stealthchop_threshold: 0 [tmc2209 stepper_z1] # connected to E2 Stepper on SPIDER (Rear Left Stepper, from top) uart_pin: PC15 interpolate: true run_current: 1.2 hold_current: 1.0 sense_resistor: 0.110 stealthchop_threshold: 0 [tmc2209 stepper_z2] # connected to E3 Stepper on SPIDER (Rear Right Stepper, from top) uart_pin: PA15 interpolate: true run_current: 1.2 hold_current: 1.0 sense_resistor: 0.110 stealthchop_threshold: 0 [tmc2209 stepper_z3] # connected to E4 Stepper on SPIDER (Front Right Stepper, from top) uart_pin: PD11 interpolate: true run_current: 1.2 hold_current: 1.0 sense_resistor: 0.110 stealthchop_threshold: 0 [tmc2209 extruder] # connected to Stepper 1 on BTT Expander uart_pin: EXP1_6 interpolate: false run_current: 0.3 sense_resistor: 0.110 stealthchop_threshold: 0 # Force Move # used to force a single stepper to move. not used once setup [force_move] enable_force_move: true [homing_override] gcode: g28 x #g0 x150 g28 y g0 x150 y150 set_position_z: 50 # Extruder0 [extruder] # conected to Stepper 1 on BTT Expander step_pin: EXP2_6 dir_pin: EXP2_5 enable_pin: !EXP2_7 rotation_distance: 22.67895 #for 5mm Shaft Driven Bondtech gearsets gear_ratio: 5:1 #Sherpa Mini uses 5:1, Folded Ascender Use 40:1 or 20:1 microsteps: 16 full_steps_per_rotation: 200 #1.8 deg motor #0.4mm Nozzle nozzle_diameter: 0.400 #pressure_advance: 0.035 #pressure_advance_smooth_time: 0.040 filament_diameter: 1.750 max_extrude_only_distance: 1400.0 max_extrude_only_velocity: 120.0 max_extrude_only_accel: 15000.0 max_extrude_cross_section: 20000.0 # connected to Heater0 on SPIDER heater_pin: PB15 max_power: 1.0 # connected to Thermistor0 on SPIDER sensor_type: PT1000 sensor_pin: PC0 #Hotend PID Settings control: pid pid_Kp: 32.426 pid_Ki: 1.743 pid_Kd: 150.782 min_extrude_temp: -273.15 min_temp: -273.15 max_temp: 300 # Heated Bed [heater_bed] # connected to Heater1 on SPIDER heater_pin: PC8 # NTC 100K MGB18-104F39050L32 is for Kenovo thermistors sensor_type: NTC 100K MGB18-104F39050L32 # connected to Thermistor1 on SPIDER sensor_pin: PC1 smooth_time: 3.0 #Build Plate PID Settings max_power: 0.60 control: pid pid_Kp: 42.475 pid_Ki: 1.395 pid_Kd: 323.339 min_temp: -273.15 max_temp: 110 # Raspberry Pi Temperature Sensor [temperature_sensor pi_cpu] sensor_type: temperature_host gcode_id: P # Fans # Hotend Cooling Fan [heater_fan my_nozzle_fan] # connected to Fan0 on SPIDER - 12v Fan pin: PB0 max_power: 1.0 hardware_pwm: false kick_start_time: 0.500 heater: extruder heater_temp: 75.0 fan_speed: 1.00 # print cooling fan [fan] # connected to Fan1 on SPIDER - 12v Fan pin: PB1 max_power: 1.0 kick_start_time: 0.500 # thermally and driver_on controlled electronics bay fan (wire fans in parallel into the single connector) [controller_fan electronics_fan_1] # connected to Fan2 on SPIDER - 24v Fan pin: PB2 max_power: 1.0 kick_start_time: 0.500 fan_speed: 1.00 idle_timeout: 60 heater: heater_bed # Mesh Bed Settings [bed_mesh] speed: 200 horizontal_move_z: 20.0 mesh_min: 40,40 mesh_max: 210,210 probe_count: 5,5 fade_start: 0.5 fade_end: 2 split_delta_z: .025 move_check_distance: 5.0 mesh_pps: 2,2 algorithm: bicubic bicubic_tension: 0.1 relative_reference_index: 12 # ^^^because were measuring the offset from the nozzle switch to the bed using the center of the bed, the equation to find the location = (probe point count)/2-1 # z_tilt Bed Adjustment settings [z_tilt] #4 Z Motors z_positions: -122,-34 -122,336 378,336 378,-34 points: 50,50 50,200 200,50 200,200 speed: 200 horizontal_move_z: 20.0 retries: 4 retry_tolerance: 0.01 # Motor and Heater Idle Timeout [idle_timeout] timeout: 6000 # Macros # pre-print-prep macro [gcode_macro pre_print_prep] gcode: chamber_lighting_on ;turn on lighting abs_warmup_temp ;tell bed to warm up Z_TILT_ADJUST ;adjust bed so its square to gantry BED_MESH_CALIBRATE ;Run Bed Mesh # macro to level the gantry. use G32 in the terminal to call [gcode_macro g32] gcode: Z_TILT_ADJUST ;adjust bed so its square to gantry # macro to level bed to the gantry [gcode_macro square_bed_to_machine] gcode: G32 ;adjust bed so its square to gantry # mesh bed level the machine [gcode_macro mesh_bed_level_machine] gcode: BED_MESH_CALIBRATE ;Run Bed Mesh # combined print start gcode macro that takes into account temperature from the slicer [gcode_macro print_start] gcode: {% set EXTRUDER = params.EXTRUDER|default(260) %} {% set BED = params.BED|default(110) %} print_start_1 ;print start macro 1 M140 S{BED} ;set bed temperature and wait M109 S{EXTRUDER} ;set hotend temperature and wait M190 S{BED} ;set bed temperature and do not wait print_start_2 ;print start macro 2 prime_line_regular ;draw prime line in corner of bed [gcode_macro print_start_1] gcode: M104 S0 #cancel set temp M107 #turn cooling fans off G21 # set units to mm G90 # use absolute coordinates T0 # select tool 0 M83 # use relative extrusion G92 E0.0 # reset e count M220 S100 # reset speed multiplier nozzle_brush_location #move to nozzle scrubber bucket [gcode_macro print_start_2] gcode: #nozzle_clean #clean nozzle - change to brush location and uncomment [gcode_macro prime_line_regular] gcode: G1 Z20 F6000 G1 X20 Y40 F12000 G1 Z0.5 F600 G1 Y105 E10 F1000 G1 Y115 E2.5 F1000 G92 E0.0 ;set extruder to Zero G92 Z0.5 ;let printer know its at 0.5 G90 ;set to absolute # Use print_end for you slicer ending script [gcode_macro print_end] gcode: G91 #relative positioning G0 E-0.3 F4800 #retract 5mm of filament G0 Z+1.00 X-2 Y-2 F6000 #short quick move to disengage from print G0 Z+5.00 F6000 #move Z-Axis 1mm away from part G90 #absolute positioning G0 X50 Y50 #move gantry close to xy min, by nozzle switch in front G91 #relative positioning G0 E10 F400 #extrude filament to get better blob on end G0 E-0.30 F1800 #retract additional filament to move out of melt zone G90 #absolute positioning M104 S0 #turn off hotend #M140 S0 #turn off heatbed #z bed placement control for end of print SAVE_GCODE_STATE NAME=END_state {% if printer.toolhead.position.z|float == printer.configfile.config["stepper_z"]["position_max"]|float %} #if z position = z max do the following # do nothing {% elif printer.toolhead.position.z|float >= 130|float %} #if z position >= 130mnm do the following G91 #relative positioning G1 Z+10 F600 #move z down 10mm G90 #absolute positioning {% else %} #if you dont meet any of the criteria G90 #absolute positioning G1 Z130 F600 #move z to 130mm {% endif %} RESTORE_GCODE_STATE NAME=END_state M106 S0 #shut off part cooling fans #M84 #turn off motors clear_pause #clear pause state encase it was enabled # Macro to execute when pausing printer [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 # Macro to execute when resuming printer [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 # Macro to execute when canceling a print [gcode_macro CANCEL_PRINT] rename_existing: BASE_CANCEL_PRINT gcode: print_end #execute the print end macro CLEAR_PAUSE SDCARD_RESET_FILE BASE_CANCEL_PRINT # Notify when ABS Timer is complete [delayed_gcode notify_chamber] initial_duration: 0 gcode: {gcode.action_respond_info("action:prompt_begin Chamber Preheated")} {action_respond_info("action:prompt_choice OK")} {action_respond_info("action:prompt_show")} # Set Temps for chamber warmup when printing with abs [gcode_macro abs_warmup_temp] gcode: {% set BED = params.BED|default(110) %} M106 S255 #turn part cooling fan on to blow heat around chamber M190 S{TEMP} #set bed temperature and wait G28 #home machine G0 X125 Y125 Z20 F3000 #move to center of bed UPDATE_DELAYED_GCODE ID=notify_chamber DURATION=1200 # Notify when filament is unloaded and ready to reload [delayed_gcode notify_extruder_reload] initial_duration: 0 gcode: {action_respond_info("action:prompt_begin Ready to Load Filament")} {action_respond_info("action:prompt_choice OK")} {action_respond_info("action:prompt_show")} # Macro to Load Filament [gcode_macro load_filament] gcode: {% set EXTRUDER = params.EXTRUDER|default(260) %} turn_fans_off #turn part cooling fans off G0 X10 Y40 F18000 #move to area where can easily load filament {% if printer.toolhead.position.z|float == printer.configfile.config["stepper_z"]["position_max"]|float %} #if z position = z max do the following # do nothing {% elif printer.toolhead.position.z|float >= 50|float %} #if z position >= 50mnm do the following #do nothing {% else %} #if you dont meet any of the criteria G90 #absolute positioning G1 Z50 F600 #move z to 50mm {% endif %} M109 S{EXTRUDER} #set hotend temperature and wait M83 #relative positioning on extruder G0 E120 F400 #prime extruder M109 S0 #turn off extruder UPDATE_DELAYED_GCODE ID=notify_extruder_load DURATION=10 # Notify when filament is loaded [delayed_gcode notify_extruder_load] initial_duration: 0 gcode: {action_respond_info("action:prompt_begin FIlament is Loaded")} {action_respond_info("action:prompt_choice OK")} {action_respond_info("action:prompt_show")} # Macro to Unload Filament [gcode_macro unload_filament] gcode: {% set EXTRUDER = params.EXTRUDER|default(260) %} turn_fans_off #turn part cooling fans off G0 X10 Y40 F18000 #move to area where can easily load filament {% if printer.toolhead.position.z|float == printer.configfile.config["stepper_z"]["position_max"]|float %} #if z position = z max do the following # do nothing {% elif printer.toolhead.position.z|float >= 50|float %} #if z position >= 50mnm do the following #do nothing {% else %} #if you dont meet any of the criteria G90 #absolute positioning G1 Z50 F600 #move z to 50mm {% endif %} M109 S{EXTRUDER} #set hotend temperature and wait M83 #relative positioning on extruder G0 E5 F400 #extrude filament to get better blob on end G0 E-600 F1800 #retract additional filament to move out of melt zone UPDATE_DELAYED_GCODE ID=notify_extruder_reload DURATION=10 # Scrubs the nozzle on the brass brush located in the build chamber [gcode_macro nozzle_clean] gcode: SAVE_GCODE_STATE NAME=clean_nozzle_state #store current nozzle location nozzle_brush_location #move to nozzle brush G91 #relative positioning G0 Z-27 F600 #move nozzle to end of brush and into bristles {% for n in range(6) %} nozzle_clean_path #run macro for nozzle clean {% endfor %} G0 Z25 F600 #move nozzle out of bristles G90 RESTORE_GCODE_STATE NAME=clean_nozzle_state MOVE=1 #restore current nozzle location # Path that the nozzle cleaning macro will follow to clean nozzle (must be in relative coordinate gcode) [gcode_macro nozzle_clean_path] gcode: G0 Y+60 F12000 #scrub G0 Y-60 F12000 #scrub # Where to start the nozzle brush cleaning pattern [gcode_macro nozzle_brush_location] gcode: G0 X0 Y40 F18000 G0 Z25.0 F600 #move to nozzle scrubber # Macro for M600 - filament out pause resume [gcode_macro M600] gcode: {% set X = params.X|default(40) %} {% set Y = params.Y|default(40) %} {% set Z = params.Z|default(10) %} {% if printer.toolhead.status == "Ready" %} # do nothing {% else %} M117 Filament Change SAVE_GCODE_STATE NAME=M600_state PAUSE G91 G1 E-5 F4000 G1 Z{Z} G90 G1 X{X} Y{Y} F3000 G0 E15 F1800 #extrude filament to get better blob on end G0 E-500 F4800 #retract additional filament to move out of melt zone RESTORE_GCODE_STATE NAME=M600_state {% endif %} # Use this command to load filament during a mid print filament swap [gcode_macro SWAP_RESUME] gcode: M117 Printing... LOAD_FILAMENT RESUME # Macro to Turn Fans Off [gcode_macro turn_fans_off] gcode: M107 # Redefine M204 gcode to properly accel_to_decel when called instead of keeping default through the print [gcode_macro M204] rename_existing: M204.1 gcode: {% if 'P' in params %}{% set accel = params.P %}{% endif %} {% if 'S' in params %}{% set accel = params.S %}{% endif %} {% if 'T' in params %}{% set accel = params.T %}{% endif %} SET_VELOCITY_LIMIT ACCEL={ accel } ACCEL_TO_DECEL={ accel|float / 2.0} # Macro to Attach the Magnetic Probe [gcode_macro attach_probe_to_toolhead] gcode: ATTACH_PROBE # Macro to Detach the Magnetic Probe [gcode_macro detach_probe_from_toolhead] gcode: DETACH_PROBE