kapy academy

Sensors, cameras and failure detection

19 min readUpdated Nov 2026

You start a 14-hour print and go to bed. Three hours in, the part breaks loose from the plate, and the printer spends the next eleven hours building a nest of plastic around the nozzle. A camera that recognizes spaghetti would have paused it within minutes of the failure. The runout sensor never trips, because filament keeps feeding in perfectly well: each detector watches a single physical quantity and only sees the failures that change it.

1Filament runout sensorfilament present or not2Chamber camerathe shape on the plate3Filament motion sensorwhether the filament moves4Extruder force sensorhow hard it is to push5Hotend thermistorheater block temperature6Motor encoderrotation of the motor shaft7Nozzle camerathe nozzle tip8Door sensordoor open or closed9Power-loss detectionsupply voltage drop
Where each detector sits and what it watches. Each one only sees what happens in its own part of the machine.

Each sensor measures one thing

A current printer is good at catching the end of the spool, a hard clog the extruder cannot push through, a broken thermistor and obvious spaghetti, though with false alarms. It is poor at catching, or blind to, a partial clog that gets slowly worse, a part that warps without coming loose, a color in the wrong place, a part that is off-size, or delamination. Detection shortens a failure. It does not prevent it, and it never diagnoses it.

To understand any detector, ask it three questions. What quantity does it measure: filament presence, filament movement, force at the extruder or motor load, rotation of the motor shaft, temperature, or pixels? Where is it? How long does it take to raise the alarm once the failure starts?

Location matters because a sensor only sees what happens in its own zone. A runout switch next to the spool cannot see a clog at the nozzle. An encoder on the motor shaft cannot see a belt skipping teeth on the pulley, because the pulley comes after the sensor (Rails, belts and motors). A camera at the top of the chamber cannot see inside the hotend.

Timing matters too: every minute between the start of a failure and the pause costs filament and hours. A detector that reacts in seconds and one that reacts twenty layers later are different products, even if both "detect spaghetti".

Filament: runout, movement, tangles and clogs

Runout sensor. A lever on a microswitch, an optical gate or a Hall sensor. Its output is yes or no: filament is there or it is not. The sensor in Prusa's Nextruder, for example, is a Hall sensor that reads the position of a ball pressed against the filament by a spring. If you fit one yourself, put it before the extruder and far enough back that the tail of the filament still reaches the gears: the firmware then pauses, parks the head and lets you load the next spool without leaving a gap in the part. In Marlin that pause is M600; in Klipper, PAUSE. On machines such as Prusa's or Bambu's the sensor sits in the toolhead itself, directly above the gears, and the machine unloads the tail at the change.

Presence is not enough. A clog, filament chewed by the gears or a crossed wrap on the spool all leave filament in front of the switch. The switch reports "filament present" while nothing moves.

Filament motion sensor. A wheel that turns with the filament gives a pulse every few millimeters, and the firmware compares the pulses with the extrusion it has commanded. BTT's Smart Filament Sensor V2 gives one pulse every 2.88 mm of filament. In Klipper, [filament_motion_sensor] raises the alarm if no pulse arrives within detection_length millimeters of commanded filament.

Here is the trade-off every detector shares. A short length catches failures sooner but gives false alarms on retractions and short moves. A long one gives fewer false alarms but lets several millimeters pass without extrusion before it trips. So you set it well above the distance between two pulses, and higher the further the sensor sits from the extruder. This sensor catches a hard clog, an extruder that grinds the filament instead of pushing it, and a tangle. It does not catch a partial clog that still lets the filament advance.

Tangle sensor on filament switchers. In Bambu's toolhead, a module with a Hall sensor trips when the filament resists feeding too much. Bambu warns that it does not work with every filament (not with TPU, TPE or PVA), and a PTFE tube that is loose, too long or sharply bent will trip it without any tangle. Switchers also time or measure each stage of the change, and the error tells you which stage failed (Multi-material failures).

