Skip to content

Instantly share code, notes, and snippets.

@mdshw5
Last active October 6, 2025 12:27
Show Gist options
  • Select an option

  • Save mdshw5/cefb2633c0575c47712aab1ef4a33cfd to your computer and use it in GitHub Desktop.

Select an option

Save mdshw5/cefb2633c0575c47712aab1ef4a33cfd to your computer and use it in GitHub Desktop.
klipper config for modified wanhao d9
# This file contains pin mappings for the Wanhao Duplicator 9 MK1,
# also sold as the Monoprice Maker Pro MK1. To use this config,
# the firmware should be compiled for the AVR atmega2560.
# See the example.cfg file for a description of available parameters.
[stepper_x]
step_pin: PF7
dir_pin: !PK0
enable_pin: !PF6
microsteps: 16
rotation_distance: 40
endstop_pin: ^!PF0
position_endstop: 0
position_max: 300
homing_speed: 50
[stepper_y]
step_pin: PK2
dir_pin: PK3
enable_pin: !PE4
microsteps: 16
rotation_distance: 40
endstop_pin: ^!PA2
position_endstop: 0
position_max: 300
homing_speed: 50.0
[stepper_z]
step_pin: PK5
dir_pin: PK7
enable_pin: !PK4
microsteps: 16
rotation_distance: 8
endstop_pin: probe:z_virtual_endstop
position_max: 370
position_min: -10
homing_speed: 10
[extruder]
step_pin: PF4
dir_pin: !PF5
enable_pin: !PF3
microsteps: 16
rotation_distance: 3.364928
nozzle_diameter: 0.4
filament_diameter: 1.75
heater_pin: PG5
sensor_type: EPCOS 100K B57560G104F
sensor_pin: PF1
control: pid
pid_Kp: 33.41
pid_Ki: 1.47
pid_Kd: 189.27
max_extrude_only_distance: 150.0
min_temp: 0
max_temp: 315
[heater_bed]
heater_pin: PE5
sensor_type: EPCOS 100K B57560G104F
sensor_pin: PK6
control: pid
pid_Kp: 64.095903
pid_Ki: 1.649830
pid_Kd: 622.531455
min_temp: 0
max_temp: 120
[fan]
pin: PE3
[bltouch]
sensor_pin: PH3
control_pin: PH4
x_offset: -33
y_offset: 0
#z_offset: 2
[safe_z_home]
home_xy_position: 150,150 # Change coordinates to the center of your print bed
speed: 50
z_hop: 10 # Move up 10mm
z_hop_speed: 5
[mcu]
serial: /dev/ttyUSB0
[board_pins arduino-mega]
aliases:
ar0=PE0, ar1=PE1, ar2=PE4, ar3=PE5, ar4=PG5,
ar5=PE3, ar6=PH3, ar7=PH4, ar8=PH5, ar9=PH6,
ar10=PB4, ar11=PB5, ar12=PB6, ar13=PB7, ar14=PJ1,
ar15=PJ0, ar16=PH1, ar17=PH0, ar18=PD3, ar19=PD2,
ar20=PD1, ar21=PD0, ar22=PA0, ar23=PA1, ar24=PA2,
ar25=PA3, ar26=PA4, ar27=PA5, ar28=PA6, ar29=PA7,
ar30=PC7, ar31=PC6, ar32=PC5, ar33=PC4, ar34=PC3,
ar35=PC2, ar36=PC1, ar37=PC0, ar38=PD7, ar39=PG2,
ar40=PG1, ar41=PG0, ar42=PL7, ar43=PL6, ar44=PL5,
ar45=PL4, ar46=PL3, ar47=PL2, ar48=PL1, ar49=PL0,
ar50=PB3, ar51=PB2, ar52=PB1, ar53=PB0, ar54=PF0,
ar55=PF1, ar56=PF2, ar57=PF3, ar58=PF4, ar59=PF5,
ar60=PF6, ar61=PF7, ar62=PK0, ar63=PK1, ar64=PK2,
ar65=PK3, ar66=PK4, ar67=PK5, ar68=PK6, ar69=PK7,
analog0=PF0, analog1=PF1, analog2=PF2, analog3=PF3, analog4=PF4,
analog5=PF5, analog6=PF6, analog7=PF7, analog8=PK0, analog9=PK1,
analog10=PK2, analog11=PK3, analog12=PK4, analog13=PK5, analog14=PK6,
analog15=PK7,
# Marlin adds these additional aliases
ml70=PG4, ml71=PG3, ml72=PJ2, ml73=PJ3, ml74=PJ7,
ml75=PJ4, ml76=PJ5, ml77=PJ6, ml78=PE2, ml79=PE6,
ml80=PE7, ml81=PD4, ml82=PD5, ml83=PD6, ml84=PH2,
ml85=PH7
[printer]
kinematics: cartesian
max_velocity: 3000
max_accel: 450
max_z_velocity: 400
max_z_accel: 30
square_corner_velocity: 15.0
[bed_mesh]
speed: 100
mesh_min: 0,0
mesh_max: 267,250
probe_count: 5,5
relative_reference_index: 12
algorithm: bicubic
horizontal_move_z: 5
[gcode_macro START_PRINT]
gcode:
{% 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
# Wait for bed to reach temperature
M190 S{BED_TEMP}
# Set and wait for nozzle to reach temperature
M109 S{EXTRUDER_TEMP}
# Move the nozzle very close to the bed
G1 Z0.15 F300
[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
[gcode_macro PAUSE]
description: Pause the actual running print
rename_existing: PAUSE_BASE
# change this if you need more or less extrusion
variable_extrude: 1.0
gcode:
##### read E from pause macro #####
{% set E = printer["gcode_macro PAUSE"].extrude|float %}
##### set park positon for x and y #####
# default is your max posion from your printer.cfg
{% set x_park = printer.toolhead.axis_maximum.x|float - 5.0 %}
{% set y_park = printer.toolhead.axis_maximum.y|float - 5.0 %}
##### calculate save lift position #####
{% set max_z = printer.toolhead.axis_maximum.z|float %}
{% set act_z = printer.toolhead.position.z|float %}
{% if act_z < (max_z - 2.0) %}
{% set z_safe = 2.0 %}
{% else %}
{% set z_safe = max_z - act_z %}
{% endif %}
##### end of definitions #####
PAUSE_BASE
G91
{% if printer.extruder.can_extrude|lower == 'true' %}
G1 E-{E} F2100
{% else %}
{action_respond_info("Extruder not hot enough")}
{% endif %}
{% if "xyz" in printer.toolhead.homed_axes %}
G1 Z{z_safe} F900
G90
G1 X{x_park} Y{y_park} F6000
{% else %}
{action_respond_info("Printer not homed")}
{% endif %}
[gcode_macro RESUME]
description: Resume the actual running print
rename_existing: RESUME_BASE
gcode:
##### read E from pause macro #####
{% set E = printer["gcode_macro PAUSE"].extrude|float %}
#### get VELOCITY parameter if specified ####
{% if 'VELOCITY' in params|upper %}
{% set get_params = ('VELOCITY=' + params.VELOCITY) %}
{%else %}
{% set get_params = "" %}
{% endif %}
##### end of definitions #####
{% if printer.extruder.can_extrude|lower == 'true' %}
G91
G1 E{E} F2100
{% else %}
{action_respond_info("Extruder not hot enough")}
{% endif %}
RESUME_BASE {get_params}
[gcode_macro CANCEL_PRINT]
description: Cancel the actual running print
rename_existing: CANCEL_PRINT_BASE
gcode:
TURN_OFF_HEATERS
CANCEL_PRINT_BASE
[virtual_sdcard]
path: ~/gcode_files
[display_status]
[pause_resume]
#*# <---------------------- SAVE_CONFIG ---------------------->
#*# DO NOT EDIT THIS BLOCK OR BELOW. The contents are auto-generated.
#*#
#*# [bed_mesh default]
#*# version = 1
#*# points =
#*# -0.742500, 1.387500, 0.935000, 1.197500, -0.735000
#*# 1.075000, 0.080000, -0.040000, 0.090000, 0.740000
#*# 0.742500, 0.052500, 0.000000, -0.005000, 0.295000
#*# 0.947500, 0.355000, 0.040000, 0.035000, 0.327500
#*# 1.167500, 0.607500, 0.237500, 0.280000, 0.575000
#*# x_count = 5
#*# y_count = 5
#*# mesh_x_pps = 2
#*# mesh_y_pps = 2
#*# algo = bicubic
#*# tension = 0.2
#*# min_x = 0.0
#*# max_x = 267.0
#*# min_y = 0.0
#*# max_y = 250.0
#*#
#*# [bltouch]
#*# z_offset = 2.9
@thinkyhead
Copy link

thinkyhead commented Oct 4, 2025

Would you happen to know what the pin numbers are on the small EXP plug, and also on the wider side plug? By knowing these mappings we'll be able to generalize and permit connecting any display with a suitable adaptor to these ports. Best guess: https://github.com/MarlinFirmware/Marlin/pull/28073/files#diff-b84605ec433708e7146686b8586748e21326c4d48172f870b451c9b7a4408177R117-R131

@mdshw5
Copy link
Author

mdshw5 commented Oct 6, 2025

I've since disassembled this printer and don't have a way to verify the pin mappings, unfortunately!

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