Retraction solution with Marlin, Pronterface and Slic3r

I’ve just fixed some key settings in Slic3r. Retraction Speed is now 7mm per second (down from 100!), and the Retraction Distance is 1mm. There is still slight room for improvement, but this is the best I’ve had it running for, well, ever. No stringing. Very little blobbing.

[Update: 2012/01/06 – I’ve now cautiously increased the retraction speed to 20mm/sec. It seems to be working, but I’m not fully convinced I’m not missing a few steps now and then during retraction.]

It turns out that one of my many theories was right as to the cause of my overextrusion. Thanks to a comment from Triffid Hunter with the phrase “as fast as you dare”, I thought of a way to test my MakerGear Mendel Prusa’s maximum safe retraction speed.

Extrude and Reverse buttons

Pronterface has a pair of buttons down in the bottom left corner of the control window labelled ‘Extrude’ and ‘Reverse’. I’ve used ‘Extrude’ a lot to test that I’ve got the right temperature setting for my PLA, and to ‘fill up’ the nozzle if it has been oozing plastic while waiting for me to start printing.

It occurred to me that ‘Reverse’ was just another name for Retract.

First thoughts

Triffid Hunter had suggested a retraction speed of 1000 or “as much as you dare”. Pronterface’s extrude button defaults to 300mm/minute. I nearly just entered 1000 into the mm/min field and pressed extrude. Then I remembered satellites crashing into Mars from unit conversion mistakes, and decided to think a bit.

Calculating how much to extrude and retract

My PLA has a diameter of 1.75mm. Such a filament has a cross-section of  pi * (1.75/2)^2 = 2.4 square mm. And my much smaller 0.35mm diameter nozzle has a cross-section of pi * (0.35/2)^2 = 0.1 square mm. So for every 1mm of 1.75mm filament going into the hot-end, 24mm of much thinner filament comes out the bottom.

Pronterface’s default extrusion length of 5mm should spit out 120mm of extruded plastic. Much more than I needed for testing my retraction. If I set the Extrude distance to 1mm, which is what many people suggest for an initial retraction length, I should get 24mm of extruded plastic. That seemed like plenty to be able to see if things were working.

So I set my “mm” field (next to the ‘Extrude’ button) to 1.0

Testing how fast I can extrude and retract

I know that 300mm/min works for extrusion on my machine, because that is Pronterface’s default, and I’ve used it a lot. So I started with that.

I use an indicated 175 degrees as my temperature for the clear PLA I’m using. It will flow OK at 160, so either it is very soft, or my thermistor is reading low. It doesn’t matter which is true, so long as I extrude at a temperature that my own experimentation shows works.

With the hot end fully warmed up to 175 degrees, length at 1.0mm and speed at 300mm/min, here was my procedure:-

  1. Press the ‘Extrude’ button repeatedly until filament extrudes cleanly.
  2. Remove extruded filament quickly with metal tweezers.
  3. Press the ‘Reverse’ button.
  4. Press ‘Extrude’ to undo the effect of the ‘Reverse’.
  5. Press ‘Extrude’ again to prove that extrusion is ready to go.
  6. Repeat until convinced of success or failure.

By watching the gear wheel through the hole in the end of the extruder I could tell that it was moving the same amount in both directions. And I could tell by the amount of filament extruded in step 5 that starting to print again after a retraction at this speed would probably work fine.

Next I increased the speed to 1000 mm/min, as suggested by Triffid Hunter, and ran the test again. How about that! The motor failed to move in reverse. So 1000 mm/min is too fast for my geared extruder. Triffid has a different type of extruder head on his machine, so his numbers will be different.

After more testing, I settled on 400mm/min. I can probably retract faster than that, but I wanted to be certain that I wasn’t skipping any steps at all.

Configuring Slic3r

Now to enter these figures into Slic3r’s Retraction settings area.

Length is easy : 1.0mm

Speed is in mm/sec, rather than the mm/min that Pronterface uses.

400mm/min is 6.6mm/sec. So I entered 7.0 in the Speed field.

