Filament runout sensor

On this page 7

A filament runout sensor is a detector in the filament path of an FDM 3D printer that recognizes when filament is no longer present and tells the firmware to pause the print before the nozzle starts moving without material. In 3D printer hardware, it is a small but valuable safety and convenience component that turns an empty spool from a failed print into a short interruption.

Within 3D printing & making, runout detection matters most for long prints, partially used spools and unattended machines. The sensor itself is simple; the real value comes from how the firmware reacts: parking the head, keeping the hotend warm and resuming at the exact layer and position after a new spool is loaded.

How a filament runout sensor detects missing filament

A filament runout sensor works by reporting a binary state, filament present or absent, or by measuring filament movement over time. The signal goes to a GPIO pin on the 3D printer mainboard, where firmware such as Marlin, Klipper or RepRapFirmware watches it during printing.

The simplest design uses a mechanical microswitch: the filament presses a lever, and when the tail end passes, the lever drops and the switch changes state. Optical sensors use an infrared light gate that the filament interrupts, while Hall-effect sensors detect a magnet on a spring-loaded arm. Motion sensors add an encoder wheel that the filament turns, so the firmware can also notice when filament stops moving even though it is still present.

Sensor types and their trade-offs

Runout sensors differ mainly in what they detect and how reliably they handle real filaments. The table compares the common designs found in stock printers and upgrade kits.

Sensor typeWhat it detectsStrengthWeakness
Mechanical switchPresence onlyCheap, simple, robustLever wear, false triggers
Optical light gatePresence onlyNo contact, no wearFooled by transparent filament
Hall-effect armPresence, sometimes widthDurable, works with clear filamentNeeds careful calibration
Encoder motion sensorPresence and movementAlso catches jams and tanglesFalse alarms on short moves
Extruder load sensingMotor load or filament forceNo extra parts in pathFirmware and hardware specific
Common filament runout sensor types

Motion sensors are the most informative, because a spool tangle, a clogged nozzle or a grinding extruder all stop the filament without emptying the path. They need a detection length setting, often 3-10 mm of expected movement, that matches the extrusion pattern of the print.

What the firmware does after a runout

The firmware reaction is defined by a runout script, usually the M600 filament change routine in Marlin or a PAUSE macro in Klipper. A correct sequence protects both the print and the hotend.

  1. The sensor state changes and the firmware applies a debounce delay or runout distance.
  2. The printer finishes buffered moves, retracts filament and lifts the nozzle.
  3. The head parks away from the part, so oozing does not drip onto the print.
  4. The hotend stays at temperature or drops to a standby value after a timeout.
  5. The user loads a new spool, purges and confirms, and the printer resumes at the same position.

Placement changes timing. A sensor mounted before the extruder triggers while 30-80 mm of filament still sits in the path, which firmware can consume with a runout distance before pausing. A sensor in a direct-drive toolhead sees the end later, so the pause must happen promptly.

The table compares the usual mounting positions and how each one affects the timing of the pause and the amount of filament left to use.

Mounting positionFilament left after triggerMain consideration
At the spool holderLong, up to a full Bowden tubeSet a long runout distance
Before a Bowden extruderAbout 30-80 mm in pathRunout distance avoids waste
Inside a direct-drive toolheadOnly a few millimetersPause immediately on trigger
In a multi-material unitDepends on the feeder designNeeds per-lane sensing logic
Sensor placement options

A sensor far from the nozzle also catches problems earlier, such as a brittle strand snapping in the tube, but long Bowden paths make the exact remaining length harder to predict, so a conservative runout distance is safer than an optimistic one.

Configuring a runout sensor correctly

Most problems come from configuration rather than hardware: wrong logic level, missing pull-up, or no pause routine. The table lists the settings that usually need attention.

SettingTypical valuePurpose
Trigger stateHigh or low on runoutMatches switch wiring logic
Internal pull-upEnabled for switchesPrevents a floating input
Runout distance0-80 mmUses filament already in path
Motion detection length3-10 mmDefines when movement stopped
Pause routineM600 or PAUSE macroParks head and waits for user
Enable at bootOn, toggled by commandAllows disabling for special jobs
Key runout sensor settings

After setup, test the sensor manually: remove the filament during a short print and confirm that the printer parks and resumes correctly. Network hosts such as OctoPrint can forward the pause event as a notification, which is useful for overnight prints.

Limitations and common faults

A runout sensor reduces risk but does not guarantee a flawless resume. A visible seam often remains where the print paused, especially on glossy filaments, because the paused nozzle leaves a small blob or gap.

SymptomLikely causeFix
Pauses with filament presentInverted logic or noisy wiringInvert state, shield or reroute cable
Never triggersSensor disabled or wrong pinCheck config and pin mapping
Ignores clear filamentOptical sensor limitationUse mechanical or Hall-effect sensor
False motion alarmsDetection length too shortIncrease detection length
Layer shift after resumeMotors disabled during pauseKeep steppers enabled while paused
Runout sensor symptoms and fixes

Another limitation is the filament tail. A spool with a fixed end can stop the filament before the sensor ever sees it run out, so only a motion sensor catches that case. Multi-material systems and automatic spool changers also need their own logic beyond a single sensor.

Understanding it simply

A 3D printer pushes a plastic thread through a hot nozzle. If the thread runs out, the printer keeps moving but prints nothing. The job is ruined.

A filament runout sensor watches that thread. When it disappears, the sensor tells the printer to stop and wait. You put in a new spool and press continue. The print carries on from the same spot. It works like the low-fuel light in a car, which warns you before you are stranded.

Applied in practice

A small engineering workshop prints a 22-hour housing for a test fixture in PETG on a CoreXY printer running Klipper. The remaining spool weighs about 300 grams, while the slicer estimates 340 grams for the job. Buying time is not an option, so the operator relies on the encoder motion sensor fitted before the extruder.

Around hour nineteen, the spool empties. The sensor reports that filament stopped moving, and the PAUSE macro retracts, lifts and parks the toolhead while keeping the nozzle at 240 °C. A phone notification reaches the operator, who loads a new spool of the same color and resumes.

The finished housing shows only a faint line at the pause height, which sits on an internal face. The sensor saved roughly 19 hours of printing time and about 300 grams of material that would otherwise have been lost.