Anycubic Mega SE
Using Klipper and Fluidd
I was receiving a warning message in Octopi concerning the shipping version of the Mega SE firmware. I contacted Anycubic directly for updated firmware. This was their response:
"MEGA SE's firmware can only remove the chip to update the firmware
Such an operation is difficult
Generally we do not let customers update firmware"
I also asked Anycubic if they could provide a schematic for the Mega SE and they didn't have one. Surely someone at Anycubic has one.
I decided to make a switch to Klipper firmware. After some internet searches and tests, I've settled on the configuration below. I'm still tweaking some settings but getting acceptable results. Make sure you compile Klipper for the ATMega1284P controller.
I printed the Klipper tower to get the pressure advance value. I also performed an extrusion calibration to set the rotation distance in the extruder section of the config file. Make sure to run the PID tuning process to get better values for your system.
If you're in the same situation I was with Mega SE firmware, I hope this helps. I'd like to hear from you if you find better settings.
my printer.cfg
# To use this config, the firmware should be compiled for the
# AVR atmega1284p.
# Anycubic Mega SE (Created 20220326)
# The PCB shows Mega Zero v0.4 on the surface
# The hotend on the tested printer was replaced with a Creality Ender 3 V2 hotend
# Note, a number of Melzi boards are shipped with a bootloader that
# requires the following command to flash the board:
# avrdude -p atmega1284p -c arduino -b 57600 -P /dev/ttyUSB0 -U out/klipper.elf.hex
# If the above command does not work and "make flash" does not work
# then one may need to flash a bootloader to the board - see the
# Klipper docs/Bootloaders.md file for more information.
# See docs/Config_Reference.md for a description of parameters.
[stepper_x]
step_pin: PD7
dir_pin: !PC5
enable_pin: !PD6
microsteps: 16
rotation_distance: 40
endstop_pin: ^PC2
position_endstop: 0
position_min: 0
position_max: 230
homing_speed: 20
[stepper_y]
step_pin: PC6
dir_pin: !PC7
enable_pin: !PD6
microsteps: 16
rotation_distance: 40
endstop_pin: ^PC3
position_endstop: 0
position_min: 0
position_max: 235
homing_speed: 20
[stepper_z]
step_pin: PB3
dir_pin: PB2
enable_pin: !PA5
microsteps: 16
rotation_distance: 8
endstop_pin: ^PC4
position_endstop: 0.0
position_max: 250
[safe_z_home]
home_xy_position: 10,10
speed: 50
z_hop: 5
z_hop_speed: 20
move_to_previous: false
[extruder]
# Extruder on the Anycubic Mega SE looks like a BMG clone
step_pin: PB1
dir_pin: PB0
enable_pin: !PD6
microsteps: 16
rotation_distance: 7.403
nozzle_diameter: 0.400
filament_diameter: 1.750
heater_pin: PD5
sensor_type: EPCOS 100K B57560G104F
sensor_pin: PA7
control: pid
min_temp: 0
max_temp: 260
# Used Klipper tuning to get Pressure Advance
pressure_advance = .380
# Tuned for 200 degrees Celsius
pid_Kp=21.488
pid_Ki=1.291
pid_Kd=89.445
## Added
max_extrude_cross_section = 150
min_extrude_temp = 180
max_extrude_only_distance: 120.0
full_steps_per_rotation: 200
[heater_bed]
heater_pin: PD4
sensor_type: EPCOS 100K B57560G104F
sensor_pin: PA6
control: pid
min_temp: 0
max_temp: 130
# tuned for 60 degrees Celsius
pid_Kp=62.181
pid_Ki=1.884
pid_Kd=512.996
[fan]
pin: PB4
[mcu]
serial: /dev/serial/by-id/usb-1a86_USB_Serial-if00-port0
[printer]
kinematics: cartesian
max_velocity: 300
max_accel: 3000
max_z_velocity: 5
max_z_accel: 100
[display]
lcd_type: st7920
cs_pin: PA3
sclk_pin: PA1
sid_pin: PC1
encoder_pins: ^PD2, ^PD3
click_pin: ^!PC0
######################################################################
# 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:
{% 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 F300
# Wait for bed to reach temperature
M190 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
######################################################################
# Beeper
######################################################################
# M300 : Play tone. Beeper support, as commonly found on usual LCD
# displays (i.e. RepRapDiscount 2004 Smart Controller, RepRapDiscount
# 12864 Full Graphic). This defines a custom I/O pin and a custom
# GCODE macro. Usage:
# M300 [P<ms>] [S<Hz>]
# P is the tone duration, S the tone frequency.
# The frequency won't be pitch perfect.
###[output_pin BEEPER_pin]
###pin: ar37
# Beeper pin. This parameter must be provided.
# ar37 is the default RAMPS/MKS pin.
###pwm: True
# A piezo beeper needs a PWM signal, a DC buzzer doesn't.
###value: 0
# Silent at power on, set to 1 if active low.
###shutdown_value: 0
# Disable at emergency shutdown (no PWM would be available anyway).
###cycle_time: 0.001
# Default PWM frequency : 0.001 = 1ms will give a tone of 1kHz
# Although not pitch perfect.
[virtual_sdcard]
path: ~/gcode_files
[gcode_macro _M300]
gcode:
# Use a default 1kHz tone if S is omitted.
{% set S = params.S|default(1000)|int %}
# Use a 10ms duration is P is omitted.
{% set P = params.P|default(100)|int %}
SET_PIN PIN=BEEPER_pin VALUE=0.5 CYCLE_TIME={ 1.0/S if S > 0 else 1 }
G4 P{P}
SET_PIN PIN=BEEPER_pin VALUE=0
######################################################################
# Filament Change
######################################################################
# M600: Filament Change. This macro will pause the printer, move the
# tool to the change position, and retract the filament 50mm. Adjust
# the retraction settings for your own extruder. After filament has
# been changed, the print can be resumed from its previous position
# with the "RESUME" gcode.
[pause_resume]
[gcode_macro M600]
gcode:
{% set X = params.X|default(50)|float %}
{% set Y = params.Y|default(0)|float %}
{% set Z = params.Z|default(10)|float %}
SAVE_GCODE_STATE NAME=M600_state
PAUSE
G91
G1 E-.8 F2700
G1 Z{Z}
G90
G1 X{X} Y{Y} F3000
G91
G1 E-50 F1000
RESTORE_GCODE_STATE NAME=M600_state
######################################################################
# BMP280/BME280/BME680 Environmental Sensor
######################################################################
# The macro below assumes you have a BME280 sensor_type defined in one
# of the applicable sections in printer.cfg, such as:
#
#[temperature_sensor my_sensor]
#sensor_type: BME280
#gcode_id: AMB
#
# Note the format of the parameter SENSOR in the macro below. The BME280
# sensor status can be accessed using the format "bme280 <section_name>".
# The example section above is named "my_sensor", thus the bme280 can be
# queried as follows:
#
# QUERY_BME280 SENSOR='bme280 my_sensor'
#
# Since a default parameter is defined one could simply enter QUERY_BME280
# as well.
[gcode_macro QUERY_BME280]
gcode:
{% set sensor = printer["bme280 my_sensor"] %}
{action_respond_info(
"Temperature: %.2f C\n"
"Pressure: %.2f hPa\n"
"Humidity: %.2f%%" % (
sensor.temperature,
sensor.pressure,
sensor.humidity))}
######################################################################
# HTU21D family Environmental Sensor
######################################################################
# The macro below assumes you have a HTU21D sensor_type defined in one
# of the applicable sections in printer.cfg, such as:
#
#[temperature_sensor my_sensor]
#sensor_type: HTU21D
#
# Note the format of the parameter SENSOR in the macro below. The HTU21D
# sensor status can be accessed using the format "htu21d <section_name>".
# The example section above is named "my_sensor", thus the htu21d can be
# queried as follows:
#
# QUERY_HTU21D SENSOR='htu21d my_sensor'
#
# Since a default parameter is defined one could simply enter QUERY_HTU21D
# as well.
[gcode_macro QUERY_HTU21D]
gcode:
{% set sensor = printer["htu21d my_sensor"] %}
{action_respond_info(
"Temperature: %.2f C\n"
"Humidity: %.2f%%" % (
sensor.temperature,
sensor.humidity))}
# SDCard 'looping' (aka Marlin M808 commands) support
#
# Support SDCard looping
[sdcard_loop]
# 'Marlin' style M808 compatibility macro for SDCard looping
[gcode_macro M808]
gcode:
{% if params.K is not defined and params.L is defined %}SDCARD_LOOP_BEGIN COUNT={params.L|int}{% endif %}
{% if params.K is not defined and params.L is not defined %}SDCARD_LOOP_END{% endif %}
{% if params.K is defined and params.L is not defined %}SDCARD_LOOP_DESIST{% endif %}
[gcode_macro m205]
gcode:
G4
[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
[display_status]
######################################################################
# 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_PREHEAT]
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}
M109 S{EXTRUDER_TEMP}
[gcode_macro END_PREHEAT]
gcode:
# Turn off bed, extruder, and fan
TURN_OFF_HEATERS