Artillery Hornet + OctoPrint + Klipper

 Artillery Hornet + OctoPrint + Klipper

1.ติดตั้ง OctoPrint บน Raspberry Pi

1.1 Download OctoPi Image จาก https://octoprint.org/download/

1.2 ติดตั้ง Raspberry Pi Imager เพื่อใช้ flash image จากข้อ 1.1 ลง sd card สามารถตั้งค่า wifi ได้ตั้งแต่ตอนนี้เลย

1.3 เสียบ sd card เข้า Raspberry Pi แล้วเปิดเครื่อง รอสักครู่แล้วเปิด Web Browser เข้า http://octopi.local


2.ติดตั้ง Klipper

2.1 ssh เข้าไปที่ Raspberry Pi

2.2 ติดตั้ง Klipper

git clone https://github.com/Klipper3d/klipper ./klipper/scripts/install-octopi.sh

2.3 Complie Klipper Firmware

cd ~/klipper/ make menuconfig

เลือก Architecture เป็น STM32, Model เป็น STM32F401, No bootloader, Interface ใช้ USB (on PA11/PA12)

เสร็จแล้วสั่ง
make

2.4 Flash Klipper firmware ลง Printer

1) เปลี่ยน printer ให้รอรับการ flash ด้วยการส่ง command M997 ผ่าน OctoPrint

2) หา id ของ printer ด้วยคำสั่ง lsusb แล้วดู id ของ STMicroelectronics STM Device in DFU Mode

3) สั่ง flash ไปที่ id นั้น เช่น

make flash FLASH_DEVICE=0483:df11


3.Config Printer โดยสร้าง file printer.cfg ไว้ที่ home (ที่มา : https://github.com/EmmeFreeze/Artillery-Hornet-Mods/blob/main/Firmwares/Klipper/hornet.cfg)

# Artillery Hornet Klipper Config by EmmeFreeze

# Based on kiPHAW's config (https://www.youtube.com/watch?v=kokwZI83wzI)

# Thanks to: gpo 123 (display pinout)


####### FIRMWARE COMPILE OPTIONS ########


# Enable extra low-level configuration options: TRUE

# Micro-controller Architecture: STMicroelectronics STM32

# Processor model: STM32F401

# Bootloader offset: No bootloader

# Clock reference: 8 MHz crystal

# Communication interface: USB (on PA11/PA12)

# USB ids: DEFAULT

# GPIO pins to set at micro-controller startup: FALSE



[stepper_x]

step_pin: PB14

dir_pin: PB13

enable_pin: !PB15

microsteps: 16

rotation_distance: 40

endstop_pin: !PA2

position_endstop: 220

position_max: 220

homing_speed: 50


[stepper_y]

step_pin: PB10

dir_pin: PB2

enable_pin: !PB12

microsteps: 16

rotation_distance: 40

endstop_pin: !PA1

position_endstop: 0

position_max: 235

homing_speed: 50


[stepper_z]

step_pin: PB0

dir_pin: PC5

enable_pin: !PB1

microsteps: 16

rotation_distance: 8

endstop_pin: !PA0

position_endstop: 0.0

position_max: 250


[extruder]

max_extrude_only_distance: 100.0

max_extrude_cross_section: 50.0

step_pin: PA7

dir_pin: !PA6

enable_pin: !PC4

microsteps: 16

rotation_distance: 7.362

nozzle_diameter: 0.400

filament_diameter: 1.750

heater_pin: PC9

sensor_type: EPCOS 100K B57560G104F

sensor_pin: PC0

#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

min_extrude_temp: 185

pressure_advance = 0.25

pressure_advance_smooth_time: 0.040


[input_shaper]

shaper_freq_x: 34.483

shaper_freq_y: 55.556

shaper_type: mzv


[heater_bed]

heater_pin: PA8

sensor_type: EPCOS 100K B57560G104F

sensor_pin: PC1

#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


[bed_screws]

screw1: 40, 40

screw2: 180, 40

screw3: 180, 180

screw4: 40, 180

screw5: 110, 110

speed: 50


[fan]

pin: PC6

pin: PC8

kick_start_time: 0.500



[heater_fan hotend_fan]

pin: PC7

heater: extruder

heater_temp: 50.0

fan_speed: 1.0


[controller_fan stepper_fan]

pin: PC6

idle_timeout: 300

kick_start_time: 0.500



[mcu]

serial: /dev/serial/by-id/usb-Klipper_stm32f401xc_2E006C001551383434353631-if00

restart_method: command


[printer]

kinematics: cartesian

max_velocity: 200

max_accel: 1500

max_z_velocity: 20

max_z_accel: 100

square_corner_velocity: 5 



[virtual_sdcard]

path: ~/gcode_files


[display_status]


[display]

lcd_type: uc1701

cs_pin: PB6

a0_pin: PC15

rst_pin: PB5

contrast: 60

spi_bus:spi3a

encoder_pins: ^PB3,^PB4

click_pin: ^!PC14


[pause_resume]


[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

  

# ================================================================================

# GCode Macro: START_PRINT

# Aggiungi START_PRINT nello script di avvio dello Slicer. 

# ================================================================================

[gcode_macro START_PRINT]

gcode:

    {% set BED_TEMP = params.BED_TEMP|default(60)|float %}

    {% set EXTRUDER_TEMP = params.EXTRUDER_TEMP|default(200)|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

    #G1 Z5.0 F3000 ; Muove l'asse Z un po' in alto per evitare di graffiare il Bed

    # Wait for bed to reach temperature

    M190 S{BED_TEMP}

    # Set and wait for nozzle to reach temperature

    M109 S{EXTRUDER_TEMP}

    G92 E0 ; Reset dell'estrusore

    G1 Z5.0 F3000 ; Muove l'asse Z un po' in alto per evitare di graffiare il Bed

    G1 X7.1 Y40 Z0.3 F5000.0 ; Spostamento alla posizione iniziale

    G1 X7.1 Y215.0 Z0.3 F1500.0 E15 ; Disegna la prima linea

    G1 X7.4 Y215.0 Z0.3 F5000.0 ; Spostamento laterale

    G1 X7.4 Y40 Z0.3 F1500.0 E30 ; Disegna la seconda linea

    G92 E0 ; Reset dell'estrusore

    G1 Z50.0 F3000 ; Muove l'asse Z un po' in alto per evitare di graffiare il Bed


# ================================================================================

# GCode Macro: END_PRINT

# Aggiungi END_PRINT nello script di fine dello Slicer. 

# ================================================================================

[gcode_macro END_PRINT]

gcode:

    G91 ; Posizionamento relativo

    G1 Z+10 ; Muove Z in alto per non colpire nulla

    G90 ; Posizionamento assoluto

    G1 Y190 F1500; Sposta Y davanti

    G10 ; Imposta l'offset?  O ritrae?

    G91 ; Posizionamento relativo

    #G1 Z+10 ; Muove Z in alto per non colpire nulla

    G1 E-10 F300 ; Ritrae -10

    G90 ; Posizionamento assoluto

    G1 X10 Y220 F2000 ; Muove X10, Y220

    M104 S0 ; Spegne l'estrusore (lo imposta a 0)

    M140 S0 ; Spegne il Bed (lo imposta a 0)

    M106 S0 ; Spegne le ventole di raffreddamento

    M84 ; Disabilita gli stepper motors


[gcode_macro BED_ADJUST]

gcode:

    G28

    BED_SCREWS_ADJUST


#*# <---------------------- SAVE_CONFIG ---------------------->

#*# DO NOT EDIT THIS BLOCK OR BELOW. The contents are auto-generated.

#*#

#*# [extruder]

#*# control = pid

#*# pid_kp = 21.101

#*# pid_ki = 1.074

#*# pid_kd = 103.659

#*#

#*# [heater_bed]

#*# control = pid

#*# pid_kp = 59.235

#*# pid_ki = 1.193

#*# pid_kd = 735.252

4.ติดตั้ง plugin ชื่อ OctoKlipper

5.ตั้งค่า OctoPrint ตรง Serial Connection เป็น Cancel any ongoing prints but stay connected to the printer แล้ว restart




Comments

Popular posts from this blog

ย้ายบ้าน

ใต้ร่มกาสาวพัตร

Google Gears