Hi guys, I was hoping to get a little assistance trying to set up the filament sensor.

In Marlin,

the code refers the pin out to the RAMPS board pinout which specifies the following:

// define digital pin 4 for the filament runout sensor. Use the RAMPS 1.4 digital input 4 on the servos connector
#define FIL_RUNOUT_PIN 11

in the config.h file it specifies the following:


  • Filament Runout Sensor
  • A mechanical or opto endstop is used to check for the presence of filament.
  • RAMPS-based boards use SERVO3_PIN.
  • For other boards you may need to define FIL_RUNOUT_PIN.
  • By default the firmware assumes HIGH = has filament, LOW = ran out
    #define FIL_RUNOUT_INVERTING true // set to true to invert the logic of the sensor.
    //#define ENDSTOPPULLUP_FIL_RUNOUT // Uncomment to use internal pullup for filament runout pins if the sensor is defined.

Can anyone tell me if this is the D4 pin on servos 2? kind of lower RHS on picture?
(I have tried connecting my sensor to this pin and 5v but it didn’t seem to do anything)

Did you get this working??

I am on GEN L and want to do the same filament sensor.

Reading about Pinout 11
Do you need to connect to ANALOG pin 11 on AUX 2 mid bottom?

Let me know if you got this happening , with ideas / pitfalls to assist my mod.

Thanks Marty

Never got it working directly from the Mks.

I ended up using an octoprint set up and used a digital input into that, and a filament run out plugin and custom Gcode to pause the print and move the hot end away from the print.