Home3D Printer UpgradesFilament runout sensor for Ender3 v2

Filament runout sensor for Ender3 v2

Recycling an unused Z-stop onto a functional runout sensor

My Ender3 v2 (review) printer is getting a couple of small but very useful upgrades. I will have to wait a little longer to get the recently announced touchscreen upgrade, the all-metal hotend is in still in transit, but the BL Touch is set and working flawlessly. I promised to show you how to reuse Z-stop to create a filament runout sensor. I will need that for my next upgrade – a better extruder so I can try out very expensive filament stored on leftover rolls from work.

Filament runout for Ender 3 v2

Despite the filament runout connector present on the 4.2.2 and 4.2.7 motherboards, to add DIY sensor made from Z-stop, you will have to modify the firmware too. There are other filament sensors that you can use with your Ender 3 v2, but I promised you one made from leftover parts so let me walk you through a list of things needed to pull it off.

Shopping list

Some of the things on the list you will find scattered around your house, but I also linked it in case you need to source it.

If you are lucky, you will have all this from other projects available, otherwise, use these link if you want to support NotEnoughTech!

Turning Z stop into filament runout for Ender 3 v2

Start with printing the housing and the filament guide. These don’t need supports, so print as-is. Don’t print the little ball that is also included in the sensor housing. It’s rubbish, it won’t stay on bed and it can potentially mess up your entire print. Mine nearly did. Instead of that use a metal bearing ball from a bicycle bearing.

Unscrew the original Z stop from the mounting bracket and screw it into the case. Depends on how big is your bearing ball, you may need to bend the actuation plate to increase|decrease the sensitivity of your filament runout for Ender 3 v2.


The wire should be fairly long. Make sure it can reach all the way to the top of the gantry. You don’t want the cable to snap when printing a tall print. Pay close attention to markings on the motherboards (Vcc, GND, Signal) and the corresponding pins on your Z stop. Filament runout for Ender 3 v2 should be connected correctly.

While Z stop wires can be soldered, I would encourage you to crimp the other end of the wire. Nothing is more annoying than replacing parts in the future and having wires permanently soldered to the motherboard. Use the schematic below to connect the sensor with the motherboard.

Assembly tips

While the case closes neatly, it doesn’t inspire much confidence. After you had tested everything, you can use super glue to close the filament runout for Ender 3 v2. To make the runout detection accurate, make the enclosure firm. If you don’t want to glue it just yet, use a zip tie to keep everything fixed properly.

If you are having a problem pressing in the bearing inside the guide wheel use hammer to force it in. Just don’t hit it at full force otherwise your print will snap.

Marlin 2.0 and Filament runout Ender 3 v2

I have a separate guide to compiling the firmware. You should check it out before you modify the configuration (unless you are comfortable doing so). In here I will simply list all the changes that need to be done to enable the filament runout.

If this is your first time compiling the firmware, there are other changes you should apply, so please read that article first.

As this project assumes that you have a spare Z-stop after fitting a BL Touch, you will have to enable BL Touch as well.

BL Touch Marlin 2.0

My BL Touch sensor comes with a 5 pin connector. This connector is fitted directly into the BL Touch port on the motherboard. Other levelling probes may come with 5 pin cable split into 3-pin BL Touch connector header and 2-pin Z-stop header.

Another thing to check is the version of the sensor (visible on the sensor itself) I have a BL Touch v3.1 which is compatible with 3.3V and 5V logic. As this can be adjusted in firmware, check which voltage your BL Touch supports.

Depending on the one you have, your configuration will differ. Take a look at the Configuration.h file and use Ctrl+F to modify the following lines:


// BL Touch with 5 pin header

// BL Touch with 3 pin header and 2 pin Z-stop connector

#define BLTOUCH
// you probably want to pick your own values (X, Y, Z)
#define NOZZLE_TO_PROBE_OFFSET { -44, -6, -4.2 }
#define XY_PROBE_SPEED (100*60)



#define Z_SAFE_HOMING_X_POINT ((X_BED_SIZE - 10) / 2) // X point for Z homing
#define Z_SAFE_HOMING_Y_POINT ((Y_BED_SIZE - 10) / 2) // Y point for Z homing

// Homing speeds (mm/min)
#define HOMING_FEEDRATE_XY (120*60)
#define HOMING_FEEDRATE_Z (8*60)


Now open Configuration_adv.h and change the following



//use with caution on compatible BL TOUCH versions (mine is 3.1)

Enabling Filament runout

Pay extra attention to filament runout state as this will determine if you should set it to LOW or HIGH. Use M119 console command to get the current state of the sensor. If the filament is inside the sensor using M119 should show:

  • Triggered – the settings should be set to HIGH
  • Open – the setting should be set to LOW

To enable the filament runout sensor, follow the changes listed inside these files. You should also measure the length of the Bowden tube to automate the process of changing the filament. Take a look at the Configuration.h file and use Ctrl+F to modify the following lines:



// number should represent the length of your bowden tube

Now open Configuration_adv.h and change the following


#define FIL_RUNOUT_STATE HIGH // Pin state indicating that filament is NOT present.

How does it work?

When the filament breaks, sensor detects that and tells printer to pause the print. Thanks to the filament change routine and advanced paused feature, the nozzle will move aside so you can complete the filament change.

There will be no message on the screen of Ender 3 v2 so take a note of the following steps to assure trouble free filament change.

  • Filament break detected
  • Ender 3 v2 pauses the print
  • Printhead moves to the predefined parked position (bed pushed forward)
  • Filament will retract according to FILAMENT_CHANGE_UNLOAD_LENGTH
  • an audible alarm is sound
  • Load new filament up to nozzle
  • press the Ender 3 v2 knob to activate the filament change
  • an audible alarm is sound
  • Printer will prime the nozzle and give you time to remove the excess
  • Set the knob to print to resume
  • The nozzle will move to the correct position and continue

Final words

I have 7 spools (about 100-150g left on each) of leftover Onyx Nylon from work. I’d love to give it a go, and print something meaningful to test the premium filament on a budget printer. In order to do so, I needed the filament runout sensor for my Ender 3 v2. Now the last upgrade is in the post, I’m one step closer to try it out. I need all-metal-hotend to raise the print temperature to about 280℃. This is the task for another article in the series of upgrades to my Ender 3 machine. Stay tuned! Leave me a comment in this Reddit thread.


Nothing says "Thank you" better than keeping my coffee jar topped up!


Support me on Patreon and get an early access to tutorial files and videos.


Bitcoin (BTC)

Use this QR to keep me caffeinated with BTC: 1FwFqqh71mUTENcRe9q4s9AWFgoc8BA9ZU

Main 3D-printerCreality Ender 3

Get FilamentSupport NotEnoughTech

PLA Filament

ABS Filament

PETG Filament

TPE Filament

Nylon Filament

Carbon Filament

Best 3D designs

Lights, Camera… but mostly lights

Grab VIJIM VL81 - panels that are useful not just for vloggers. Add one part and make the lights even better

Argon18: Argon ONE SSD modification

Argon One case just got better - now you can boot it from USB without ruining the design thanks to Argon 18: Argon One SSD modification

32mm adapter for Zemismart Roller

Adapter for 32 mm roller blinds to drive it with a Zemismart smart roller shaft

3D Printed miniDSO ES121 case

ES121 is an amazing tool, but comes without a case. I fixed that by designing my own carrying case with charging!

Fixing the 2nd cheapest soldering stand (DANIU)

I have upgraded from the cheapest soldering stand you could get, to the second soldering stand. Now, let's make this DANIU Soldering stand a tiny bit better with a little bit of printing.