Force and load at the extruder. Some extruders sense how hard it is to push the filament, with a force sensor or by having the firmware watch the motor load. On the H2 series, Bambu detects air printing (the nozzle moves but no plastic comes out) by combining the nozzle camera with extruder data.

Nozzle clump probing. The H2D also has a contact check: at layers 4, 11 and 20 it brings the nozzle down to touch the plate, and a clump on the tip changes its probe reading. It ships switched off and you enable it in the process settings in Bambu Studio. It does not work with spiral vase or print-by-object, and Bambu warns that it is not infallible.

No filament sensor reliably sees a partial clog or under-extrusion that worsens little by little. If a clog still lets 70 % of the flow through, everything looks normal to the switch, and to the motion sensor too if its detection length is generous. Extrusion problems covers how to diagnose it.

force sensorspoolpresence switchmotion wheelextruder gearsnozzlefilament runoutclog at the nozzlepartial clog, slow feedtangle on the spooltripsstays quiet
The same filament path with four failures. The partial clog does not change the state of any sensor: the filament keeps moving, only more slowly.

Temperature, door and power: what your printer already has

The hotend thermistor is the oldest failure detector, and it watches two things. If the thermistor breaks or comes unplugged, the reading drops to an impossible value or shoots up, and the firmware stops at once (the MINTEMP and MAXTEMP errors). Thermal runaway protection goes further: it checks that the temperature rises as it should for the power the heater is getting and that it does not drift from the target, and it halts the machine if not. That catches a thermistor that has slipped out of the block or a dead heater. What it does not catch is a thermistor that is slightly loose, reads a few degrees low but still follows the trend: the block overheats without anything tripping, and you see it in the plastic. It is a safety feature; Fire risk and unattended printing shows how to check that it works.

A 100 kΩ NTC works well up to about 285–300 °C; for 400 °C or more you need a PT1000, a PT100 or a thermocouple. A thermistor at the edge of its range gives noisy readings and throws "Heating failed" errors with nothing actually broken (Hotends and how much they can melt).

The door or lid sensor tells the firmware the printer is open. Some machines only warn you; others refuse to start a technical material with the door open (Enclosures and heated chambers).

Power-loss recovery. The firmware saves its place in the file and the Z height, and when power returns it offers to carry on. Prusa's Power Panic detects the drop through a signal from the power supply and saves the state with no batteries or UPS; after a very brief outage it resumes on its own. It does not trigger if you turn the printer off at its power switch. On Bambu printers, such as the A1, P1 and X1 series, recovery is on by default. Klipper has nothing equivalent built in; there are third-party macros.

What defeats recovery is the bed. During a long outage it cools from its 55–60 °C (PLA) or 90–110 °C (ABS), the part shrinks and loosens or comes free. Prusa warns you that the bed has cooled and asks you to check the part before continuing. With PLA a short outage usually resumes cleanly; with ABS or a large part, expect a visible seam or a loose part.

A UPS does not recover from an outage; it rides through it. Choose a pure sine wave model: many power supplies react badly to the stepped waveform of cheap UPS units. Size its power rating (VA/W) for the printer's rated power, not its average draw: the bed holds its temperature by switching on and off at full power, and for an AC bed that is hundreds of watts, sometimes more than a kilowatt, even when the average is low. A DC bed does the same to the power supply. The average draw only sizes the battery, and it only needs to last a few minutes, which is how long most outages last; if the bed loses a few degrees in that time, the part survives it.

Motors: lost steps

As of late 2026 most printers still use open-loop stepper motors: the board counts the steps it has sent, not the steps the motor has taken. If the head crashes and the motor loses steps, the board does not know unless something else detects it. There are two ways to catch it:

  • From the motor load, sensorless. Prusa's firmware on the CORE One, MK4S and XL detects repeated crashes and asks whether you want to continue or pause. It only works in normal mode: Stealth mode disables it. Bambu offers "Auto-recovery from step loss", which also reads the motor load: it re-homes, repositions the head and carries on. Its documentation recommends enabling it if you suffer layer shifts, and it trips falsely if you print close to the acceleration limit.
  • With an encoder on the shaft. Closed-loop motors, such as those on the Creality K2 Plus, correct small losses and stop on a hard crash (Rails, belts and motors).

Both look at the motor shaft. A belt skipping teeth or a pulley slipping on the shaft sits after it, out of their reach. And resuming does not remove the curled edge or the obstacle that caused the crash (Layer shifts and spaghetti).

Cameras and AI detection

The principle is simple. A camera takes a picture every few seconds, and a neural network trained on photos of failed prints scores each picture on how much it looks like a tangle of strands. Above a threshold, the printer warns you or pauses. In built-in systems the network runs on the printer itself; in webcam services, on a server or on a small computer next to the printer, such as a Raspberry Pi.

A camera can sit in two places, and each has its own job. The chamber camera sees the whole plate: spaghetti, a part knocked over, a forgotten object, the wrong plate. A nozzle camera sees the tip: a clump around it, filament that is not coming out. Machines such as the Bambu H2D carry both: the nozzle camera watches for clumps, air printing and spaghetti; the chamber camera for spaghetti, foreign objects, the plate and the hotend type. The P2S has only a chamber camera, and uses it to watch for spaghetti, foreign objects, nozzle clumps, the plate type and the silicone sock on the heater block; with no nozzle camera, it cannot see air printing. Creality's K2 series uses an AI chamber camera for spaghetti and objects on the plate. On others, such as Bambu's A1 and A1 mini, the camera is only for remote viewing and recording the timelapse.

Any printer with a webcam can use an external service. Obico is open source and you can host it on your own server; it works with OctoPrint or Klipper (Moonraker) and pauses the print. SimplyPrint analyzes the camera images and pauses or cancels on its paid plans, with a few free hours a month. A service can only pause a printer it is connected to: Obico needs OctoPrint or Klipper in front of the machine.

Bambu lets you enable each detector separately and set its sensitivity from the screen. The trade-off is the same as with the motion sensor: at high sensitivity it catches failures sooner and pauses more often for no reason; at low sensitivity it pauses less and lets the nest grow bigger.

What fools the camera, and why:

  • Black or very dark filament. It contrasts poorly with the nozzle and the shadows. Bambu's own wiki says spaghetti detection may not work well with it.
  • The camera light switched off. Without the LED, at night, the picture loses detail and detection gets much worse; Bambu recommends leaving it on.
  • A textured or reflective plate, or direct sunlight from a window. They create a texture the network reads as strands.
  • Translucent filament. It barely stands out from the background.
  • Geometry that looks like a tangle without being one. Tree supports, lattices, fuzzy skin or large overhangs.
  • A dirty or fogged lens.

And there are things the camera cannot see by design: a correct color in the wrong place (Multi-material failures), a part 0.3 mm undersize, weak layers, a corner lifted by a millimeter. It sees the overall silhouette; the rest is for your eyes and your callipers.

Before the first layer: pre-print checks

The cheapest detection is the one that stops a print before it starts. The camera reads a code on the plate and compares its type with the one in the sliced file; with older plates that have no code you have to press "Ignore" or switch the check off. Foreign object detection looks for a tool, an earlier part or a forgotten purge on the plate. Some machines also check that the fitted hotend or nozzle matches the one in the file. If your machine has these checks, leave them on: the wrong plate means the wrong adhesive or temperature, and a first-layer failure you do not see coming.

Some machines, such as Bambu's X1 series, inspect the first layer and the flow calibration lines with a micro lidar. In practice it catches gross defects: a patch with no plastic, a missing line, a clump. It does not tell you whether the first layer is a few hundredths too squashed, and it does not level: the probe does that (Bed probing and Z offset). More recent machines, such as the P2S, do not have it.

