Skip to content

Instantly share code, notes, and snippets.

@jfryman
Created January 27, 2023 22:30
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save jfryman/fb935b988fafe1f05c0eb968fa62de09 to your computer and use it in GitHub Desktop.
Save jfryman/fb935b988fafe1f05c0eb968fa62de09 to your computer and use it in GitHub Desktop.
AM8 Klipper Config
########################################
# Printer Configuration
########################################
[mcu]
serial: /dev/serial/by-id/usb-Klipper_stm32f429xx_3C001E000250315637383220-if00
#[mcu rpi]
#serial: /tmp/klipper_host_mcu
#[adxl345]
#cs_pin: rpi:None
#[resonance_tester]
#accel_chip: adxl345
#probe_points:
# 125, 105, 20 # an example
# [filament_switch_sensor filament_sensor]
# switch_pin:PE4
# pause_on_runout: false #pause handled by macro
# runout_gcode:
# M600 #calls a macro with the name M600 (so it can be called by slicers too)
# insert_gcode:
# M117 Filament inserted #just a throwaway GCode command to have something in this space. You can add your own.
# # A list of G-Code commands to execute after a filament insert is
# # detected. See docs/Command_Templates.md for G-Code format. The
# # default is not to run any G-Code commands, which disables insert
# # detection.
# event_delay: 3.0
# pause_delay: 0.0001
[printer]
kinematics: cartesian
max_velocity: 300
max_accel: 3000
max_z_velocity: 5
max_z_accel: 100
[board_pins]
aliases:
# EXP1 header
EXP1_1=PC5, EXP1_3=PB1, EXP1_5=PE10, EXP1_7=PE12, EXP1_9=<GND>,
EXP1_2=PB0, EXP1_4=PE9, EXP1_6=PE11, EXP1_8=PE13, EXP1_10=<5V>,
# EXP2 header
EXP2_1=PA6, EXP2_3=PE7, EXP2_5=PB2, EXP2_7=PC4, EXP2_9=<GND>,
EXP2_2=PA5, EXP2_4=PA4, EXP2_6=PA7, EXP2_8=<RST>, EXP2_10=<NC>
[bed_screws]
screw1: 13,6
screw1_name: Front Left
screw2: 13,115
screw1_name: Front Center
screw3: 13,210
screw3_name: Front Right
screw4: 123,6
screw1_name: Center Left
screw5: 123,210
screw3_name: Center Right
screw6: 228,6
screw3_name: Back Left
screw7: 228,115
screw1_name: Back Center
screw8: 228,210
screw3_name: Back Right
[skew_correction]
[input_shaper]
[virtual_sdcard]
path: ~/gcode-uploads
[force_move]
enable_force_move: True
######################################################################
# Display Configuration
######################################################################
[display]
lcd_type: emulated_st7920
en_pin: EXP1_4
spi_software_sclk_pin: EXP1_5
spi_software_mosi_pin: EXP1_3
spi_software_miso_pin: EXP1_6
encoder_pins: ^EXP2_3, ^EXP2_5
click_pin: ^!EXP1_2
[display_status]
[output_pin beeper]
pin: EXP1_1
########################################
# Stepper Configurations
########################################
[stepper_x]
step_pin: PE2
dir_pin: PE1
enable_pin: !PE3
microsteps: 16
rotation_distance: 40
endstop_pin: !PC1
position_endstop: 0
position_max: 250
homing_speed: 50
[tmc2209 stepper_x]
uart_pin: PE0
run_current: 1.2
#stealthchop_threshold: 1
[stepper_y]
step_pin: PD5
dir_pin: PD4
enable_pin: !PD6
microsteps: 16
rotation_distance: 40
position_endstop: 0
position_max: 210
homing_speed: 50
endstop_pin: !PC3
[tmc2209 stepper_y]
uart_pin: PD3
run_current: 1.2
[stepper_z]
step_pin: PA15
dir_pin: PA8
enable_pin: !PD1
microsteps: 16
rotation_distance: 8
endstop_pin: probe:z_virtual_endstop
position_max: 185
position_min: -5
[tmc2209 stepper_z]
uart_pin: PD0
run_current: 1.2
#stealthchop_threshold: 1
[stepper_z1]
step_pin: PD11
dir_pin: PD10
enable_pin: !PD13
microsteps: 16
rotation_distance: 8
[tmc2209 stepper_z1]
uart_pin: PD12
run_current: 1.2
#stealthchop_threshold: 1
[extruder]
step_pin: PD15
dir_pin: PD14
enable_pin: !PC7
microsteps: 16
rotation_distance: 39.235
gear_ratio: 57:11
nozzle_diameter: 0.400
filament_diameter: 1.750
heater_pin: PB3
sensor_type: ATC Semitec 104GT-2
sensor_pin: PA2
min_temp: 0
max_temp: 275
max_extrude_only_distance: 750
pressure_advance: 0.5524
[tmc2209 extruder]
uart_pin: PC6
run_current: 1.7
#stealthchop_threshold: 1
########################################
# Thermal Management
########################################
[heater_bed]
heater_pin: PD7
sensor_type: EPCOS 100K B57560G104F
sensor_pin: PA1
#control: pid
min_temp: 0
max_temp: 130
[fan]
pin: PB7
# Due to BTT implementing a Marlin-specific safety feature,
# "anti-reversal stepper protection", this pin needs pulling
# high to pass power to stepper drivers and most FETs
[output_pin motor_power]
pin: PC13
value: 1
########################################
# Automatic Bed Leveling
########################################
[bltouch]
sensor_pin: ^PE4
control_pin: PE5
x_offset: -38
y_offset: 14
stow_on_each_sample: False
probe_with_touch_mode: True
speed: 4.0
samples: 2
sample_retract_dist: 3.0
[safe_z_home]
home_xy_position: 163, 91
speed: 150
z_hop: 10
z_hop_speed: 150
[bed_mesh]
speed: 120
horizontal_move_z: 5
mesh_min: 38, 14
mesh_max: 212,196
probe_count: 6,6
mesh_pps: 3,3
algorithm: lagrange
fade_end: 4
[z_tilt]
z_positions:
-65,105
305,105
points:
45,105
240,105
retries: 5
retry_tolerance: 0.02
speed:50
########################################
# Macros
########################################
[pause_resume]
recover_velocity: 50 #allows pause resume functionality.
#Below Macro with credit to Hywel Martin #https://github.com/KevinOConnor/klipper/issues/1354
[gcode_macro PARK_MACRO]
gcode:
M117 PARKING..
G91
G1 E-3.14 F1500
G1 Z30
G90
G1 X0 Y0 F3000
[gcode_macro UNLOAD]
gcode:
G91
G1 E5.0 F1200
G1 E3.0 F1600
G1 E-13.14 F7000
G1 E-400 F3000
G90
[gcode_macro M600]
gcode:
PAUSE_MACRO
UNLOAD
[gcode_macro PAUSE_MACRO]
gcode:
PAUSE
PARK_MACRO
SET_IDLE_TIMEOUT TIMEOUT=7200
[gcode_macro PURGE]
gcode:
M117 PURGING..
G91
G1 E45.0 F250
G90
[gcode_macro LOAD_FILAMENT]
gcode:
M117 LOADING...
G91
G1 E25.0 F1000
G1 E400 F2500
G4 P900
G1 E45.0 F250
G90
[gcode_macro RESUME_MACRO]
gcode:
M117 RESUMING...
RESUME
[gcode_macro PRIME_NOZZLE]
gcode:
SAVE_GCODE_STATE NAME=PRIME_NOZZLE_STATE
M117 Priming
G90 ; Absolute coordinates.
M83 ; Relative extruder mode.
G92 E0 ; Reset Extruder
PRIME_LINE
RESTORE_GCODE_STATE NAME=PRIME_NOZZLE_STATE
[gcode_macro PRIME_LINE]
gcode:
; Move to start of line.
G1 Z10 F900
G1 Y3 X3 F18000
G1 Z0.2 F900
; Print the line.
G91 ; Relative coordinates.
G1 X100 E25 F1000 ; Extrude filament 25mm (how much it retracted in PRINT_END).
G1 Y-2 F1000
G1 X-60 E9 F1000 ; Print second part of the line.
G1 E-0.5 F3000 ; Retract to avoid stringing.
G1 X0.5 E0 F1000 ; Wipe back to break string.
G1 X-5.5 E0 F1000 ; Wipe forward to break string.
G0 X125 Y125 Z0.15 F5000 ; Return to center of bed
[gcode_macro PRIME_KISS]
gcode:
G0 X240 Y0 Z5 F5000 ; Move to position
G1 E80 F300 ; Extrude a kiss
G0 X205 Y0 Z0 F1000 ; Wipe
G0 X215 Y0 Z0 F1000 ; Wipe
G0 X205 Y5 Z-0.1 F700 ; Wipe
G0 X215 Y5 Z-0.1 F700 ; Wipe
G0 X205 Y10 Z0 F1000 ; Wipe
G0 X205 Y10 Z0 F1000 ; Wipe
G0 Z2 E-.75 F300 ; Retract 2mm
G0 X125 Y125 Z4 F5000 ; Return to center of bed
[gcode_macro START_PRINT]
gcode:
SET_SKEW XY=141.49,140.13,99.69 ; Correct for Skew of machine
G28 ; Home - G28 or G32 depending on printer.
Z_TILT_ADJUST
BED_MESH_CALIBRATE
PRIME_NOZZLE
G90 ; Absolute coordinates.
G92 E0
M117 Printing
[gcode_macro END_PRINT]
gcode:
M400 ; wait for buffer to clear
G92 E0 ; zero the extruder
G1 E-5.0 F3600 ; retract filament
G91 ; relative positioning
SET_SKEW CLEAR=1 ; Disable skew correction
# Get Boundaries
{% set max_x = printer.configfile.config["stepper_x"]["position_max"]|float %}
{% set max_y = printer.configfile.config["stepper_y"]["position_max"]|float %}
{% set max_z = printer.configfile.config["stepper_z"]["position_max"]|float %}
# Check end position to determine safe direction to move
{% if printer.toolhead.position.x < (max_x - 20) %}
{% set x_safe = 20.0 %}
{% else %}
{% set x_safe = -20.0 %}
{% endif %}
{% if printer.toolhead.position.y < (max_y - 20) %}
{% set y_safe = 20.0 %}
{% else %}
{% set y_safe = -20.0 %}
{% endif %}
{% if printer.toolhead.position.z < (max_z - 2) %}
{% set z_safe = 2.0 %}
{% else %}
{% set z_safe = max_z - printer.toolhead.position.z %}
{% endif %}
{% set z_park_abs = printer.toolhead.position.z + 25.0 %}
{% if z_park_abs > max_z %}
{% set z_park_abs = max_z %}
{% endif %}
G0 Z{z_safe} F3600 ; move nozzle up
G0 X{x_safe} Y{y_safe} F20000 ; move nozzle to remove stringing
G1 E-20.0 F3600 ; retract filament another 20mm (completely out of hot zone)
TURN_OFF_HEATERS
M107 ; turn off fan
G90 ; absolute positioning
G0 Z{z_park_abs} F3600 ; move nozzle up away from the print
G0 X{max_x / 2} Y{max_y} F15000 ; park nozzle at rear
M117 Done
[gcode_macro SOUND_CHARGE]
gcode:
; sound chirp (Optional)
M300 P75 S1750
M300 P250 S0
M300 P75 S1750
M300 P75 S0
; End Sound chirp
; sound chirp (Optional)
M300 P75 S1750
M300 P250 S0
M300 P75 S1750
M300 P75 S0
; End Sound chirp
#*# <---------------------- SAVE_CONFIG ---------------------->
#*# DO NOT EDIT THIS BLOCK OR BELOW. The contents are auto-generated.
#*#
#*# [extruder]
#*# control = pid
#*# pid_kp = 33.634
#*# pid_ki = 1.838
#*# pid_kd = 153.877
#*#
#*# [heater_bed]
#*# pid_kp = 60.737
#*# pid_ki = 0.997
#*# pid_kd = 924.719
#*# control = pid
#*#
#*# [bltouch]
#*# z_offset = 2.900
#*#
#*# [bed_mesh default]
#*# version = 1
#*# points =
#*# -0.072332, -0.074832, -0.094832, -0.166082, -0.233582, -0.314832
#*# 0.013918, 0.042668, 0.046418, -0.036082, -0.102332, -0.138582
#*# 0.007668, 0.087668, 0.080168, 0.013918, -0.019832, -0.082332
#*# 0.028918, 0.072668, 0.050168, 0.103918, -0.002332, -0.048582
#*# 0.051418, 0.057668, 0.042668, 0.036418, -0.044832, -0.038582
#*# 0.082668, 0.022668, 0.011418, 0.027668, -0.029832, -0.084832
#*# tension = 0.2
#*# min_x = 38.0
#*# algo = lagrange
#*# y_count = 6
#*# mesh_y_pps = 3
#*# min_y = 14.0
#*# x_count = 6
#*# max_y = 196.0
#*# mesh_x_pps = 3
#*# max_x = 211.95
#*#
#*# [input_shaper]
#*# shaper_type_x = mzv
#*# shaper_freq_x = 111.8
#*# shaper_type_y = 2hump_ei
#*# shaper_freq_y = 61.8
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment