Model Overview & Print Notes

Summary

A compact filament runout sensor that bolts to the front of the Ender 3 V2's top rail with two M5 drop-in T-nuts. The filament runs straight down through it. Inside is a cheap standard-size microswitch, the common 27.8 × 15.9 × 10.3 mm type with a pin plunger. A snap-on cover hides the switch and wires so it looks tidy on the printer.

Highlights

  • Prints flat with no supports or brim. Body and lever take about 44 min, the cover about 46 min (0.2 mm layers, 0.4 mm nozzle). About 30 g of PLA in total.
  • The filament never rubs on the switch. A printed lever on an M3 pivot presses the filament into a V-groove. When the end of the filament passes, the lever swings about 6° and the switch plunger comes out 1.1 mm, for a clean click either way.
  • Adjustable click point. The switch sits on slotted holes (4 mm of travel) with captive nuts at the back. You set the click point by hand with a piece of filament in the sensor.
  • Snap-on cover. Two ridges on each side click into grooves in the base plate. It has a built-in wire exit and pulls straight off.
  • Optional PTFE. There are push-in sockets for 4 mm OD PTFE tube at the top and bottom.
  • Parametric. The OpenSCAD source is included, and every dimension is a named value at the top of the file.

What you need

QtyPartNotes
1Microswitch, 27.8 × 15.9 × 10.3 mm, pin plunger, 22.2 mm hole spacingDesigned around a LEMA KW7 16 A. Other switches with the same body often have the plunger in a different place; see Other switches below.
2M3 × 16–25 mm screws + 2 × M3 nutsHold the switch. The nuts drop into hex traps on the back.
1M3 × 10–14 mm screw + washerLever pivot. It self-taps into the printed hole.
2M5 × 8 or × 10 mm screws + 2 × M5 drop-in (hammer) T-nuts for 2020Mounting.
2Thin wiresSoldered. There's no room for spade connectors.
opt.4 mm OD PTFE tubePushes into the sockets top and bottom.

Printing

  • The STLs are already turned the way they print: body on its back, lever flat, cover face-down.
  • The cover's bed side becomes its visible front, so print it on a clean, smooth sheet for the neatest finish.
  • I used PLA+, 0.2 mm layers, 3 walls and 15 % infill, with no supports or brim.
  • My times in Orca Slicer (fast profile, 0.4 mm nozzle):
    • body + lever: 44 min, 14 g
    • cover: 46 min, 15.7 g
    • all three on one plate: 1 h 13 min, 29.7 g

Assembly

  1. Drop the two M3 nuts into the hex slots on the back of the body.
  2. Fit the lever on the M3 pivot screw, with the washer under the head. Screw it in until the head just touches, then back it off a quarter turn so the lever swings freely.
  3. Fit the switch with its plunger edge towards the lever, plunger end down (resting on the ledge) and tabs up. Put both screws in loosely.
  4. Push a piece of filament through from top to bottom. Slide the switch towards the lever until it clicks, then push it about 0.5 mm further. Tighten both screws.
  5. Test it. Pull the filament out and the switch must click off. Push it back in and it must click on.
  6. Solder two wires to the switch (see Wiring) and run them out of the top-left corner.
  7. Mount it on the rail:

    • Put the T-nuts in the top rail's front slot.
    • Fit the M5 screws through the counterbored holes.
    • Line the sensor's bottom edge up with the bottom of the rail, then tighten.

    The left end, above the extruder, works well. Check once at full Z height, with the print head at the far left, that nothing on the gantry hits it.

  8. Lay the wires in the cover's wire slot and push the cover straight on until it clicks.

Wiring

  • Wire the switch's COM tab to GND and the other tab to the signal pin of the board's filament-sensor header. On Creality 4.2.2 and 4.2.7 boards that pin is PA4.
  • Leave the 5 V pin unconnected, because the board's pull-up does the job. Check your board's markings for the pin order.
  • On the NO tab, the switch is closed (reads LOW) while filament is in. On the NC tab it's the other way round, so flip the logic in your firmware.

Klipper

[filament_switch_sensor runout]switch_pin: ^!PA4          # COM + NO tab. Using the NC tab: ^PA4pause_on_runout: Truerunout_gcode:  M117 Filament ran outinsert_gcode:  M117 Filament loadedevent_delay: 3.0pause_delay: 0.5

Run QUERY_FILAMENT_SENSOR SENSOR=runout. It should say "filament detected" with filament in and "not detected" with it out. If it's backwards, add or remove the !. The same section is in the included .cfg file.

Marlin

You need firmware built with the runout sensor enabled, plus ADVANCED_PAUSE_FEATURE if you want M600. For COM + NO wiring:

#define FILAMENT_RUNOUT_SENSOR#define FIL_RUNOUT_STATE  HIGH     // pin level when filament is OUT. NC tab: LOW#define FIL_RUNOUT_PULLUP#define FILAMENT_RUNOUT_SCRIPT "M600"

Creality V4 boards already define the pin as PA4. Use M119 to check the reading with and without filament. I run Klipper myself, so these Marlin settings are the standard ones but I haven't tested them.

How it works

  • The lever's round nose presses the filament into a 90° V-groove, and the switch plunger pushes on the lever's flat side.
  • With filament in, the nose is pushed back 1.4 mm, which holds the plunger in.
  • When the end of the filament passes, the switch's own spring swings the lever until its nose rests on the groove face (about 6.4°), and the plunger comes out 1.13 mm.
  • The lever ratio is 0.8, so the filament only feels a fraction of the switch's spring force. There's very little drag.

Other switches / customising

Open runout_sensor.scad in OpenSCAD (2021 or newer). The main values at the top are:

  • Switch: sw_L, sw_H, sw_T (body size), sw_hole_end and sw_hole_edge (hole positions), pl_from_end (plunger position), pl_free (plunger height).
  • Rail: rail_h and slot_z (rail size and slot height), m5_x (screw positions).
  • Mechanism: d_p and d_n (lever ratio), v_depth (groove depth).

Set part = "body", "lever" or "cover", render (F6) and export the STL.

Notes

  • It's made for the 2020 top rail of the Ender 3 V2 (front T-slot, 10 mm up from the bottom edge). It should fit any 2020 rail with a 6 mm slot.
  • There's no locating rib on the back, so the body can print flat. The two M5 screws hold it square.
  • Wires must be soldered: there's only 3 mm of space above the top tab.

How I designed this

Designed parametrically in OpenSCAD. Before printing, every fit was checked with intersection tests in OpenSCAD:

  • the lever against the body, with and without filament
  • the switch at both ends of its slots
  • the cover against everything inside it
  • the snap ridges

Print Settings

Printer Brand:

Creality

Printer:

Ender 3

Rafts:

No

Supports:

No

Resolution:

0.2 mm

Infill:

15%

Filament: Elegoo PLA+ PLA

Notes:

Printer: Ender 3 V2 (0.4 mm nozzle). The STLs are exported in print orientation: body on its back, lever flat, cover face-down. 3 walls, no brim. Body + lever about 44 min, cover about 46 min on a fast profile.

💬Thingiverse Community Comments(0)

★Thingiverse Original Reviews
🔄 Loading comments from Thingiverse...
ThingiverseThingiverse✓ Verified Model

Ender 3 V2 Filament Runout Sensor - top-rail mount, standard microswitch, snap-on cover

View Source ↗
⬇ Downloads—
♥ Likes1
👁 Views—
⚙ Print ReadyPrint Ready
ThingiverseOpen on Thingiverse↗

Download, slice and print this model in the MakerSpell app — available on Android and Windows. Get the app

STL
E3V2_runout_body.stl
Geometry Asset
STL
E3V2_runout_lever.stl
Geometry Asset
STL
E3V2_runout_cover.stl
Geometry Asset

License & Copyright Terms

⚖️Creative Commons - Attribution - Non-Commercial - Share Alike
🔒Personal Use Only (Commercial Sales Prohibited)
✂️Remix & Sharing: Subject to Platform Terms
🏷️Source: Thingiverse Original Publication