Skip to main content

Klipper Reference Configuration

####################################################################################
# 3D MELLOW / (Add as needed) #
####################################################################################
## Fly-DP5 documentation website:
## Fly-DP5 schematic website:
## FLY Official Taobao Store: https://shop126791347.taobao.com/shop/view_shop.htm?spm=a230r.1.14.4.1a4840a8hyvpPJ&user_number_id=2464680006
## For after-sales service, please contact Taobao customer service
## FLY After-sales Technical Support Group: 621032883
## FLY-RRF Firmware Discussion Group: 786561979

#####################################################################
# Notes #
#####################################################################
##***Items to change/check:***
## MCU path [mcu]
## Printer movement range xyz position
## Thermistor type [extruder] and [heater_bed]
## Z endstop position [safe_z_home]
## Z endstop offset [stepper_z]
## PID tuning [extruder] and [heater_bed]
## Extruder motor step tuning [extruder]

#####################################################################
# File Includes #
#####################################################################
#[include fluidd.cfg] # FLUIDD include file.
#[include mainsail.cfg] # MAINSDIL include file.
#Determine which file to use as needed

#####################################################################
# Mainboard Configuration #
#####################################################################
[mcu] # FLY board ID
serial: /dev/serial/by-id/usb-Klipper_stm32f072xb_************************
### To check USB firmware id: ls /dev/serial/by-id/
### Replace /dev/serial/by-id/usb-Klipper_stm32f072xb_************************ with your id
#canbus_uuid: e51d5c71a901
### To check CAN firmware id: ~/klippy-env/bin/python ~/klipper/scripts/canbus_query.py can0
### For CAN, replace serial with canbus_uuid: and add the id

#####################################################################
# Printer and Acceleration #
#####################################################################
[printer] # Printer settings
kinematics: corexy # Kinematics: cartesian or corexy, etc.
max_velocity: 300 # Max printer speed
max_accel: 3000 # Max acceleration (max 3000)
max_z_velocity: 15 # Max Z speed
max_z_accel: 100 # Max Z acceleration
square_corner_velocity: 5.0 # Square corner velocity, lower to reduce inertia from heavy beds

#####################################################################
# Temperature Monitoring #
#####################################################################
[temperature_sensor Fly-DP5] # FLY board temperature
sensor_type: temperature_mcu # Linked to mcu (default)
#####################################################################
#[temperature_sensor FLY-π] # Host temperature
#sensor_type: temperature_host # Linked to host

#####################################################################
# Bed Mesh Calibration #
#####################################################################
[bed_mesh]
speed: 50 # Calibration speed
horizontal_move_z: 5 # Z lift before moving to next point
mesh_min: 30,30 # Min calibration point (x, y)
mesh_max: 270, 270 # Max calibration point (x, y)
probe_count: 4,4 # Probe points (4x4 = 16 points)
mesh_pps: 2,2 # Extra probe points
algorithm: bicubic # Algorithm model
bicubic_tension: 0.2 # Do not change

#####################################################################
# X/Y Stepper Motor Settings #
#####################################################################
# B__________A
# Z0
#
# 12864

#####################################################################
# X Stepper Motor (Motor B) #
#####################################################################
## DRIVER0 motor position
[stepper_x]
step_pin: PC15
dir_pin: PC14
enable_pin: !PC2
rotation_distance: 40 # Pulley circumference mm (2GT-20T: 40, 2GT-16T: 32)
microsteps: 16
full_steps_per_rotation: 200 # Steps per revolution (1.8°: 200, 0.9°: 400)
endstop_pin: ^PB4 # Endstop pin, normally closed recommended
#endstop_pin: tmc5160_stepper_x:virtual_endstop # Sensorless homing
### Add ! to invert if needed, prevents crashes if wire breaks
position_min: 0
position_endstop: 300
position_max: 300
homing_speed: 200
homing_retract_dist: 5
#####################################################################
## Ensure correct driver type (2208 or 2209)
[tmc2209 stepper_x]
uart_pin: PC13
interpolate: False
run_current: 0.8
sense_resistor: 0.110
stealthchop_threshold: 0
#####################################################################
# [tmc5160 stepper_x]
# cs_pin: PC13
# spi_bus: spi2
# run_current: 1.0
# interpolate: False
# sense_resistor: 0.075 # Use 0.033 for 5160 Pro
# stealthchop_threshold: 0

#####################################################################
# Y Stepper Motor (Motor A) #
#####################################################################
## DRIVER1 motor position
[stepper_y]
step_pin: PA1
dir_pin: PA0
enable_pin: !PA2
rotation_distance: 40
microsteps: 16
full_steps_per_rotation: 200
endstop_pin: ^PB3
#endstop_pin: tmc5160_stepper_x:virtual_endstop
### Add ! to invert if needed, prevents crashes if wire breaks
position_min: 0
position_endstop: 300
position_max: 300
homing_speed: 200
homing_retract_dist: 5
#####################################################################
## Ensure correct driver type (2209 or 5160)
[tmc2209 stepper_y]
uart_pin: PC3
interpolate: False
run_current: 0.8
sense_resistor: 0.110
stealthchop_threshold: 0
#####################################################################
#[tmc5160 stepper_y]
#cs_pin: PC3
#spi_bus: spi2
#run_current: 1.0
#interpolate: False
#sense_resistor: 0.075 # Use 0.033 for 5160 Pro
#stealthchop_threshold: 0

#####################################################################
# Z Stepper Motor #
#####################################################################
## DRIVER2 motor position
[stepper_z]
step_pin: PA5
dir_pin: !PA4
enable_pin: !PA6
rotation_distance: 8 # Leadscrew pitch, adjust as needed
microsteps: 16
full_steps_per_rotation: 200
endstop_pin: ^PD2
position_max: 290
position_endstop: -0.5
position_min: -5
homing_speed: 10
second_homing_speed: 3
homing_retract_dist: 3
#####################################################################
[tmc2209 stepper_z]
uart_pin: PA3
interpolate: false
run_current: 0.8
sense_resistor: 0.110
stealthchop_threshold: 0
######################################################################
## DRIVER4 motor position
#[stepper_z1]
#step_pin: PB10
#dir_pin: PB2
#enable_pin: !PB11
#rotation_distance: 8
#microsteps: 32

#[tmc2209 stepper_z1]
#uart_pin: PB1
#interpolate: false
#run_current: 1.0
#sense_resistor: 0.110
#stealthchop_threshold: 0

#####################################################################
# Extruder Configuration #
#####################################################################
## DRIVER7 motor position
[extruder]
step_pin:PC5
dir_pin:PC4
enable_pin: !PB0
microsteps: 16
full_steps_per_rotation: 200
rotation_distance: 22.52245
# Step calibration: 23.1325301 = old value 22.6789511 * actual 102 / target 100
gear_ratio: 50:10 # Gear ratio (Galileo: 7.5:1, comment out; BMG: 50:17, output shaft front, input shaft rear)
nozzle_diameter: 0.400
filament_diameter: 1.750
heater_pin: PC6
sensor_type: Generic 3950
sensor_pin: PC1
max_power: 1.0
min_temp: -235
max_temp: 350
min_extrude_temp: 150
pressure_advance: 0.04
pressure_advance_smooth_time:0.040
# Nozzle PID tune: "PID_CALIBRATE HEATER=extruder TARGET=245"
control = pid
pid_kp = 26.213
pid_ki = 1.304
pid_kd = 131.721

[tmc2209 extruder]
uart_pin:PA7
interpolate: False
run_current: 0.6
sense_resistor: 0.110
stealthchop_threshold: 0

#####################################################################
# Heated Bed Configuration #
#####################################################################
[heater_bed]
heater_pin: PC7
sensor_type: Generic 3950
sensor_pin: PC0
max_power: 1.0
min_temp: -235
max_temp: 120
# Bed PID tune: "PID_CALIBRATE HEATER=heater_bed TARGET=100"
control: pid
pid_kp: 58.437
pid_ki: 2.347
pid_kd: 363.769
#####################################################################
# Fan Configuration #
#####################################################################
[fan]
pin:PC9
kick_start_time: 1.0
off_below: 0.10
max_power: 1.0
#####################################################################
[heater_fan Heatbreak]
pin:PC8
max_power: 1.0
kick_start_time: 0.5
heater: extruder
heater_temp: 50
fan_speed: 1.0

