PROJECT: MMU2S & Filament Diameter Irregularities

This is a follow up to my previous post, Prusa i3 MK3S + MMU2S

Here I describe how I modified the printer firmware (FW) to better handle filament diameter irregularities. The FW I produce is 3.9.0-ANT, which is a slight modification of the vanilla Prusa i3 MK3S 3.9.0 FW. Also you can get the compiled .hex file here:


The Problem

Turns out that printing with lighter colour filaments can be a pain in the butt on the MMU2S, as (for me at least) lighter colours are more likely to make "double up" tips during unload. These create a diameter irregularity which if bad enough will cause load issues, as the IR sensor (at extruder) will get confused by the sudden "lack" of filament

The Solution

After creating an issue/suggestion on the Prusa GitHub (issue #2797) I got to work trying to modify the printer FW to be more resilient against such anomalies

Initially I had some trouble getting the build environment up and running, as for the vanilla 3.9.0 FW my .hex file was vastly different to what Prusa produced. But after some help from 3d-gussner we were able to figure out that Prusa's compile instructions for Linux OS were a bit outdated, as I should have been compiling with "./PF-build.sh" and not "./build.sh" like the instructions said ;^)

With all that said, let me introduce my first custom 3D printer FW 3.9.0-ANT. As mentioned before this guy is much more resilient to filament diameter anomalies, and with one tool change heavy job managed to reduce the load errors from 10 to 0! 

More Info

Luckily making 3.9.0-ANT FW was quite easy, and only required me to change a single number

In "mmu.cpp" there exists a function called "can_load()", this function is called whenever the printer is asked to load filament. During a load the counter "filament_detected_count" is incremented whenever the IR sensor detects that filament is present, and when a load is finalised the counter is compared against a threshold to see if the load was successful

As of 3.9.0 this threshold value is 26 ((6.0 / 0.2) - 4), meaning the IR sensor must see 26 positive instances for the load to be considered successful

Well with my 3.9.0-ANT FW I lower the threshold from 26 ((6.0 / 0.2) - 4) to 5 ((6.0 / 0.2) - 25), by changing:

if (filament_detected_count > steps - 4)


if (filament_detected_count > steps - 25)