Simple filament runout sensor

I designed a simple microswitch based filament runout sensor here http://www.thingiverse.com/thing:1698397. I appreciate Lulzbot adding the pause function to Cura, but I really get tired of waiting for the spool to run out. Sebastian’s version of Marlin supports filament runout.

There is a period at the end of your link which makes it 404. I removed it: http://www.thingiverse.com/thing:1698397

Thanks for fixing the URL.

Here is some additional info on how to wire up the sensor to the TAZ5. Hopefully it will save somebody else some time. As a software base I used the version found here: https://forum.lulzbot.com/t/latest-firmware-for-taz5-advanced-development-version/3451/1 For the physical wiring, you need to connect the switch to the RAMBO board.


I wired it such that the switch is open when there is filament present and closed when there is no filament. I wired it to pin 24 (circled in red in the circuit board image).

The switch is wired to the two rightmost pins of the X-Max header. Pin 24 is used for the X-Max limit switch or for servo2 (starting from 0). So if you use either of those, you will have to find a different pin.

You need to make changes in pins_RAMBO.h, configuration.h, and optionally in Marlin_main.cpp. In pins_RAMBO.h you need to define the FILRUNOUT_PIN. I added the line after the fan pin definitions as follows:

#define FAN1_PIN           6  //Fan1 --- Extruer0 Fan
#define FAN2_PIN           2  //Fan2 --- Case Fan
#define FILRUNOUT_PIN 	  24

I also set the X_MAX_PIN to -1, but I don’t know if that is really needed:

#define X_MAX_PIN -1

In configuration.h you need to enable the function and also set the sensor to uninverted.

//===========================================================================
//========================= Filament Runout Sensor ==========================
//===========================================================================
#define FILAMENT_RUNOUT_SENSOR // Uncomment for defining a filament runout sensor such as a mechanical or opto endstop to check the existence of filament
                                 // In RAMPS uses servo pin 2. Can be changed in pins file. For other boards pin definition should be made.
                                 // It is assumed that when logic high = filament available
                                 //                    when logic  low = filament ran out
#if ENABLED(FILAMENT_RUNOUT_SENSOR)
  const bool FIL_RUNOUT_INVERTING = false;  // Should be uncommented and true or false should assigned
  #define ENDSTOPPULLUP_FIL_RUNOUT // Uncomment to use internal pullup for filament runout pins if the sensor is defined.
  #define FILAMENT_RUNOUT_SCRIPT "M600"
#endif

This works great, but for some reason Marlin only enables the function when the print is run from the SD card. I wanted it to also occur when I ran from Cura. So you need to make the following change in Marlin_main.cpp. Change the line (somewhere around line 7258) from

  #if HAS_FILRUNOUT
    if (IS_SD_PRINTING && !(READ(FILRUNOUT_PIN) ^ FIL_RUNOUT_INVERTING))
      filrunout();
  #endif

to:

  #if HAS_FILRUNOUT
//    if (IS_SD_PRINTING && !(READ(FILRUNOUT_PIN) ^ FIL_RUNOUT_INVERTING))
    if (!(READ(FILRUNOUT_PIN) ^ FIL_RUNOUT_INVERTING))
      filrunout();
  #endif

There may a good reason why it was only enabled when printing from a SD card, but I didn’t know what it was and it checks that there is a LCD panel. Anyway, it works when running from Cura, but I would appreciate knowing why it was disabled.

Good Luck!

how does this work when running from cura? does the software show paused, and do you have control of the printer, just like you paused it in cura?

Also, any idea if this can work on the mini?
I just asked about a similar product in the development area. https://forum.lulzbot.com/viewtopic.php?f=16&t=4947&p=29375#p29375

how does this work when running from cura? does the software show paused, and do you have control of the printer, just like you paused it in cura?

Also, any idea if this can work on the mini?
I just asked about a similar product in the development area. viewtopic.php?f=16&t=4947&p=29375#p29375

It works with Cura, but not the same as the cura pause/resume. The notification is on the LCD and the resume is from the LCD. It also makes a clicking noise to alert you that the filament has run out. The people that developed the function did not assume any particular gcode sender such as Cura, so it works standalone.

Without a LCD panel, it won’t work on the Mini.

Please come up with a different name for this. There is already a term in mechanical engineering called run-out: https://en.wikipedia.org/wiki/Runout
I had completely the wrong idea of what your “out of filament” sensor did given the title of this thread.

Please come up with a different name for this. There is already a term in mechanical engineering called run-out: > https://en.wikipedia.org/wiki/Runout
I had completely the wrong idea of what your “out of filament” sensor did given the title of this thread.

Unfortunately “filament runout” is the name for the feature in Marlin, so changing the name would just lead to a different type of confusion.

1 Like

is there an easy way to tie this to a blinking LED somehow - or a buzzing sound thats continuous?

Thanks

I don’t know if this makes sense, but let me throw it out there. I am basing this on a TAZ 6 that I have.

The X-max switch is used on the Single Extruder V2, where it is closed until it hits X Max with the single extruder firmware. However, on the Dual Extruder V2 and FlexyDually V2, the firmware supports the X Max switch being open until it hits X-Max (although, for some reason the dual extruders don’t actually have an X-Max switch).

Now the Z-Max switch is normally closed until it hits Z-Max, at which point, it opens (which one of the pins is at a 5 volt logic 1 (Which could be used for driving an LED or buzzer, but may require an appropriate signal driver).

So wouldn’t the Filament runout switch be better if it was wired as normally closed in series with the Z-Max switch, such that either case of Z-Max or filament runout would cause a halt in the printing?

I believe this would require no firmware modifications at all.

So wouldn’t the Filament runout switch be better if it was wired as normally closed in series with the Z-Max switch, such that either case of Z-Max or filament runout would cause a halt in the printing?

You could wire it to be normally closed and in series with Z-max, but you still need firmware changes. The filament runout function does more than just pause the print. It moves the print head off to the side and then returns it once the filament has been reinserted. If you want that functionality, you have to enable it in firmware. You also have to say which pin is the sensor for filament runout and whether it is NC or NO.

  1. Are you still using the same mechanical sensor?
  2. Did you have to make sure M600 doesn’t retract the filament due to the mechanical lever arm being there to stop it?