Posted on

Setup 3D Printer Filament Runout Sensor

marlinfw and filament runout sensor

In order to take full advantage of the Filament Run Out Sensor on your 3D printer is necessary to modify the stock firmware included with your printer, by doing so your printer can automatically pause the printout and wait until the filament is been reloaded and continue where it left off.

Warning!!!
Modifying the stock firmware on your 3D printer can permanently damages the machine!
Please use this guide to modify your printer’s firmware at your own risk. We do not take any responsibility for any damages to your 3d Printer if that may occur.
By following this guide and continuing with the installation of our hardware you are agreeing to these terms.

Before you start the process of modifying your 3D printer’s firmware and installing the Filament Runout Sensor, make sure the following requirements are fulfilled.

Prerequisites :

  • Available Z+ endstop port on your 3D printer
  • Access to the source code for your existing printer
  • Arduino IDE 1.8 or newer to edit your printer’s firmware

The STL files to 3D print this case, are available for download here:

Marlin Firmware Configuration

Step 1

Modify Configuration.h on Filament Runout Sensors section uncomment the following line:

#define FILAMENT_RUNOUT_SENSOR

Step 2

In this case, I used the Z+ Port, therefore you need to set FIL_RUNOUT_PIN in pins_RAMPS.h to 19, add the following line to the block of code:

#define FIL_RUNOUT_PIN  19

Step 3

Since the sensor has its own pull-up resisters comment the following line:

//#define FIL_RUNOUT_PULLUP

Step 4

If you need to invert the logic of the sensor set to true the following line:

#define FIL_RUNOUT_INVERTING false

Step 5

Modify Configuration_adv.h in the section Advanced Pause and uncomment the following line:

#define ADVANCED_PAUSE_FEATURE

Step 6

Once done, flash the modified firmware to your printer.

More information about the firmware configuration is available at the official Marlin Documentation found here.

Hardware Installation

Once the firmware is configured and uploaded to your printer, Marlin will send M600 gcode to change the filament spool once the sensor is triggered.

The following images display the correct Z+ endstop pin location for the installation for the Filament Runout Sensor.

RAMPS 1.4 Pinout
RAMPS 1.4 Pinout
RAMBo 1.2 Pinout
RAMBo 1.2 Pinout
Printrboard Rev B,C,D,E Pinout
Printrboard Rev B,C,D,E Pinout

Hardware Usage

1.- When the filament is loaded the Green led will indicate normal operation.

2.- Once the sensor detects no filament, the alarm will start, along with a flashing Blue and Red led indicators.

3.- You can mute the alarm by pressing the push button, this will set the sensor in standby mode with an intermittent Blue led.

4.- After the filament is reloaded, the led indicator will switch back to Green.

Basic Maintenance

This sensor contains a limit switch and dust or debris can cause false or changing readings. Clean dust by blowing on the sensor or disassembly to clean the limit switch.