[GUIDE] Marlin Nozzle Park, Advanced Pause and Filament Change

Adding Go Faster Stripes to your 3D Printer
Post Reply
Mystikal
Posts: 4
Joined: Mon Feb 05, 2018 1:02 am

[GUIDE] Marlin Nozzle Park, Advanced Pause and Filament Change

Post: # 373Post Mystikal
Thu Feb 08, 2018 2:03 pm

Marlin Nozzle Park, Advanced Pause and Filament Change
1. Introduction
Hi guys! As every guy with a 3d printer and at least 2 rolls of filament, I've tried to print multi color stuff doing a filament swap during the print.

One of the first thing I've noticed is that Marlin have a special command to do this, the M600 command. This feature comes packed with a set of feature that can make your life a little bit easier in 3D printing when it comes to pause a print. With this guide, we'll try to discover them and know how they work

1.1 Usefull links 2. Prerequiste
We'll obviously need Marlin as a firmware. I'm pretty sure that other firmware can do similiar things, but I've used it since I have a 3D printer and I can't really tell anything about any other firmware.

We'll also need to know what is the distance between our E-motor and the nozzle. In direct drive, you can do it using a simple ruler or a caliper. In a bowden setup, I just prefer to mark my filament at the E-motor (I use my filament duster as a reference), heat up the nozzle, pull the filament out and measure the distance between the mark and the end of the filament, then subtract the distance between our mark and the motor.

Image
Image

Furthermore, if you have an Anet A8 like me, you also need to check that the screws in the front brace that hold the Y smooth rods in place are mounted with the nut facing "outside", like in this picture.
Image

Otherwise your bed carriage will be stopped by those screw when it will come to the front of the machine, losing steps and may even damage your machine.

Now we're ready to set up our firmware!

3. Marlin Pre-Configuration

Let's open our favourite editor and, in Configuration.h search (CTRL+F usually) the word PREVENT_LENGTHY_EXTRUDE

We should find 2 row (around line 426) that looks like these:

Code: Select all

// This option prevents a single extrusion longer than EXTRUDE_MAXLENGTH.
// Note that for Bowden Extruders a too-small value here may prevent loading.
#define PREVENT_LENGTHY_EXTRUDE
#define EXTRUDE_MAXLENGTH 200
Marlin tries to prevent lenghty extrude in case of a Gcode error, but we need to set up this value to still allow us a filament swap. The EXTRUDE_MAXLENGTH is the max amount (in mm) of extrude (or retract) that the firmware will allows. By default is 200 mm (20 cm). We just need to set it to the distance between the e-motor and the nozzle we measured before. In my case, this distance was around 690mm so I just set this value to 700

4. Nozzle Park
Search (CTRL+F again) for the word NOZZLE_PARK_FEATURE. We'll find a code (around line 1169) like this

Code: Select all

/**
 * Nozzle Park
 *
 * Park the nozzle at the given XYZ position on idle or G27.
 *
 * The "P" parameter controls the action applied to the Z axis:
 *
 *    P0  (Default) If Z is below park Z raise the nozzle.
 *    P1  Raise the nozzle always to Z-park height.
 *    P2  Raise the nozzle by Z-park amount, limited to Z_MAX_POS.
 */
//#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_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 5      // Z axis feedrate in mm/s (not used for delta printers)
#endif
This feature allow us to "park" the nozzle and the bed for whatever reason we want (usually, for a pause or for the ending of a print).

To enable this feature we need to remove the // before #define NOZZLE_PARK_FEATURE

After that, we can edit this line

Code: Select all

#define NOZZLE_PARK_POINT { (X_MIN_POS + 10), (Y_MAX_POS - 10), 20 }
To tell the firmware the X (carriage), Y (bed) and Z (height of nozzle) we want when parked. By default, the firmware will position the carriage on the right, the bed on the front and the Z at 20 (more on this later). I like the default position, so I didn't change it.

The next 2 line are the feedrate (speed) for XY and Z. They're fine for me.

Now, we can use the G27 command to park our print. This command have 1 parameter P with 3 different value, and it refer to the Z position:

Code: Select all

G27 P0 ; [or simply G27]  If current Z-pos is lower than Z-park then the nozzle will be raised to reach Z-park height
G27 P1 ; No matter the current Z-pos, the nozzle will be raised/lowered to reach Z-park height. Be carefull, it can easily ram on your print
G27 P2 ; The nozzle height will be raised by Z-park amount but never going over the machine’s limit of Z_MAX_POS
I always use G27 P2 for safety reason. You can save the file, flash the firmware and try it If you want. If you'd like to park your print at the end, you can add this command to your ending script in your slicer. My ending gcode, for example, looks like this

Code: Select all

G91 ;relative positioning
M117 Presenting the print...
G10 ; Firmware retract
G27 P2 ; Park the nozzle

M117 Shut down everything...
M104 S0 ;turn off heater
M140 S0 ;turn off bed
M106 S0 ;turn off fan

M84 ;disable motors
M117 Print done!
5. Advanced Pause and Filament change
Now, we can improve our parking a lot more using the Advanced Pause and Filament change feature. These features (actually, it's a single feature) needs an LCD and the NOZZLE_PARK_FEATURE enabled.

Let's just open our Configuration_adv.h and search (CTRL+F once more) for the word ADVANCED_PAUSE_FEATURE. We should be around line 869 and this is the code we need to look for:

Code: Select all

/**
 * Advanced Pause
 * Experimental feature for filament change support and for parking the nozzle when paused.
 * Adds the GCode M600 for initiating filament change.
 * If PARK_HEAD_ON_PAUSE enabled, adds the GCode M125 to pause printing and park the nozzle.
 *
 * Requires an LCD display.
 * Requires NOZZLE_PARK_FEATURE.
 * This feature is required for the default FILAMENT_RUNOUT_SCRIPT.
 */
//#define ADVANCED_PAUSE_FEATURE
#if ENABLED(ADVANCED_PAUSE_FEATURE)
  #define PAUSE_PARK_RETRACT_FEEDRATE 60      // Initial retract feedrate in mm/s
  #define PAUSE_PARK_RETRACT_LENGTH 2         // Initial retract in mm
                                              // It is a short retract used immediately after print interrupt before move to filament exchange position
  #define FILAMENT_CHANGE_UNLOAD_FEEDRATE 10  // Unload filament feedrate in mm/s - filament unloading can be fast
  #define FILAMENT_CHANGE_UNLOAD_LENGTH 100   // Unload filament length from hotend in mm
                                              // Longer length for bowden printers to unload filament from whole bowden tube,
                                              // shorter length for printers without bowden to unload filament from extruder only,
                                              // 0 to disable unloading for manual unloading
  #define FILAMENT_CHANGE_LOAD_FEEDRATE 6     // Load filament feedrate in mm/s - filament loading into the bowden tube can be fast
  #define FILAMENT_CHANGE_LOAD_LENGTH 0       // Load filament length over hotend in mm
                                              // Longer length for bowden printers to fast load filament into whole bowden tube over the hotend,
                                              // Short or zero length for printers without bowden where loading is not used
  #define ADVANCED_PAUSE_EXTRUDE_FEEDRATE 3   // Extrude filament feedrate in mm/s - must be slower than load feedrate
  #define ADVANCED_PAUSE_EXTRUDE_LENGTH 50    // Extrude filament length in mm after filament is loaded over the hotend,
                                              // 0 to disable for manual extrusion
                                              // Filament can be extruded repeatedly from the filament exchange menu to fill the hotend,
                                              // or until outcoming filament color is not clear for filament color change
  #define PAUSE_PARK_NOZZLE_TIMEOUT 45        // Turn off nozzle if user doesn't change filament within this time limit in seconds
  #define FILAMENT_CHANGE_NUMBER_OF_ALERT_BEEPS 5 // Number of alert beeps before printer goes quiet
  #define PAUSE_PARK_NO_STEPPER_TIMEOUT       // Enable to have stepper motors hold position during filament change
                                              // even if it takes longer than DEFAULT_STEPPER_DEACTIVE_TIME.
  //#define PARK_HEAD_ON_PAUSE                // Go to filament change position on pause, return to print position on resume
  //#define HOME_BEFORE_FILAMENT_CHANGE       // Ensure homing has been completed prior to parking for filament change
#endif
The Advanced Pause will improve our pause and will add support for the M600 command: filament change. With this g-code, our machine will pull out the filament and wait for a press of a button to reload the filament (it will load it fast in the bowden tube, then slow).

As always, enable this feature by removing the // before #define ADVANCED_PAUSE_FEATURE. Most line are self explanatory, but let's see check them one by one:
  • #define PAUSE_PARK_RETRACT_FEEDRATE 60: When parking a print, an automatic retraction will be done. We can set the speed here. This value is in mm/s, NOT MM/MIN. You can put your standard retract speed for now.
  • #define PAUSE_PARK_RETRACT_LENGHT 2: Read above, this will set the lenght of retraction. You can put your standard retract lenght for now.
  • #define FILAMENT_CHANGE_UNLOAD_FEEDRATE 10: When prompted with a Filament Change command. The printer will pull out the filament. Here we can set the speed in mm/s, not MM/MIN. You can leave it at 10 for now.
  • #define FILAMENT_CHANGE_UNLOAD_LENGTH 100: Read above, this will set the lenght of the filament that will be pulled out. More on this later.
  • #define FILAMENT_CHANGE_LOAD_FEEDRATE 6: After a filament swap, this will be the speed of the loading of the filament in the bowden tube. You can leave it at 6 for now
  • #define FILAMENT_CHANGE_LOAD_LENGTH 0: As above, but this is the lenght of filament that need to be loaded fast. More on this later.
  • #define ADVANCED_PAUSE_EXTRUDE_FEEDRATE 3: After loading the filament or even a simply pause for the print, we will extrude some filament to prime the nozzle and eventually clean it from the previous filament. This will be the feedrate (in mm/s). It needs to be lower than FILAMENT_CHANGE_LOAD_FEEDRATE. You can leave it at 3
  • #define ADVANCED_PAUSE_EXTRUDE_LENGTH 50: As above, but this is the lenght of filament that will be extruded. More on this later.
  • #define PAUSE_PARK_NOZZLE_TIMEOUT 45: After this timeout (in second), the firmware will shut down the nozzle to save power and for safety reason
  • #define FILAMENT_CHANGE_NUMBER_OF_ALERT_BEEPS 5: If you have a speaker/buzzer, this is the number of alert sound for a filament change
  • #define PAUSE_PARK_NO_STEPPER_TIMEOUT: Normally, when left idle for some time (120 sec by default) Marlin will disable the stepper motor. This line will prevent it if the machine is in a Filament Swap state due to the fact that, if you move by mistake the bed or the carriage (especially easy with direct drive), the print will have be shifted. YOU SHOULD LEAVE THIS AS IT IS
  • //#define PARK_HEAD_ON_PAUSE: If you enable this, the machine will use the park position for the simple pause too. I suggest to enable this line by removing the //
  • //#define HOME_BEFORE_FILAMENT_CHANGE: When prompted with a M600 command, the machine will home itself if it's not homed yet. I suggest to enable this line by removing the //
6. Lenght for filament change
Now, we know how much length we have between the nozzle and the motor, we need to set up FILAMENT_CHANGE_UNLOAD_LENGTH, FILAMENT_CHANGE_LOAD_LENGTH and ADVANCED_PAUSE_EXTRUDE_LENGTH based on our measurement.

First we need to set our FILAMENT_CHANGE_UNLOAD_LENGTH. Personally, I don't want to unload all my filament from the extruder. To prevent tangling, I want to set it in a way that our extruder will pull out the filament, but still keep it between the gear to not make it loose. So I suggest to set FILAMENT_CHANGE_UNLOAD_LENGTH equalt to your distance between our nozzle and motor minus 15 mm.

Next, we need to set FILAMENT_CHANGE_LOAD_LENGTH. We don't want to push too much filament at an high feedrate through our nozzle, so I suggest to set this value equal to FILAMENT_CHANGE_UNLOAD_LENGTH - 10/15 mm. In a direct setup, If you want to avoid a fast extrusion through your nozzle, you can set this value to 0 and increase the next value.

Finally, for our ADVANCED_PAUSE_EXTRUDE_LENGTH, we should set a value high enough to reach our nozzle and prime some filament. Usually the default settings (50) is enough, but you can change it if you want

7. Shutting down bed

Due to the fact that you can use the pause to print only when you're watching the machine, some people want to shut down not only the nozzle but also the bed. This, however, can lead to some issue with bed adhesion, due to the fact that some items may slightly move or even detach when the bed cools down.

8. Filament change file

The M600 command works only during a print, but I've found it usefull even for changing filament before starting one. To solve this problem, I've manually wrote a g-code file that I keep in my Octopi file section. This file will home the machine, heat up only the nozzle, do a M600 filament change and then turn off motor and nozzle. In line 2 and 3 you can set your nozzle temperature. Here you are:

Code: Select all

G28 ; home all axes
M104 S200 ; set nozzle temp
M109 S200 ; waiting for nozzle temp
M600 ; Filament change
M104 T0 S0 ; turn off heater
M84 ; disable motors
M117 Filament change done!
9. Conclusion

I really hope you'll find this guide usefull. Sadly, I'm not a native english speaker, so there may be a few errors with the language in this guide. I hope you'll forgive me and let me know if I need to fix something.

Happy printing!



Post Reply