Extra length on restart I left as zero.


I’ve had my first two successful prints in a week. No stringing, and the blobbing has almost completely gone. Each new line segment starts just the width and location I would expect it to. A huge improvement on my recent results. Looking good.

Why did this blobbing suddenly start happening?

Looking back at all my previous prints, right from print #1, I can see signs that retraction has not been working for me ever. I was just lucky that I didn’t try to print things with lots of small parts close together. And I was massively under-extruding for quite a while because I had accidentally set 3mm instead of 1.75mm as my filament diameter at a crucial point deep inside Skeinforge.

It wasn’t until I tried to print over 40 small closely-spaced parts in a single build plate (brave or foolish?), slicing with Slic3r and with a version of Marlin optimised for a much faster printer than mine that I noticed the problem. Then it took a lot of watching before I was able to work out what was wrong.

The default retraction speed of Slic3r is some 16 times faster than the figure I’ve settled on as safe for my printer. Maybe I could retract at 800mm/min if I was willing to risk the odd skipped step, but that is still 8 times slower than Slic3r’s default.

So every time Marlin tried to retract the filament at the speed Slic3r’s gcode told it to use, the motor just stalled and didn’t retract at all. Then when the retraction compensation happened, a big blob of plastic spurted out.

It is such a relief to see my printer happily printing recognisable objects again! Many thanks to Triffid Hunter for the comment that sparked enlightenment for me.

This entry was posted in 3d printing, Software and tagged , , , , , , . Bookmark the permalink.

29 Responses to Retraction solution with Marlin, Pronterface and Slic3r

  1. good to hear you got it sorted!

    now that you have a known good datum, drop the retract distance to 0.7mm, then reduce temperature until you get no strings again. Should make the start/stop point even nicer 🙂

  2. Gary says:

    It looks like you’ll enter 2012 before most of us RepRap-ers. Once there, please let us know if we should be making any special preparations. Or, in the WCS, should we be looking for alternate ‘destinations’.

    • BrazenArtifice says:

      Would that be the Wildlife Conservation Society, Wireless Control System, World Cosplay Summit (sounds like fun!), World Coordinate System, World Cup Skateboarding, or perhaps some strange fundamentalist end-times group that doesn’t show up in the first twenty hits on a search engine?

      Happy New Year. May your 3D printer soon begin filling the world with beauty and wonder.

  3. Mark C says:

    Now that I’m finally extruding, I have a question (not really related to retraction, but since we’re on the topic of extruding…): is there a desired tension on the plastruder to feed the filament? I have an approximately 2.5mm gap between the piece with the bearing and the main body. Seems to work fine, so far…

    • BrazenArtifice says:

      Extruding? Yeehar! That’s a real milestone achievement.

      About the 2.5mm gap:- are you saying that the idler wheel housing is not contacting the extruder body, but floating on the idler wheel with the bolts just holding it in place? That is not how I’ve got mine set up.

      You’ve probably noticed that the threaded bolt (that the idler wheel turns on) is not centred in the side of the housing. I’ve got more plastic between the threaded bolt and the extruder than I have on the side away from the extruder. And that leaves me with no visible gap between the idler housing and the main extruder body.

      I’m no expert on this (or anything, really…), but I think I remember reading that with the hardware in the kit, you basically tighten the hex-headed bolts until the nuts at the other end come off the threaded part of the bolt. That is, the correct tension is built into the length of the bolts, and it isn’t possible to overtighten them. That works for me, but I don’t have a 2.5mm gap.

      I’m afraid that’s the best I can do. You might do better asking on the MakerGear google group.

      • Mark C says:

        I found the “Making your first print” post which Rick suggested having the teeth “gripping halfway into the PLA”. Is yours set up like that? I tightened the idler block down on the PLA but it started making the nuts on the other side spin and the teeth still aren’t “inside” the filament. The filament actually seems quite hard…

        So close to making my first calibration cube but now another problem I’m curious if you’ve run into: the extruder won’t extrude when printing. It extrudes fine when I manually hit “extrude”, but when it’s printing a model, it simply doesn’t spin. It’s not slipping either, I’m watching the extruder motor and it sits still. Any clue why??

        • BrazenArtifice says:

          The filament is hard. I don’t think my teeth go halfway through, but the stress lines in the PLA look like they go halfway through. You might not be able to see that except with clear PLA.

          Those captive nuts are not captive enough, are they. I have the same problem with one of mine spinning, but only just before the length it should be at anyway.

          Is your Idler Block the right way round? Have you got the thicker side facing the extruder, and the thinner side facing away from it?

          On the extruder stalling, my guess is that you’ve got the feedrate set too high in your slicing program. Especially if you are using Marlin as firmware, which is optimised for the Ultimaker, which is much faster than our Prusa models.

          Here are my current settings for the “Print Speed” section of the “Printer and Filament” tab in Slic3r.
          Perimeters 30 mm/s
          Small perimeters 30 mm/s
          Infill 60 mm/s
          Solid infill 60 mm/s
          Bridges (mm/s) 60 mm/s

          Travel set to 100 mm/s
          Retraction length 1.0 mm
          Retraction speed 10.0 mm/s (though I’m still experimenting)

          I don’t know how they compare with MakerGear|Rick’s suggestions, but they work for me. Tuning is neverending…

        • BrazenArtifice says:

          Another thought:

          If your nozzle thermistor hasn’t reached the temperature you asked for in your slicer program, the system may wait until that temperature is reached. But that would stop the x and y motors from moving too, after they have homed, as well as the extruder.

        • BrazenArtifice says:

          I’m watching mythbusters, so not paying as much attention as usual.

          Check that the last value in axis_steps_per_mm in your configuration.h file is similar to the one in mine,or Rick’s. If you’ve got a value fast enough for an Ultimaker, it may be too fast. I think Rick’s value was about 1380.

          • Mark C says:

            I’m using Printrun which uses Pronterface and Skeinforge. Correct me if I’m wrong, but I don’t think it uses Slic3r. However, I changed my Skeinforge settings to match the suggestions here:
            which are similar to what you have. I’m also using your configuration.h which appears to have Rick’s settings. Unfortunately, still no luck. I’m sure it’s a software/firmware issue though, considering manual extrusion works.

            At least if friends come over, I can extrude an PLA model of an inchworm or piece of thread!

            • BrazenArtifice says:

              I’ve heard that the newest version of pronterface doesn’t come with a slicing program set up by default, but the earlier ones certainly used skeinforge or sfact.

              There are a >lot< of settings to get right in skeinforge.

              If you use slic3r to convert your .STL into .GCODE, you can open the gcode directly in pronterface. That way you don't have to fiddle with skeinforge.

              I see that folks on the makergear group have started helping you get your skeinforge settings working. I don't think I've got a particularly good config for skeinforge, so I'll leave that up to them.

              You are so close now!

  4. Mark C says:

    So close! I noticed you uploaded your Slic3r config file which I will certainly make use of. And you are once again right, I got it extruding with the help of the Google Group suggestions, but it’s now extruding a path of nothingness goo. The Skeinforge settings are almost comically confusing so I’m going to give Slic3r a try.

    Unfortunately I have two licensing exams I *really* need to study for so the Prusa will have to take the backseat for now!

    • BrazenArtifice says:

      Out of respect for your need to study, I won’t say what I suspect you need to do next. 😉

      You’ve got the software stack working, the hardware working, the electronics working. You’ve built a working 3D printer. Congratulations! What a great start to a new year.

      The rest is fiddling with the details.

      • Mark C. says:

        By all means, I’m more than curious as to what your suggestions are. I’m going to slack off and spend time here and there playing with it anyway, might as well make that time productive!

        • BrazenArtifice says:

          I’m guessing your initial z-height isn’t precise enough, and maybe your bed isn’t level enough. I can see from your post on the MakerGear google group that you have problems with slipping z-couplers, which would make getting your levels right very hard. Been there, done that.

          To print a decent line, your nozzle tip has to be closer to the print surface than the hole in the nozzle, or the plastic won’t stick, and the top surface won’t be flat. So with my 0.35mm nozzle, I need it to be quarter-turn< of a nut. Don't quote me on the figures (I'm sure the engineers know the exact pitch of those machine screws, I don't). Just remember that the levelling adjustments are really small movements of the nuts.

          • BrazenArtifice says:

            Arrg. WordPress stole my lines. Sorry that last paragraph didn’t make sense.

            With a 0.35mm nozzle, the layer height needs to be less than 0.35mm. I use 0.25 mm, which makes the maths easy (4 layers per mm).

            The print bed needs to be level to within one or two tenths of a mm over the whole bed. Otherwise the plastic won’t stick reliably, and your lines will vary in width.

            The bed adjusting nuts seem to move the bed by about 3 tenths of a mm per quarter turn of the nuts. So use small adjustments. I spent a lot of time chasing over-adjustments before I realised how little turning of the nuts was needed.

            • Actually, if your bed is out of level by 0.2mm and you’re using 0.25mm layers you’ll still see a huge variance in line width over the surface of the bed. You’re looking for a few hundredths of a millimeter difference rather than a few tenths!

              A piece of standard paper makes an excellent feeler gauge, and will get your bed flat within a couple hundredths of a millimeter

            • BrazenArtifice says:

              Very true. I didn’t want to make the task seem too impossible for a first attempt. I remember our discussion about the non-existence of cheap sensors accurate to ten microns.

  5. cakeller98 says:

    You know what – I was testing the extrusion speed as well, trying to configure my firmware in the same way you’re trying to limit the slicing output.

    After a few conversations with Kliment about testing maximums… set your slicing software to AS FAST AS POSSIBLE, then start configuring your firmware. Since Marlin allows on-the-fly configuring of maximums you can literally test settings as it’s printing.

    I found that I couldn’t exceed about 16mm/s extrusion speed. Not ideal, but anything faster will cause the makergear hot end to stall out. However, this is on a 0.35mm nozzle. With a 0.5mm nozzle it’s entirely possible I could achieve faster speeds – remains to be seen.

    Anyway, the point is, as a work-around when slicing doesn’t get it right, it’s great to know the limits of your machine and limit everything to that lowest common denominator.

    Now it doesnt matter if my slice file is too fast for my machine, because the firmware limits everything.

    I guess the only potential issue is is the firmware doesn’t limit Cartesian motion to the extrusion limits, but I’m pretty sure marlin does.

    Cheers! great article.

    • BrazenArtifice says:

      Hey, thanks for that. I haven’t finished my testing on extrusion speed, so you input is very helpful. When we get our satellite broadband replaced I`ll hopefully have more to say on the subject, because my setup still isn’t right. (I’m typing this on a public library terminal 😦 )

  6. Abigail Hesterly says:

    Great information 🙂

  7. Hi Brazen, Thanks for the sharing your knowledge/findings here. I would like to ask if you know how to stop Pronterface from Reversing/Retracting when it starts a print? Your advice would be greatly appreciated.

    Thanks ~ Tim

    • Sorry for my uselsessly late reply. As you’d probably guessed, I don’t know how to help with this question. Too many combinations of slicer and printer control program settings – you just have to check them one after the other til you find a stupid default that you probably didn’t put there anyway. Best of luck!

  8. Pingback: How to: Calibrating Retraction with Marlin, Pronterface and Slic3r |

  9. Pingback: How to: Calibrating Retraction with Marlin, Pronterface and Slic3r | DIY India

  10. Bryan Cowger says:

    Wow, thank you so much for this write-up! I’ve had my printer for over a year and only now (thanks to you) do I realize that Slic3r’s default of 40mm/s retraction was *way* too fast for my extruder. Printing like I’ve never been able to before! : )


  11. Hi Bryan,

    It’s nice to know that some of this info is still helping people, despite being 4 years old. Thanks for the feedback.

  12. Pingback: 3D-Druck macht Spaß | Christian Neumann

Please leave a Reply

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

You are commenting using your 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.