#####################################################################
# Idle Bed Shutdown #
#####################################################################
[idle_timeout]
timeout: 1800 # Turn off bed after 30 minutes idle

#####################################################################
# Bed Leveling Probe #
#####################################################################
# Default PL08N probe should not be lower than nozzle, for leveling only.
# If your PL08N is NO (normally open), add ! to the pin.
[probe]
pin: ^PB5
x_offset: 0
y_offset: 25.0
z_offset: 0
speed: 10.0
samples: 3
samples_result: median
sample_retract_dist: 4.0
samples_tolerance: 0.007
samples_tolerance_retries: 3
#####################################################################
#[bltouch]
#sensor_pin: ^PB5
#control_pin: PA8
#x_offset: 0
#y_offset: 25.0
#z_offset: 0

#####################################################################
# Homing #
#####################################################################
[safe_z_home]
home_xy_position:206,300
speed:100
z_hop:10
#####################################################################
#[homing_override]
#axes: z
#set_position_z: 0
#gcode:
# G90
# G0 Z15 F600
# G28 X Y
# ## Z endstop XY position
# ## After, update X0 and Y0 to your values (e.g. X157, Y305)
# ## Z endstop position
# G0 X185 Y250 F3600 #250mm
# G28 Z
# G0 Z10 F1800

#####################################################################
# 12864 Display Configuration #
#####################################################################
[board_pins]
aliases:
EXP1_1=NC, EXP1_3=PC11, EXP1_5=PC10, EXP1_7=NC, EXP1_9=<GND>,
EXP1_2=PA15, EXP1_4=PA14, EXP1_6=PA13, EXP1_8=NC, EXP1_10=<5V>,
# EXP2 header
EXP2_1=PB14, EXP2_3=PC12, EXP2_5=PB6, EXP2_7=NC, EXP2_9=<GND>,
EXP2_2=PB13, EXP2_4=PB12, EXP2_6=PB15, EXP2_8=<RST>, EXP2_10=<NC>,
#####################################################################
[display]
lcd_type: uc1701
cs_pin: EXP1_3
a0_pin: EXP1_4
rst_pin: EXP1_5
contrast: 63
encoder_pins: ^EXP2_5, ^!EXP2_3
click_pin: ^!EXP1_2
####################################################################
#### For FLY Mini12864
[neopixel fly_mini12864]
pin: EXP1_6
chain_count: 3
initial_RED: 0.5
initial_GREEN: 0.5
initial_BLUE: 0.5
color_order: RGB
####################################################################
[neopixel TP_led]
pin:PB7
chain_count: 50
color_order: GRB
initial_RED: 0.0
initial_GREEN: 0.1
initial_BLUE: 0.0
#####################################################################
# Custom G-code Macros #
#####################################################################
[gcode_macro PRINT_START]
gcode:
G92 E0
G28
G1 Z20 F3000
#SET_LED LED=LEDlight RED=0.2 GREEN=0.2 BLUE=0.5
#M117 Printing

#####################################################################
[gcode_macro PRINT_HUAXIAN]
gcode:
G1 Z5 F3000
G92 E0
G90
G0 X5 Y1 F6000
G0 Z0.4
G91
G1 X100 E20 F1200
G1 Y1
G1 X-100 E20 F1200
G0 z5
G1 E-5.0 F3600
G92 E0
G90

#####################################################################
[gcode_macro PRINT_END]
gcode:
# 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 directions 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 %}

M400
G92 E0
G1 E-10.0 F3600
G91
G0 Z{z_safe} F3600
G0 X{x_safe} Y{y_safe} F20000
M104 S0
M140 S0
M106 S0
G90
G0 X{max_x / 2} Y{max_y} F3600
BED_MESH_CLEAR