Skip to content

Instantly share code, notes, and snippets.

@dmcbane
Created March 18, 2023 14:36
Show Gist options
  • Save dmcbane/c771f868d16677e9dac8751525c985a2 to your computer and use it in GitHub Desktop.
Save dmcbane/c771f868d16677e9dac8751525c985a2 to your computer and use it in GitHub Desktop.
OctoKlipper config for Ender 3 with v4.2.7 board and BLTouch
# This file contains pin mappings for the Creality "v4.2.7" board. 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.
[stepper_x]
step_pin: PB9
dir_pin: PC2
enable_pin: !PC3
microsteps: 16
rotation_distance: 40
endstop_pin: ^PA5
position_endstop: 0
position_max: 235
homing_speed: 50
[stepper_y]
step_pin: PB7
dir_pin: PB8
enable_pin: !PC3
microsteps: 16
rotation_distance: 40
endstop_pin: ^PA6
position_endstop: 0
position_max: 235
homing_speed: 50
[stepper_z]
step_pin: PB5
dir_pin: !PB6
enable_pin: !PC3
microsteps: 16
rotation_distance: 8
endstop_pin: ^PA7
# position_endstop: 0.0. # disable to use BLTouch
# position_max: 250. # disable to use BLTouch
endstop_pin: probe:z_virtual_endstop # enable to use BLTouch
position_min: -5 # enable to use BLTouch
position_max: 250
[safe_z_home] # enable for BLTouch
home_xy_position: 162.8,128.2
speed: 100
z_hop: 10
z_hop_speed: 5
[bltouch] # enable for BLTouch - fast-mode
sensor_pin: ^PB1
control_pin: PB0
pin_up_touch_mode_reports_triggered: True
probe_with_touch_mode: True
# toolhead: X:112.200000 Y:109.800000 Z:1.000000 E:50.000000
# toolhead: X:157.500000 Y:120.500000 Z:10.000000 E:0.000000
# modify as needed for bltouch location
x_offset: -45.3
# modify as needed for bltouch location
y_offset: -10.7
# modify as needed for bltouch or run PROBE_CALIBRATE
z_offset: 2.964
sample_retract_dist: 2.0 # Can be set lower, example 2.5 depending on height of bltouch from bed
lift_speed: 20
samples_tolerance_retries: 3
speed: 1
samples: 1
[bed_mesh]
speed: 80
horizontal_move_z: 5
mesh_min: 18,18
mesh_max: 175,202
probe_count: 5,5
algorithm: bicubic
# # manual Bed adjustment via BED_SCREWS_ADJUST
# [bed_screws]
# screw1: 72.5, 41.5
# screw1_name: front left screw
# screw2: 198.5,35.5
# screw2_name: front right screw
# screw3: 198.5,205.5
# screw3_name: rear right screw
# screw4: 28.5,205.5
# screw4_name: rear left screw
# horizontal_move_z: 10
# speed: 50
[screws_tilt_adjust]
screw1: 72.5, 41.5
screw1_name: front left screw
screw2: 198.5,41.5
screw2_name: front right screw
screw3: 198.5,212.5
screw3_name: rear right screw
screw4: 72.5,212.5
screw4_name: rear left screw
horizontal_move_z: 10
speed: 50
screw_thread: CW-M4
[input_shaper]
shaper_freq_x: 100
shaper_freq_y: 100
shaper_type: mzv
[gcode_macro G29]
gcode:
G28
BED_MESH_CALIBRATE
G0 X0 Y0 Z10 F6000
BED_MESH_PROFILE save=default
SAVE_CONFIG
[extruder]
# rotation_distance = <full_steps_per_rotation> * <microsteps> / <steps_per_mm>
# <full_steps_per_rotation> = 360 degrees / 1.8 degrees/step = 200 steps/rotation
# <microsteps> = 16 per the configration below and the driver documentation
# 10.87 mm (diameter of the "hobbed bolt" on the extruder)
# initial rotation distance = 10.86 * pi = 34.149
# actual extrude distance 48.86 mm
# rotation_distance = previous_rotation_distance * actual_extrude_distance / requested_extrude_distance
# = 34.149 * 48.86 / 50 = 33.370
max_extrude_only_distance: 100.0
step_pin: PB3
dir_pin: PB4
enable_pin: !PC3
microsteps: 16
rotation_distance: 33.370
nozzle_diameter: 0.400
filament_diameter: 1.750
heater_pin: PA1
sensor_type: EPCOS 100K B57560G104F
sensor_pin: PC5
#control: pid
#pid_Kp: 21.527
#pid_Ki: 1.063
#pid_Kd: 108.982
min_temp: 0
max_temp: 400
[heater_bed]
heater_pin: PA2
sensor_type: EPCOS 100K B57560G104F
sensor_pin: PC4
#control: pid
#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
[display]
lcd_type: st7920
cs_pin: PB12
sclk_pin: PB13
sid_pin: PB15
encoder_pins: ^PB14, ^PB10
click_pin: ^!PB2
[board_pins]
aliases:
EXP1_1=PC6,EXP1_3=PB10,EXP1_5=PB14,EXP1_7=PB12,EXP1_9=<GND>,
EXP1_2=PB2,EXP1_4=PB11,EXP1_6=PB13,EXP1_8=PB15,EXP1_10=<5V>,
PROBE_IN=PB0,PROBE_OUT=PB1,FIL_RUNOUT=PC6
######################################################################
# Start Print and End Print
######################################################################
# Replace the slicer's custom start and end g-code scripts with
# START_PRINT and END_PRINT.
[gcode_macro START_PRINT]
gcode:
; Ender 3 Custom Start G-code
G92 E0 ; Reset Extruder
G28 ; Home all axes
G1 Z2.0 F3000 ; Move Z Axis up little to prevent scratching of Heat Bed
G1 X1.1 Y20 Z0.3 F5000.0 ; Move to start position
G1 X1.1 Y200.0 Z0.3 F1500.0 E15 ; Draw the first line
G1 X1.4 Y200.0 Z0.3 F5000.0 ; Move to side a little
G1 X1.4 Y20 Z0.3 F1500.0 E30 ; Draw the second line
G92 E0 ; Reset Extruder
G1 Z2.0 F3000 ; Move Z Axis up little to prevent scratching of Heat Bed
G1 X5 Y20 Z0.3 F5000.0 ; Move over to prevent blob squish
## {% set BED_TEMP = params.BED_TEMP|default(60)|float %}
## {% set EXTRUDER_TEMP = params.EXTRUDER_TEMP|default(190)|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.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 F## 300
## # Wait for## bed to reach temperature
## M190 S{BED## _TEMP}
## # Set and ## wait for nozzle to reach temperature
## M109 S{EXT## RUDER_TEM## ## ## ## ## ## ## ## ## ## P}
[gcode_macro END_PRINT]
gcode:
; Ender 3 Custom End G-code
G91 ;Relative positioning
G1 E-2 F2700 ;Retract a bit
G1 E-2 Z0.2 F2400 ;Retract and raise Z
G1 X5 Y5 F3000 ;Wipe out
G1 Z10 ;Raise Z more
G90 ;Absolute positioning
G1 X0 Y235 ;Present print
M106 S0 ;Turn-off fan
M104 S0 ;Turn-off hotend
M140 S0 ;Turn-off bed
M84 X Y E ;Disable all steppers but Z
## # 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
#*# <---------------------- SAVE_CONFIG ---------------------->
#*# DO NOT EDIT THIS BLOCK OR BELOW. The contents are auto-generated.
#*#
#*# [bed_mesh default]
#*# version = 1
#*# points =
#*# -0.640000, -0.315000, -0.011250, 0.262500, 0.508750
#*# 0.022500, 0.216250, 0.385000, 0.511250, 0.597500
#*# 0.041250, 0.357500, 0.652500, 0.918750, 1.157500
#*# 0.538750, 0.768750, 0.971250, 1.142500, 1.277500
#*# 0.707500, 1.006250, 1.297500, 1.557500, 1.797500
#*# tension = 0.2
#*# min_x = 18.0
#*# algo = bicubic
#*# y_count = 5
#*# mesh_y_pps = 2
#*# min_y = 18.0
#*# x_count = 5
#*# max_y = 202.0
#*# mesh_x_pps = 2
#*# max_x = 175.0
#*#
#*# [extruder]
#*# control = pid
#*# pid_kp = 27.781
#*# pid_ki = 1.798
#*# pid_kd = 107.305
#*#
#*# [heater_bed]
#*# control = pid
#*# pid_kp = 70.414
#*# pid_ki = 1.436
#*# pid_kd = 863.453
#*#
#*# [bltouch]
#*# z_offset = 2.964
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment