COMPLETE Filament Switching

Discussion in 'Guides, Mods, and Upgrades' started by Spoon Unit, Mar 22, 2016.

Tags:
  1. Spoon Unit

    Spoon Unit Well-Known Member

    Joined:
    Sep 6, 2015
    Messages:
    1,095
    Likes Received:
    322
    As I woke this morning, I had a typical 3D printer thought: what's the state of my print. I had set going to longest run for me to date of 11 hours 30 (by Simplify3Ds reckoning). It can be way out, or near, it just depends. Another thought on my mind was, how is the filament spool doing.

    Looking round the back of the printer after seeing everything was still in operation, I could see the spool didn't have a long life left, and it almost certainly wasn't going to complete the job with what it had left. There was enough to go on while I had breakfast and thought things through.

    So far, we've learned that filament changes can be done in a couple of ways and there's some anecdotal evidence that both Livi and RichRap just see what's coming and feed the filament in. That's experience for you. In this area I had none. In my mind I worried in particular about the old filament leaving the extruder hobgoblin and not getting pushed down straight away. The next concern was the filament doesn't always feed with ease, there's a barrier where it needs to enter the PTFE tube and it's not always easy. So I really didn't want to go that route.

    I started searching on the web for GCODEs for filament change and got some directions. The ideas I read led me to think that a layer change was a great time to change the filament. Logically this seemed sound; the extruder is likely inside the outline of the print running an infill task, and with an outline algorithm of in-to-out, the next layer would start away from the outline giving me a few seconds to assess flow and make an adjustment if needed.

    But the jobs in progress, what can I do. At the start I didn't know whether the GCODE file was just being read as it went, or if it copied it somewhere else or did some manipulation on it before running. I now know that it just reads it from where it is. So I started my post-breakfast investigation by moving to my uploads folder and:

    sudo vi SolarSystem.gocde​

    I wanted to find a layer boundary and, knowing that we've already run a useful search and replace in the produced GCODE with the S3D addition post processing script; i.e.

    {REPLACE "; layer" "M117 Layer"}​

    The next step was to look at the LCD and see where we were. At the time it was on layer 378. So I searched for layer 383:

    /Layer 383​

    There I see this stuff surrounding the layer boundary:

    G1 X108.445 Y96.097 E0.6470
    G1 E-1.5000 F4500
    M117 Layer 383, Z = 57.4275
    ; inner perimeter
    G1 X98.817 Y114.659 F4800​

    The information that's of most interest to me here is that the machine is using absolute positioning (those X, Y coords are not offsets as they'd be much smaller numbers if they were), not relative. So I can see that Layer 383 will be at a height of 57.4275 and will begin drawing at X=98.817, Y=114.659. This is the crucial information I think I need to feel comfortable about halting the process. As a first test, I simply insert some lines into the stream to see whether I can update this file on the fly:

    G1 X108.445 Y96.097 E0.6470
    G1 E-1.5000 F4500
    G91 ; relative position movement
    G1 Z5 ; move up 5mm
    G1 Z-5; move down 5mm
    G90 ; back to absolute movement

    M117 Layer 383, Z = 57.4275
    ; inner perimeter
    G1 X98.817 Y114.659 F4800​

    So I add these lines and save the file, wondering what'll happen. After an inordinate amount of time, the prompt returns (it's a reasonable sized file after all, 15MB - and the pi is busy both streaming video probably to my Octoprint UI and also taking pictures, and sending a GCODE stream over to the RUMBA. But it saves .. and at this stage I don't know if it reads this file live.

    The end of layer 382 comes up and sure enough, the print bed lowers, comes back up, and the print resumes. Awesome! I now know that I can get control, but I'm a little worried about the pause/resume situation.

    So, I look a little further down that file for Layer 392 and put something a little more interesting in:

    G1 X149.540 Y107.206 E0.3959
    G1 E-1.5000 F4500
    G91 ; relative
    G1 Z5 ; up 5mm
    G90 ; absolute
    G1 X0 Y0 ; move to home
    G1 X148.430 Y107.827 ; move back to the start spot for the next layer
    G1 Z58.7775 ; move the the right height for the layer

    M117 Layer 392, Z = 58.7775
    ; inner perimeter
    G1 X148.430 Y107.827 F4800​

    My thinking was that this move to home would give me time to operate the pause print button and then somehow swap the filament. Unfortunately I spent a little too long thinking about all this and, as I saved the file, the print halted mid-motion, right on my print, hot end touching, ooze blob beginning. Nightmare!

    So, using the LCD controls I went into Prepare and increased Z to lower the print out of the way. Fortunately the bed and extruder temps weren't altered by Octoprint's objection to me editing the file it was reading (I assume I wrote right at the part it was busy buffering). The next thing was to pull away the ooze and use my cutters to nip away the PLA blob on my print. Now I'm just paused not wanting to act to fast. What needs to be done to restart this? Octoprint is definitely no longer printing. It's sorted itself out, but it's definitely stopped.

    Reasoning that the whole machine is running in absolute mode I figure the only thing I don';t want to do it jam the head into the X or Y end stops, potentially moving the grid be a micron or 50. Ooze is still coming out of the extruder, but it's stopping. I go into Octoprint's terminal and execute G1 X0 Y0, which just moves to home without hitting an end stop. I then run G1 E25 F50 and G1 -E-130 F80 to eject the filament. Meanwhile I've already loaded up the second spool holder with a different colour (unfortunately I'm out of yellow!) and have fed that up the second PTFE tube, and finally clipped it to make entering the PTFE tube inside the extruder mount easy. So, filament changed, I now need to restart the job.

    At this stage, I just delete everything above Layer 392 and save this to a new file: SolarSystemResume.gcode.
    At the front of the file I add a couple of lines:

    G1 E25 ; prime
    G90 ; absolute
    G1 X148.430 Y107.827 ; move back to the start spot for the next layer
    G1 Z58.7775 ; move the the right height for the layer

    M117 Layer 392, Z = 58.7775

    Then, tentatively, I told Octoprint to print SolarSystem resume. As it finished its priming, I grabbed the waste with a pair of pliers then used my little nozzle cleaner to wipe the nozzle as the head made it's way back over to the right spot to resume printing. And ... away it went ! It was such a beatiful thing to see it begin right where it had left off and to feel that it could complete the rest of it's job.

    [​IMG]

    Hope that was OK to follow and that it'll help you orchestrate your own controlled filament changes on layer barriers. I think with some clever post processing scripts, you could probably fix the filament change step right into your GCODE coming out of S3D and not have to have the paused print head and the ooze blob.
     
    Paul Seccombe, Mike Kelly and Stefan like this.
  2. Alex9779

    Alex9779 Moderator
    Staff Member

    Joined:
    Sep 4, 2015
    Messages:
    2,405
    Likes Received:
    731
    Ok I am out! :D

    I think explore M600...
     
  3. Spoon Unit

    Spoon Unit Well-Known Member

    Joined:
    Sep 6, 2015
    Messages:
    1,095
    Likes Received:
    322
    Sure. I'm up for that too, but I had only a small amount of time to get this running before I had to present on a video conference, so I just had brute force my way through. Good learning experience though. Finished result:

    [​IMG]
     
  4. Alex9779

    Alex9779 Moderator
    Staff Member

    Joined:
    Sep 4, 2015
    Messages:
    2,405
    Likes Received:
    731
    Huh? Shall I quote your post you wrote about that? :p
     
  5. Spoon Unit

    Spoon Unit Well-Known Member

    Joined:
    Sep 6, 2015
    Messages:
    1,095
    Likes Received:
    322
    It's all relative. It took far longer to write about what I did than to do it. I thought it might help someone else think through the process.
     
  6. Alex9779

    Alex9779 Moderator
    Staff Member

    Joined:
    Sep 4, 2015
    Messages:
    2,405
    Likes Received:
    731
    Appreciated...
     
  7. Miasmictruth

    Miasmictruth Well-Known Member

    Joined:
    Sep 4, 2015
    Messages:
    758
    Likes Received:
    112
    Switching live is aweaome, didn't know you could modify code on the fly like that.

    Here is an example I did with premeditated filiment swapping on my old printer if you wanted to look at it.

    http://www.thingiverse.com/thing:716899
     
    mike01hu and Spoon Unit like this.
  8. Kanedias

    Kanedias Well-Known Member

    Joined:
    Sep 12, 2015
    Messages:
    406
    Likes Received:
    124
    its disappointing there isn't even a filament load/unload in the menu options. In sailfish firmware when you pause it drops the bed fully and moves to 0,0 and waits. You can then do a load/unload filament. When you resume it gets to temp and just picks up where it left off.

    I'm really disappointed that Marlin does not have the same capability.
     
  9. Miasmictruth

    Miasmictruth Well-Known Member

    Joined:
    Sep 4, 2015
    Messages:
    758
    Likes Received:
    112
    @Kanedias I wonder if this could be done with a programmable button on the Rpi interface. Not sure how injecting pause code could work in an automatic fashion but if it could, I know programing that sequence in gcode should be relatively easy.
     
  10. mike01hu

    mike01hu Well-Known Member

    Joined:
    Apr 22, 2014
    Messages:
    957
    Likes Received:
    166
    Well executed @Spoon Unit . Just one modification to your script though for safety, do the G1 Z action before the G1 XY as this ensures the Z axis move completes before the XY so that the head does not crash into the model as has happened to me when executing this manoeuvre.
     
    Spoon Unit likes this.
  11. Spoon Unit

    Spoon Unit Well-Known Member

    Joined:
    Sep 6, 2015
    Messages:
    1,095
    Likes Received:
    322
    Miasmictruth likes this.
  12. Miasmictruth

    Miasmictruth Well-Known Member

    Joined:
    Sep 4, 2015
    Messages:
    758
    Likes Received:
    112
    Thanks :D miraculously it worked first try!

    I have a simalar project planned for the future if I can ever get the model right.
     
  13. JvdP

    JvdP Well-Known Member

    Joined:
    Aug 3, 2014
    Messages:
    56
    Likes Received:
    22
    That was a great writeup, I enjoyed reading it.

    Here comes a tip from me that I haven't explored myself. It might not work at all and it's much more high risk than your approach. Anyway, during my early days of 3D printing I noticed how the printer would listen to any GCODE that I would send over the command prompt while it was printing over USB. This was back when I used Repetier.

    The way I found out about this is that I tried to change the Z-height of the first layer "on the fly". However I noticed how it would listen to the command (change the Z height) but right thereafter it would go back to the print as if the change didn't happen. This was obviously due to what you also discovered, the fact that most slicers write in absolute coordinates.

    I think this can be used to your advantage, because you could simply throw it a G1 X1 Y1 (you don't want to hit the endstops I suppose) and then pause the print there, perhaps make it wait there also to buy some more time for pausing. I've not tested it personally but this could be tried out on a cube print or something?

    My personal quick and dirty method involves no software at all. I actually weld the next spool onto the spool that is running out... It's risky since you could either jam the hotend/bowden tubes or it can snap off before it even goes into the hotend. However I've become quite good at this now. I take a torch and heat up the ends I want to weld, put them together and then trim the flash with an exacto knife.

    One last thing is that you should ask this question to RichRap because he does filament changes all the time.
     
  14. Spoon Unit

    Spoon Unit Well-Known Member

    Joined:
    Sep 6, 2015
    Messages:
    1,095
    Likes Received:
    322
    Finally got around to enabling and playing with M600 and wanted to share the detail.

    First up, as I'm using @tohara's firmware flasher, enabling the filament change option was as simple as adding a few variables to my profile:

    chrome_2016-10-24_10-17-05.png

    It's possible M600 already does stuff without this, however, this stuff here lets you control the filament change process carefully. After slicing my model in Simplify, I edited the gcode by hand, in my case searching for "Layer 3". In the line preceding that, I simply added "M600".

    notepad++_2016-10-24_15-13-00.png

    So, with that done, start the print, and wait. In fact, you don't need to wait hover over the machine waiting. As long as you're within audible distance. Once M600 is encountered, the filament will be retracted and the head moved according to the numbers you set out above. I chose 0 for the various filament load/unload lengths as I find it very easy to change filament quickly by hand with the Titan. I chose (10) in place of just 10 above as I think that instructs Marlin to move relative to the current head rather than move to an absolute position. OK, so M600 clearly was hit as I began to hear a beeping sound in the distance. The LCD had a "Change Filament and Press Button To Continue" message displayed.

    2016-10-24 16.11.29.jpg

    Perfect.

    After unloading and reloading, I pressed the button and after quickly wiping the head as it made it's way in, everything continued completely as expected. All in all, this feature seems to work brilliantly.

    Why didn't I choose the dump bucket for the change over? My primary concern was that if you consider the head being at the far back right of the bed, a straight line to the dump bucket dock is probably going to hit the corner of the acrylic, and the same on the way out again.
     
    #14 Spoon Unit, Oct 24, 2016
    Last edited: Oct 25, 2016
    mike01hu, Paul Seccombe, JvdP and 4 others like this.
  15. Spoon Unit

    Spoon Unit Well-Known Member

    Joined:
    Sep 6, 2015
    Messages:
    1,095
    Likes Received:
    322
    Small update. It's better if you put the M600 here:

    notepad++_2016-10-31_13-19-18.png

    With it this way, when the head moves back, I keep it clean with a nozzle wiper (http://www.thingiverse.com/thing:1321955), then when it touches the part, it retracts and moves cleanly. With it in the previous position, it has a full nozzle and then does a +1.5mm push when it restarts causing an ugly blob.
     
  16. JohnEsc

    JohnEsc Well-Known Member

    Joined:
    Sep 4, 2015
    Messages:
    229
    Likes Received:
    144
    Need help with filament change. Tomorrow, Christmas Eve will be 1 year from the arrival of my Kickstarter BigBox Pro v1. This Christmas break I would like to tackle learning how to change filament during a print. Can someone explain how I would use this M600 gcode. @Spoon Unit's info looks great, but I'm unsure if it would apply to my Pro single extruder v1 printer?... Do you input the code during the print? I've looked up the info but I didn't understand much of it. Merry Christmas everyone! [​IMG]
    http://www.thingiverse.com/make:275801
     
  17. Spoon Unit

    Spoon Unit Well-Known Member

    Joined:
    Sep 6, 2015
    Messages:
    1,095
    Likes Received:
    322
    Hi John. In a nutshell, this is the nub of it.

    1. Enable the filament change feature and define the position where you'd like the head to be when you change filament. This is done using firmware variables in configuration.h, or via the Octoprint Web Interface using tohara's Bigbox Firmware plugin; e.g.

    chrome_2016-12-23_16-51-37.png

    P.S. the bracketed variables mean to use a calculated offset based on the rest of the current system settings rather than absolute values (from what I can make out - happy to be corrected).

    2. Slice your model as desired.
    3. Edit the resulting GCODE using a text editor (I use Notepad++) and insert the M600 where you want to change filament.
    4. Save the GCODE with the M600 in it
    5. Print

    When the M600 is it, the head will raise and move to the designated point, at which point you can switch the filament. Good luck, and don't hesitate to ask for help. If necessary I'm happy to walk you through the GCODE change using a web conference, but have a go first.
     

Share This Page