The first layer is still your job: stay and watch all of it before you walk away. A dry spool, a clean plate and a first layer you have watched prevent more failures than any detector. The first layer and bed adhesion covers what to look for.

What each detector sees

Which failure each detector catches (● catches it · ◐ sometimes or late · — no)
Failure Runout Motion or force Motor or other Camera If no sensor catches it
Spool runs out ● ● — ◐ as air printing, with a nozzle camera —
Hard clog or grinding extruder — ● — ◐ as air printing —
Partial clog, slow under-extrusion — ◐ at best — — You, in the walls: Extrusion problems
Tangle on the spool — ● (plus the switcher's tangle sensor) — — —
Part comes loose and spaghetti follows — — — ● —
Layer shift — — ◐ step loss or closed loop ◐ only if it ends in spaghetti Layer shifts and spaghetti
Clump around the nozzle — — ◐ clump probing ● with a nozzle camera, ◐ with a chamber camera —
Corner lifting — — — ◐ only if it comes loose You: Warping and lifting corners
Wrong color or failed purge — — — — You: Multi-material failures
Wrong dimensions or weak layers — — — — Coupons: Test coupons
Broken or unplugged thermistor — — ● MINTEMP, MAXTEMP, thermal runaway — —
Thermistor reading wrong but plausibly — — ◐ — You: burnt plastic or odd extrusion
Power cut — — ◐ recovery, ● UPS — —

When an alert goes off

diagram
Look before you resume. If the failure is real, you almost always cancel; if it is false, adjust only the detector that got it wrong.
  1. Look before you resume. Use the live view or the alert snapshot. A paused printer costs nothing; resuming on top of a nest of spaghetti does.
  2. If the failure is real, cancel, almost always. The cause (the loose part, the curled edge, the clog) is still there. Resuming makes sense after a clean runout or a power cut.
  3. If it is false, resume and note what fooled it: dark filament, the plate, the geometry.
  4. Lower that detector's sensitivity, or switch it off only for that kind of job, if it gives false alarms again and again. Do not switch off all detection, and turn it back on when you finish.
  5. Clean the lens. If your machine offers camera calibration, run it after moving or replacing the camera.

Turn on phone notifications: a pause nobody sees is no use. Cutting power remotely is a safety tool, not a detection one (Fire risk and unattended printing). In a farm, a failed job has to stop that printer's queue (Print queues and print farms).

When it fails

When detection fails
Symptom Cause Fix
The camera pauses for spaghetti that is not there Black or translucent filament, a reflective plate, the LED off, tree supports or fuzzy skin Turn the LED on, clean the lens and lower that detector's sensitivity for that job only
The motion sensor trips with no clog Detection length too short for the retractions Raise detection_length well above the distance between two pulses
The tangle sensor trips with no tangle A loose, long or sharply bent PTFE tube; or TPU, TPE or PVA Shorten and straighten the tube; with those filaments, switch it off
Thin walls and gaps and nothing trips A partial clog: the filament still advances Diagnose it by hand (Extrusion problems)
Layer shifts with no warning A belt skipping teeth after the encoder, or Stealth mode on Check belts and pulleys (Layer shifts and spaghetti)
The board resets even with a UPS A stepped-wave UPS, slow to switch over or sized for the average draw Pure sine wave, sized for the printer's rated power
After a long outage, a visible seam or a loose part The bed cooled and the part shrank With ABS or large parts, cancel; with PLA and a short outage, resume

How to test it

Test each detector once, with a small print you do not mind losing:

  • Runout. Cut the filament above the sensor and check that the printer pauses, parks the head and resumes without leaving a gap in the part.
  • UPS. A UPS that is slow to switch over can still reset the board. With the printer running and the bed heating, unplug the UPS from the wall and check that the print carries on.

See also

Design it in KapyCAD

Design parts sized for your printer and your nozzle.

Free plan, no card. Runs in your browser, nothing to install.

Open the editor

Still have a question?