Skip to content

Instantly share code, notes, and snippets.

@prcutler
Last active May 11, 2023 11:53
Show Gist options
  • Star 2 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save prcutler/9360ab01795c55f37a1063159c72813d to your computer and use it in GitHub Desktop.
Save prcutler/9360ab01795c55f37a1063159c72813d to your computer and use it in GitHub Desktop.
Ender 3 v2 Klipper printer.cfg
# This file contains pin mappings for the stock 2020 Creality Ender 3
# V2. To use this config, during "make menuconfig" select the
# STM32F103 with a "28KiB bootloader" and serial (on USART1 PA10/PA9)
# communication.
# If you prefer a direct serial connection, in "make menuconfig"
# select "Enable extra low-level configuration options" and select
# serial (on USART3 PB11/PB10), which is broken out on the 10 pin IDC
# cable used for the LCD module as follows:
# 3: Tx, 4: Rx, 9: GND, 10: VCC
# Flash this firmware by copying "out/klipper.bin" to a SD card and
# turning on the printer with the card inserted. The firmware
# filename must end in ".bin" and must not match the last filename
# that was flashed.
# See docs/Config_Reference.md for a description of parameters.
[virtual_sdcard]
path: /home/pi/gcode_files
[pause_resume]
[display_status]
[gcode_macro CANCEL_PRINT]
description: Cancel the actual running print
rename_existing: CANCEL_PRINT_BASE
gcode:
TURN_OFF_HEATERS
CANCEL_PRINT_BASE
[stepper_x]
step_pin: PC2
dir_pin: PB9
enable_pin: !PC3
microsteps: 16
rotation_distance: 40
endstop_pin: ^PA5
position_endstop: 0
position_max: 235
homing_speed: 50
[stepper_y]
step_pin: PB8
dir_pin: PB7
enable_pin: !PC3
microsteps: 16
rotation_distance: 40
endstop_pin: ^PA6
position_endstop: 0
position_max: 235
homing_speed: 50
[stepper_z]
step_pin: PB6
dir_pin: !PB5
enable_pin: !PC3
microsteps: 16
rotation_distance: 8
endstop_pin: probe:z_virtual_endstop
# position_endstop: 0.0
position_max: 250
position_min: -5
[extruder]
max_extrude_only_distance: 100.0
step_pin: PB4
dir_pin: PB3
enable_pin: !PC3
microsteps: 16
rotation_distance: 34.406
nozzle_diameter: 0.400
filament_diameter: 1.750
heater_pin: PA1
sensor_type: EPCOS 100K B57560G104F
sensor_pin: PC5
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: 250
[heater_bed]
heater_pin: PA2
sensor_type: EPCOS 100K B57560G104F
sensor_pin: PC4
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: PA0
[mcu]
serial: /dev/serial/by-id/usb-1a86_USB_Serial-if00-port0
restart_method: command
[printer]
kinematics: cartesian
max_velocity: 300
max_accel: 3000
max_z_velocity: 5
max_z_accel: 100
[bltouch]
sensor_pin: ^PB1
control_pin: PB0
x_offset: -42.5
y_offset: -5
#z_offset: 0
[safe_z_home]
home_xy_position: 117.5,117.5 # Change coordinates to the center of your print bed
speed: 120
z_hop: 10 # Move up 10mm
z_hop_speed: 5
[bed_mesh]
speed: 120
horizontal_move_z: 5
mesh_min: 15, 15
mesh_max: 205, 205
probe_count: 3,3
algorithm: bicubic
fade_start: 1
fade_end: 10
fade_target: 0
[screws_tilt_adjust]
screw1: 70.5,37.5
screw1_name: front left screw
screw2: 240,37.5
screw2_name: front right screw
screw3: 240,207.5
screw3_name: rear right screw
screw4: 70.5,207.5
screw4_name: rear left screw
horizontal_move_z: 10
speed: 50
screw_thread: CW-M4
[include macros/*.cfg]
[gcode_macro START_PRINT]
gcode:
{% set BED_TEMP = params.BED_TEMP|default(60)|float %}
{% set EXTRUDER_TEMP = params.EXTRUDER_TEMP|default(210)|float %}
# Start bed heating
M140 S{BED_TEMP}
# Use absolute coordinates
G90
# Reset the G-Code Z offset (adjust Z offset if needed)
SET_GCODE_OFFSET Z=0
# Home the printer
G28
# Move the nozzle near the bed
G1 Z5 F3000
# Move the nozzle very close to the bed
G1 Z0.15 F300
# Wait for bed to reach temperature
M60 S{BED_TEMP}
# Set and wait for nozzle to reach temperature
M109 S{EXTRUDER_TEMP}
[gcode_macro END_PRINT]
gcode:
# Turn off bed, extruder, and fan
M140 S0
M104 S0
M106 S0
# Move nozzle away from print while retracting
G91
G1 X-2 Y-2 E-3 F300
# Raise nozzle by 10mm
G1 Z10 F3000
G90
# Disable steppers
M84
[respond]
default_type: command
#*# <---------------------- SAVE_CONFIG ---------------------->
#*# DO NOT EDIT THIS BLOCK OR BELOW. The contents are auto-generated.
#*#
#*# [bltouch]
#*# z_offset = 3.250
@prcutler
Copy link
Author

Line 61 and the Z stop is defined by the BL Touch if I remember correctly

@montarion
Copy link

yep figured it out moments after I asked, mb

@TheBarber82
Copy link

TheBarber82 commented May 11, 2023

Hi, when I try SCREWS_TILT_CALCULATE I have Move out of range: 240.000 37.500 10.000 [0.000], do you have an idea. I am using your [screws_tilt_adjust].
Thanks

@prcutler
Copy link
Author

I don't know, I'm sorry. I would only see move out of range errors after cancelling a print, it was a bug in Klipper. Restarting Klipper usually fixed it.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment