Skip to content

Instantly share code, notes, and snippets.

@jeanfbrito
Last active April 23, 2024 13:22
Show Gist options
  • Save jeanfbrito/88a561b58b85a0c6a46da9389ec2197c to your computer and use it in GitHub Desktop.
Save jeanfbrito/88a561b58b85a0c6a46da9389ec2197c to your computer and use it in GitHub Desktop.
Anet A8 Plus Klipper configuration
# This file is an example config file for cartesian style printers.
# One may copy and edit this file to configure a new cartesian
# printer.
# DO NOT COPY THIS FILE WITHOUT CAREFULLY READING AND UPDATING IT
# FIRST. Incorrectly configured parameters may cause damage.
# See docs/Config_Reference.md for a description of parameters.
#####################################################################
# X/Y Stepper Settings
#####################################################################
[stepper_x]
step_pin: P2.2
dir_pin: P2.6
enable_pin: !P2.1
rotation_distance: 40
full_steps_per_rotation:200
endstop_pin: !P1.29
position_min: -7
position_endstop: -7
position_max: 295
homing_speed: 50
homing_retract_dist: 5
microsteps: 16
[tmc2209 stepper_x]
uart_pin: P1.10
#interpolate: True
run_current: 0.7
#hold_current: 0.5
[stepper_y]
step_pin: P0.19
dir_pin: P0.20
enable_pin: !P2.8
rotation_distance: 40
full_steps_per_rotation:200
endstop_pin: !P1.28
position_min: -25
position_endstop: -25
position_max: 270
homing_speed: 50
homing_retract_dist: 5
microsteps: 16
[tmc2209 stepper_y]
uart_pin: P1.9
#interpolate: True
run_current: 0.8
#hold_current: 0.5
[stepper_z]
step_pin: P0.22
dir_pin: !P2.11
enable_pin: !P0.21
rotation_distance: 8
endstop_pin: !P1.27
position_endstop: 0.0
position_max: 300
position_min: -3
homing_speed: 5.0
second_homing_speed: 2
homing_retract_dist: 5
microsteps: 16
[stepper_z1]
step_pin: P1.15
dir_pin: !P1.14
enable_pin: !P1.16
microsteps: 16
rotation_distance: 8
endstop_pin: !P1.25
[tmc2209 stepper_z]
uart_pin: P1.8
#interpolate: True
run_current: 0.8
#hold_current: 0.5
[tmc2209 stepper_z1]
uart_pin: P1.1
#interpolate: True
run_current: 0.8
#hold_current: 0.5
#####################################################################
# Extruder
#####################################################################
# E0 on MCU
[extruder]
step_pin: P2.13
dir_pin: !P0.11
enable_pin: !P2.12
## Update value below when you perform extruder calibration
## If you ask for 100mm of filament, but in reality it is 98mm:
## rotation_distance = <previous_rotation_distance> * <actual_extrude_distance> / 100
## 22.6789511 is a good starting point
rotation_distance: 22.6789511 #Bondtech 5mm Drive Gears
## Update Gear Ratio depending on your Extruder Type
## Use 50:17 for Afterburner/Clockwork (BMG Gear Ratio)
## Use 80:20 for M4, M3.1
gear_ratio: 50:17 #BMG Gear Ratio
#rotation_distance: 29.5
microsteps: 16
full_steps_per_rotation: 200 #200 for 1.8 degree, 400 for 0.9 degree
nozzle_diameter: 0.4
filament_diameter: 1.75
max_extrude_only_distance: 220.0
heater_pin: P2.7
## Validate the following thermistor type to make sure it is correct
sensor_type: ATC Semitec 104GT-2
#sensor_type: NTC 100K beta 3950
sensor_pin: P0.24
min_temp: 0
max_temp: 270
max_power: 1.0
min_extrude_temp: 160
max_extrude_only_velocity: 75.0
max_extrude_only_accel: 1000.0
## Try to keep pressure_advance below 1.0
#pressure_advance: 0.11
## Default is 0.040, leave stock
#pressure_advance_smooth_time: 0.040
#control: pid
#pid_Kp=28.278
#pid_Ki=1.746
#pid_Kd=114.528
## E0 on MCU X/Y
## Make sure to update below for your relevant driver (2208 or 2209)
[tmc2209 extruder]
uart_pin: P1.4
interpolate: false
run_current: 0.5
#hold_current: 0.3
[fan]
## Print Cooling Fan - XYE board, Fan Pin
pin: P2.3
kick_start_time: 3.5
## Depending on your fan, you may need to increase this value
## if your fan will not start. Can change cycle_time (increase)
## if your fan is not able to slow down effectively
off_below: 0.10
[bltouch]
sensor_pin: P0.10
control_pin: P2.0
pin_up_touch_mode_reports_triggered: False
samples: 3
#x_offset: 68
x_offset: 46
#x_offset: -51
y_offset: 0
#y_offset: -24.8
#z_offset: 0.7
[bed_mesh]
speed: 120
horizontal_move_z: 5
mesh_min: 50,10
mesh_max: 290, 270
probe_count: 6,6
[bed_screws]
screw1: 5,30
screw2: 285,30
screw3: 285,245
screw4: 5,245
#####################################################################
# Bed Heater
#####################################################################
[heater_bed]
heater_pin: P2.5
#sensor_type: NTC 100K beta 3950
sensor_type: EPCOS 100K B57560G104F
sensor_pin: P0.25
## Adjust Max Power so your heater doesn't warp your bed
max_power: 1.0
min_temp: 0
max_temp: 120
#control: pid
#pid_Kp=76.304
#pid_Ki=1.657
#pid_Kd=878.444
[display]
# mini12864 LCD Display
lcd_type: uc1701
cs_pin: P1.18
a0_pin: P1.19
encoder_pins: ^P3.25,^P3.26
click_pin: ^!P0.28
contrast: 63
[mcu]
serial: /dev/serial/by-id/usb-Klipper_lpc1769_16200018C09869AF9BF6405EC22000F5-if00
[printer]
kinematics: cartesian
max_velocity: 150
max_accel: 3000
#max_accel: 1500
#max_accel_to_decel: 1500
#max_z_velocity: 15
max_z_velocity: 5
max_z_accel: 30
square_corner_velocity: 5.0
[input_shaper]
shaper_freq_x: 28.2
shaper_freq_y: 23
shaper_type: mzv
#[mcu rpi]
#serial: /tmp/klipper_host_mcu
#[adxl345]
#cs_pin: rpi:None
#[resonance_tester]
#accel_chip: adxl345
#probe_points:
# 150, 150, 20 # an example
######################################################################
# Filament Change
######################################################################
# M600: Filament Change. This macro will pause the printer, move the
# tool to the change position, and retract the filament 50mm. Adjust
# the retraction settings for your own extruder. After filament has
# been changed, the print can be resumed from its previous position
# with the "RESUME" gcode.
# Pressure Advance test macro by drawing 20 simple lines
#
# Adapted from: https://www.reddit.com/r/VORONDesign/comments/sjdiol/pressure_advance_testing_macro_klipper/
# to suit home-made free ABL that requires a pause after homing to manually retract the probe.
#
# To do that, the process is divided into 2 macros:
#
# - PA_INIT to bring bed and extruder up to temperature, then home.
# eg. PA_INIT BED_TEMP=65 EXTRUDER_TEMP=205
# After homing, the ABL can be manually retracted
#
# - PA_CAL to start the Pressure Advance test.
# eg. PA_CAL PA_START=0.01 PA_STEP=0.01 NZL=0.4
# This will draw 20 lines using different PA values
#
# To use, simply include in printer.cfg:
#
# [include pa_macro.cfg]
[gcode_macro PA_INIT]
gcode:
{% set BED_TEMP = params.BED_TEMP|default(60)|float %}
{% set EXTRUDER_TEMP = params.EXTRUDER_TEMP|default(190)|float %}
M140 S{BED_TEMP} ;Start heating bed
M190 S{BED_TEMP} ;Wait for bed to reach temp before proceeding
M104 S{EXTRUDER_TEMP} ;Start heating extruder
M109 S{EXTRUDER_TEMP} ;Wait for extruder to reach temp before proceeding
G28 ;Home all axes and pause with audio alert
[gcode_macro PA_CAL]
gcode:
{% set PA_START = params.PA_START|default(0.0)|float %}
{% set PA_STEP = params.PA_STEP|default(0.005)|float %}
{% set NZL_CFG = printer.configfile.config["extruder"]["nozzle_diameter"]|float %}
{% set NZL = params.NZL|default(NZL_CFG)|float %}
{% set E5 = (0.1147475 * NZL) * 5|float %}
{% set E20 = (0.1147475 * NZL) * 20|float %}
{% set E40 = (0.1147475 * NZL) * 40|float %}
{% set X_MID = printer.configfile.config["stepper_x"]["position_max"]|float / 2.0 %}
{% set Y_MID = printer.configfile.config["stepper_y"]["position_max"]|float / 2.0 %}
G21 ; millimeter units
G90 ; absolute XYZ
M83 ; relative E
SET_VELOCITY_LIMIT ACCEL=3000 ACCEL_TO_DECEL=1500
G92 E0 ; reset extruder
M106 S0 ; set fan speed to zero
; This was taken from Cura to prime the extruder by tracing a line at the
; left side of the build bed twice
G1 X10.1 Y20 Z0.28 F5000.0 ; move to start position
G1 X10.1 Y200.0 Z0.28 F1500.0 E15 ; draw the first line
G1 X10.4 Y200.0 Z0.28 F5000.0 ; move to side a little
G1 X10.4 Y20 Z0.28 F1500.0 E30 ; draw the second line
G1 E-2 F1800 ; retract
G1 Z5 F300 ; move above layer height
{% for i in range(0, 20) %}
SET_PRESSURE_ADVANCE ADVANCE={PA_START + (i * PA_STEP)} ; set Pressure Advance
M117 Testing Pressure Advance at: {PA_START + (i * PA_STEP)}
G1 X{(X_MID-40)} Y{(Y_MID-35)+(5*i)} F5000 ; move to start position
G1 Z0.2 F300 ; move to layer height
G1 E2 F1800 ; un-retract
G1 X{(X_MID-20)} Y{(Y_MID-35)+(5*i)} E{E20} F300 ; print line part one
G1 X{(X_MID+20)} Y{(Y_MID-35)+(5*i)} E{E40} F9000 ; print line part two
G1 X{(X_MID+40)} Y{(Y_MID-35)+(5*i)} E{E20} F300 ; print line part three
G1 E-2 F1800 ; retract
G1 Z5 F300 ; move above layer height
{% endfor %}
; This was again taken from Cura to raise the extruder and push the build plate forward when test is done
G1 Z20 F300 ; Raise Z more
G1 X{X_MID} Y{(Y_MID-35)+(5*24)} F300 ; Present print by pushing build plate forward a little
M117 Find best line and multiply it by ({PA_START} + (line * {PA_STEP}) ) to find your PA setting.
[pause_resume]
[gcode_macro M600]
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-50 F1000
M18 E
RESTORE_GCODE_STATE NAME=M600_state
#*# <---------------------- SAVE_CONFIG ---------------------->
#*# DO NOT EDIT THIS BLOCK OR BELOW. The contents are auto-generated.
#*#
#*# [extruder]
#*# control = pid
#*# pid_kp = 31.911
#*# pid_ki = 2.149
#*# pid_kd = 118.471
#*#
#*# [bed_mesh default]
#*# version = 1
#*# points =
#*# -0.100000, -0.126667, -0.114167, -0.063333, -0.053333, -0.046667
#*# -0.065833, -0.093333, -0.087500, -0.087500, -0.075833, -0.095833
#*# -0.057500, -0.081667, -0.130833, -0.113333, -0.115833, -0.108333
#*# -0.075833, -0.088333, -0.116667, -0.102500, -0.096667, -0.102500
#*# -0.134167, -0.137500, -0.130000, -0.110000, -0.093333, -0.054167
#*# -0.126667, -0.116667, -0.106667, -0.061667, 0.009167, 0.051667
#*# tension = 0.2
#*# min_x = 50.0
#*# algo = lagrange
#*# y_count = 6
#*# mesh_y_pps = 2
#*# min_y = 10.0
#*# x_count = 6
#*# max_y = 270.0
#*# mesh_x_pps = 2
#*# max_x = 290.0
#*#
#*# [bltouch]
#*# z_offset = 2.100
#*#
#*# [heater_bed]
#*# control = pid
#*# pid_kp = 75.650
#*# pid_ki = 1.005
#*# pid_kd = 1424.118
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment