Marlin 1.1.9 on TronXY X5S (“Melzi” style board)

There really are enough tutorials out there on how to get the bootloader into that board (not neccessary for me as mine already had it), avoiding the snares of Sanguino yourself or even complete Arduino IDEs, ready to be masticated via Google Drives. Besides that, I already dropped some links on that baud rate / boards.txt topic and the OctoPi Firmware Uploader myself (as Junk electronics, new electronics). So here  I’ll just list up a few changes to get a “clean Marlin” working on a TronXY X5S Melzi (8bit) Board.

TL;DNR:
On Marlin 1.1.9 ou want to configure…
#define MOTHERBOARD BOARD_MELZI_TRONXY
#define LCD_FOR_MELZI
#define REVERSE_ENCODER_DIRECTION
…besides the obvious stuff like
#define COREXY / SDSUPPORT / …STEPS_PER_UNIT…
and so on.

YouMagine-Link to the header files and binaries at the bottom.

TronXY Melzi

In detail:

The reason for me to post this is, again*, Cunningham’s Law: “The best way to get the right answer on the internet is not to ask a question; it’s to post the wrong answer.” (Meta-Wiki).

The “wrong answer of the week” for me was, after re-building my X5S to a direct/non-bowden “Btech” (Bondtech drivegear clone) configuraion, just flashing the newest Marlin from Thingiverse. And then not being able to print circles at speed. Unlike the first version I sumbled upon, this time the uploader had  tossed in some work-in-progress with a completely messed-up configuration. (Timings, buffer sizes, …)

After verifying, that my old version of Marlin 1.1.8 was working like charm and the version of 1.1.9 I downloaded was indeed the cause of error (after all I just had changed some critical hardware) I set out to start from a clean copy. From https://github.com/MarlinFirmware/Marlin. (With lots of dust caps for my SchuKo socket outlets in the drawer, as these were my “curve test prints”. 😉 )

There are even more tutorials on customizing Marlin out there, than on any X5S specific topic, so if you have questions: Ask Thomas Sanladerer and the others out there about the way to do it.

As I now had to use WinMerge (like Airtripper suggested here) to compare entire folders, and I didn’t like digging through the 309 files of Marlin 1.1.9, I tried to stick to just changing “Configuration.h” and “Configuration_adv.h” this time. Which works – and if you only want to compare two files at once, you can get along with ExamDiff (which doens’t even need to be installed). Much more comfortable.

So what are the lines to alter or comment to get “the final release of the 8-bit flat version of Marlin Firmware” working on an X5S? The “Configuring Marlin 1.1” chapter of marlinfw.org is pretty good, but here is the “short” summary of what I did:

Configuration.h

Hardware / Kinematics / mechanical configuration – basics

Look! TronXY now have their own “pins_MELZI_TRONXY.h” file. (So that’s the reason there are over 300 files in that folder…)

 #define MOTHERBOARD BOARD_MELZI_TRONXY

The Sanguino / Melzi usually runs at 115200 baud (not 250000).

#define BAUDRATE 115200

Just in case somebody actives “volumetric extrusion”:

#define DEFAULT_NOMINAL_FILAMENT_DIA 1.75

This should be already a “1”. (I have a “5” for my E3Dv5, look at your Hot End documentation, if you also changed yours)…

 #define TEMP_SENSOR_0 1 // TronXY Mk8 Hotend

Stardard is “no heated bed”. But we have one:

#define TEMP_SENSOR_BED 1

Obviously, we need this…

#define COREXY

These endstops work the other way round.

#define X_MIN_ENDSTOP_INVERTING true // set to true to invert the logic of the endstop.
#define Y_MIN_ENDSTOP_INVERTING true // set to true to invert the logic of the endstop.
#define Z_MIN_ENDSTOP_INVERTING true // set to true to invert the logic of the endstop.

A4988 is default, but I guss we can also clearly state this:

#define X_DRIVER_TYPE  A4988
#define Y_DRIVER_TYPE  A4988
#define Z_DRIVER_TYPE  A4988
//#define X2_DRIVER_TYPE A4988
//#define Y2_DRIVER_TYPE A4988
//#define Z2_DRIVER_TYPE A4988
#define E0_DRIVER_TYPE A4988

If you don’t want to invert the connector (or re-arrange it’s crimped contacts):

#define INVERT_X_DIR true

Just being careful here…

#define Z_HOMING_HEIGHT 20 // 4 

Even with OctoPrint you might still prefer the reliability of SD cards – or use them as backup, if the Pi has messed up it’s OS again:

#define SDSUPPORT

To get the encoder and display working the way I wanted them I had to try our a few things (no, it is neither the “REPRAP_DISCOUNT_FULL_GRAPHIC_SMART_CONTROLLER” nor the “ANET_FULL_GRAPHICS_LCD”!)

#define ENCODER_PULSES_PER_STEP 2
#define ENCODER_STEPS_PER_MENU_ITEM 3
#define REVERSE_ENCODER_DIRECTION
#define LCD_FOR_MELZI

Parameters to tune / match to your specimen

This is mostly geometry. Your Extruder should be tuned, though:

#define DEFAULT_AXIS_STEPS_PER_UNIT    { 80, 80, 400, 90 } // Stock TronXY Extruder

Slight alterations here:

#define DEFAULT_MAX_FEEDRATE          { 250, 250, 25, 70 } // { 300, 300, 5, 25 } 

Stole the X- and Y-values from Prusa. 😉

#define DEFAULT_MAX_ACCELERATION    { 1250, 1250, 100, 3000 } 

These values are less important, because they could be overwritten by the slicer.

##define DEFAULT_ACCELERATION          1250 // 3000    // X, Y, Z and E acceleration for printing moves
#define DEFAULT_RETRACT_ACCELERATION  3000    // E acceleration for retracts
#define DEFAULT_TRAVEL_ACCELERATION   1250 // 3000    // X, Y, Z acceleration for travel (non printing) moves

Still playing with these – more “jerk” means less acceleration and deceleration.

#define DEFAULT_XJERK                 15.0 // 10.0
#define DEFAULT_YJERK                 15.0 // 10.0
#define DEFAULT_ZJERK                  0.4 // 0.3
#define DEFAULT_EJERK 

At line 380 (in the original file) add your own Autotuning values!

Use e.g. “M303 E0 S220 C8” (http://marlinfw.org/docs/gcode/M303.html), while everything is in printing state (heaters on, fans on etc.)

Change this to get your prints starting earlier:

// Extruder temperature must be close to target for this long before M109 returns success
#define TEMP_RESIDENCY_TIME 5 // 10  // (seconds)
#define TEMP_HYSTERESIS 3       // (degC) range of +/- temperatures considered "close" to the target one
#define TEMP_WINDOW     3 // 1       // (degC) Window around target to start the residency timer x degC early.

// Bed temperature must be close to target for this long before M190 returns success
#define TEMP_BED_RESIDENCY_TIME 20 // 10  // (seconds)
#define TEMP_BED_HYSTERESIS 5 // 3       // (degC) range of +/- temperatures considered "close" to the target one
#define TEMP_BED_WINDOW     1       // (degC) Window around target to start the residency timer x degC early.

I prefer these temperatures for “Preheating” via menu:

// Preheat Constants
#define PREHEAT_1_TEMP_HOTEND 180
#define PREHEAT_1_TEMP_BED     60
#define PREHEAT_1_FAN_SPEED     0 // Value from 0 to 255
#define PREHEAT_2_TEMP_HOTEND 210
#define PREHEAT_2_TEMP_BED     80
#define PREHEAT_2_FAN_SPEED     0 // Value from 0 to 255

This was manually establshed for my specific modifications:

// The size of the print bed
#define X_BED_SIZE 330
#define Y_BED_SIZE 320
// Travel limits (mm) after homing, corresponding to endstop positions.
#define X_MIN_POS -5.0 // 0
#define Y_MIN_POS -0.5 // 0
#define Z_MIN_POS 0
#define X_MAX_POS X_BED_SIZE
#define Y_MAX_POS Y_BED_SIZE
#define Z_MAX_POS 410

I can live without those – at least until alls those mins and maxes are really set up properly (which they aren’t):

//#define MIN_SOFTWARE_ENDSTOPS
//#define MAX_SOFTWARE_ENDSTOPS

We can speed up a bit here:

// Homing speeds (mm/m)
#define HOMING_FEEDRATE_XY (70*60) // (50*60)
#define HOMING_FEEDRATE_Z  (10*60) // (4*60)

Drop your name as “author” – or not.

#define STRING_CONFIG_H_AUTHOR "burningbecks"//"(none, default config)" // Who made the changes.

You only see that after a cold start or reset, but while we are at it…

#define CUSTOM_MACHINE_NAME "BeX5S"

Stuff I wanted active – or not:

To save memory I decided to go without EEPROM (and re-flash every alteration):

//#define EEPROM_CHITCHAT   // Give feedback on EEPROM commands. Disable to save PROGMEM.

Manual, assisted bed levelling via LCD menu (untested on 1.1.9 – copy & paste from 1.1.8):

//#define Z_MIN_PROBE_USES_Z_MIN_ENDSTOP_PIN
#define PROBE_MANUALLY
#define MESH_BED_LEVELING
 #define LEFT_PROBE_BED_POSITION 15
#define RIGHT_PROBE_BED_POSITION 170
#define FRONT_PROBE_BED_POSITION 20
#define BACK_PROBE_BED_POSITION 170
  #define MESH_INSET 35 // 1 

To activate the “filament change” feature in the menu I added this “else” part…

#if ENABLED(FILAMENT_RUNOUT_SENSOR)
  #define NUM_RUNOUT_SENSORS   1     // Number of sensors, up to one per extruder. Define a FIL_RUNOUT#_PIN for each.
  #define FIL_RUNOUT_INVERTING false // set to true to invert the logic of the sensor.
  #define FIL_RUNOUT_PULLUP          // Use internal pullup for filament runout pins.
  #define FILAMENT_RUNOUT_SCRIPT "M600"
#else
  #define FILAMENT_RUNOUT_SCRIPT "M600"
#endif

…and I think we need that:

#define NOZZLE_PARK_FEATURE
#if ENABLED(NOZZLE_PARK_FEATURE)
  // Specify a park position as { X, Y, Z }
  #define NOZZLE_PARK_POINT { (X_MIN_POS + 10), (Y_MIN_POS + 10), 20 } // { (X_MIN_POS + 10), (Y_MAX_POS - 10), 20 }
  #define NOZZLE_PARK_XY_FEEDRATE 100   // X and Y axes feedrate in mm/s (also used for delta printers Z axis)
  #define NOZZLE_PARK_Z_FEEDRATE 10 // 5      // Z axis feedrate in mm/s (not used for delta printers)
#endif

Yay! One file down – one to go:

Configuration_adv.h

Alter “Thermal Protection” setting (lines 61…109 in the original file) at your own peril. Avoid your specific annoyances (e.g. when heating a granite tile just takes long), but keep values sharp enough to not lever out the protection. (When in doubt, watch Thomas Sanladerer’s video first.)

It is a good idea to have the fan start at full power, before the PWM kicks in:

#define FAN_KICKSTART_TIME 200 // 100

My 5015 blower, now mounted at 45°, can still be used with PWM at 20 (of 255, which is 7.8%) – without the kickstart (or other fans) you might have to enter more.

#define FAN_MIN_PWM 20

Might be useful, if you use SD cards:

#define SCROLL_LONG_FILENAMES

If you activated the “M600” command, for filament change via menu or filament runout sensor, you will have to configure the “Advanced Pause” section to your setup. For me (feeder directly above the nozzle) it looks like this:

#define ADVANCED_PAUSE_FEATURE
#if ENABLED(ADVANCED_PAUSE_FEATURE)
  #define PAUSE_PARK_RETRACT_FEEDRATE         60  // (mm/s) Initial retract feedrate.
  #define PAUSE_PARK_RETRACT_LENGTH            2  // (mm) Initial retract.
                                                  // This short retract is done immediately, before parking the nozzle.
  #define FILAMENT_CHANGE_UNLOAD_FEEDRATE    100  // 10  // (mm/s) Unload filament feedrate. This can be pretty fast.
  #define FILAMENT_CHANGE_UNLOAD_ACCEL        25  // (mm/s^2) Lower acceleration may allow a faster feedrate.
  #define FILAMENT_CHANGE_UNLOAD_LENGTH      100  // (mm) The length of filament for a complete unload.
                                                  //   For Bowden, the full length of the tube and nozzle.
                                                  //   For direct drive, the full length of the nozzle.
                                                  //   Set to 0 for manual unloading.
  #define FILAMENT_CHANGE_SLOW_LOAD_FEEDRATE   6  // (mm/s) Slow move when starting load.
  #define FILAMENT_CHANGE_SLOW_LOAD_LENGTH     10 // 0  // (mm) Slow length, to allow time to insert material.
                                                  // 0 to disable start loading and skip to fast load only
  #define FILAMENT_CHANGE_FAST_LOAD_FEEDRATE   6  // (mm/s) Load filament feedrate. This can be pretty fast.
  #define FILAMENT_CHANGE_FAST_LOAD_ACCEL     25  // (mm/s^2) Lower acceleration may allow a faster feedrate.
  #define FILAMENT_CHANGE_FAST_LOAD_LENGTH    60  // 0  // (mm) Load length of filament, from extruder gear to nozzle.
                                                  //   For Bowden, the full length of the tube and nozzle.
                                                  //   For direct drive, the full length of the nozzle.
  //#define ADVANCED_PAUSE_CONTINUOUS_PURGE       // Purge continuously up to the purge length until interrupted.
  #define ADVANCED_PAUSE_PURGE_FEEDRATE        3  // (mm/s) Extrude feedrate (after loading). Should be slower than load feedrate.
  #define ADVANCED_PAUSE_PURGE_LENGTH         50  // (mm) Length to extrude after loading.
                                                  //   Set to 0 for manual extrusion.
                                                  //   Filament can be extruded repeatedly from the Filament Change menu
                                                  //   until extrusion is consistent, and to purge old filament.
// Filament Unload does a Retract, Delay, and Purge first:
#define FILAMENT_UNLOAD_RETRACT_LENGTH      13  // (mm) Unload initial retract length.

#define FILAMENT_UNLOAD_DELAY 5000 // (ms) Delay for the filament to cool after retract.
#define FILAMENT_UNLOAD_PURGE_LENGTH 8 // (mm) An unretract is done, then this length is purged.

#define PAUSE_PARK_NOZZLE_TIMEOUT 45 // (seconds) Time limit before the nozzle is turned off for safety.
#define FILAMENT_CHANGE_ALERT_BEEPS 10 // Number of alert beeps to play when a response is needed.
#define PAUSE_PARK_NO_STEPPER_TIMEOUT // Enable for XYZ steppers to stay powered on during filament change.

//#define PARK_HEAD_ON_PAUSE // Park the nozzle during pause and filament change.
//#define HOME_BEFORE_FILAMENT_CHANGE // Ensure homing has been completed prior to parking for filament change

//#define FILAMENT_LOAD_UNLOAD_GCODES // Add M701/M702 Load/Unload G-codes, plus Load/Unload in the LCD Prepare menu.
//#define FILAMENT_UNLOAD_ALL_EXTRUDERS // Allow M702 to unload all extruders above a minimum target temp (as set by M302)
#endif

Not sure, whether this makes sense – but it didn’t hurt, as far as I have tried…

#define ACTION_ON_PAUSE "pause"
#define ACTION_ON_RESUME "resume"

Conclusion

Why are some of my comments indefinite? Because yesterday my OctoPrint-FirmwareUpdater reported an upload error. So I may have to re-flash the bootloader via AVR ISP. And as everything works good enough for me right now that may be something to do in a year or so, when nobody can use this comments anymore. 😉

Edit: For those who want to start from what I already modified, I added the relevant files of my last upload to the board to YouMagine. (Be aware of “The Prusaic Extruder” and my other modifications!)
https://www.youmagine.com/designs/marlin-1-1-9-for-tronxy-x5s

Also note that the Bootloader seems to fail at > 97% memory usage, so better have that In-System-Programmer or Arduino-as-ISP lying around when using Marlin 1.1.9!


* The X5S Upgrade List & intermediate conclusion also was (partly) driven by some other info on the WWW.

One thought on “Marlin 1.1.9 on TronXY X5S (“Melzi” style board)

  1. Also the latest Arduino IDE 1.8.10 when used to compile this for the TronXY X5S, made the LCD garbled. Going back to Arduino IDE 1.6.7 everything worked perfectly.

    Like

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Google photo

You are commenting using your Google account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s

This site uses Akismet to reduce spam. Learn how your comment data is processed.