Implementing a filament motion sensor for the Core One
 
Notifications
Clear all

Implementing a filament motion sensor for the Core One  

  RSS
hyiger
(@hyiger)
Noble Member
Implementing a filament motion sensor for the Core One

Started to get annoyed with ruined prints caused by filament tangles and nozzle clogs. I thought: "Why doesn't the Core One have a way to detect this?" The Buddy Board (and Marlin) have only filament runout detection (as far as I'm aware). 

So I picked up a BTT SFS V2.0 Smart Filament Sensor for $14 USD. It has 2 sensors. A filament run-out switch and a motion sensor. These are split out with 2 signals, both active high with the run-out signal active high and the motion sensor a square wave also active high, both 3V3 logic levels. The sensor itself can be powered from 5VDC or 3.3VDC. So to test this out I plugged it into the GPIO header of my RasberryPi 5 running OctoPrint. The run-out detection on GPIO 27 and the motion detection on GPIO 26

The device itself inlines nicely onto the end of the Bowden 

There is an OctoPrint plugin: Octoprint-Filament-Motion-Sensor which is supposed to send a pause to the printer when it detects the filament is not moving. Testing the plugin appears to work. But it keeps shutting itself down. I've only started playing around with it but I may end up having to write my own. 

 

 

 

 

Posted : 20/12/2025 10:06 pm
1 people liked
hyiger
(@hyiger)
Noble Member
Topic starter answered:
RE: Implementing a filament motion sensor for the Core One

I'm using a Raspberry Pi and OctoPrint for prototyping but I doubt people will necessarily want to spend the time and money needed to fully set this up. Once I get something working I'll move it over to a dedicated microcontroller add-on. At the moment, thinking about the best way to interface it with the printer. I keep coming back to just attaching it to the serial port. 

  1. A microcontroller that supports serial over USB-C. Both the controller board and sensor can be powered from the USB-C serial interface on the printer. 
    1. Ideally both the sensor and controller are in the same housing with a single USB cable back to the printer. 
  2. Missing pulse detector automatically configurable by current print speeds (can query this over the serial interface) 
  3. Sends a pause/filament change command to the printer: M600 (I would assume)
  4. Monitor the serial connection and when printing resumes reset the detector

 

Posted : 20/12/2025 10:30 pm
2 people liked
Geoff Steele
(@geoff-steele)
Trusted Member
RE: Implementing a filament motion sensor for the Core One

Am I right in thinking it goes on the static spool end rather than the print head due to size/weight that would be added to the moving part? Or is that a specific limitation of the sensor? 

Reason for asking is the use case with INDX / MMU

Posted : 20/12/2025 11:18 pm
hyiger
(@hyiger)
Noble Member
Topic starter answered:
RE: Implementing a filament motion sensor for the Core One

 

Posted by: @geoff-steele

Am I right in thinking it goes on the static spool end rather than the print head due to size/weight that would be added to the moving part? Or is that a specific limitation of the sensor? 

Reason for asking is the use case with INDX / MMU

I would think the best place to mount it would be closest to the spool. It could theoretically be mounted above the printhead but I'm not sure there would be enough clearance for the Bowden tube and the lid. In the case of the MMU (which I'm not familiar with) I suppose it would need to be mounted just after it demultiplexes into a single Bowden. I suppose for an INDX system you would need N copies, 1 for each head. 

Anyway, still at the very early stages of playing around with it. 

Posted : 21/12/2025 12:59 am
1 people liked
hyiger
(@hyiger)
Noble Member
Topic starter answered:
RE: Implementing a filament motion sensor for the Core One

I also thought about attaching it to the side sensor cabling but then I would need somewhat to signal back to it in order to enable and reset. Could use the GPIO board for this but seems a bit complicated. Prefer to avoid having to inject custom g-code in the slicer if possible. 

Posted : 21/12/2025 1:02 am
NickAtNight
(@nickatnight)
Reputable Member
RE: Implementing a filament motion sensor for the Core One

Interesting concept.   

Have you thought of some way to use the camera to detect for a failed print?   Such as:
   - if the model detaches from the base.
   - or if stringing starts

Posted : 21/12/2025 1:16 am
hyiger
(@hyiger)
Noble Member
Topic starter answered:
RE: Implementing a filament motion sensor for the Core One

 

Posted by: @nickatnight

Interesting concept.   

Have you thought of some way to use the camera to detect for a failed print?   Such as:
   - if the model detaches from the base.
   - or if stringing starts

Yep, the easiest way to implement that is to buy a Bamboo labs printer. 

Posted : 21/12/2025 1:34 am
hyiger
(@hyiger)
Noble Member
Topic starter answered:
RE: Implementing a filament motion sensor for the Core One

Making progress. Wrote a Python script to enable the sensor and reset the watchdog timer on layer change then it will send a change filament command M600 to the printer when it detects the filament hasn't moved in 5 seconds. Next is to figure out how to vary the missing pulse detection based on the print speed. Will translate this over to an ESP breakout board that arrives tomorrow. 

$ sudo python3 detect_snag.py 
SFS V2.0 Monitoring on GPIO 26...
Filament Speed: 0.00 mm/s
Filament Speed: 278.50 mm/s
Filament Speed: 323.42 mm/s
Filament Speed: 283.66 mm/s
Filament Speed: 159.78 mm/s
Filament Speed: 278.52 mm/s
Filament Speed: 78.04 mm/s
Filament Speed: 0.00 mm/s
Filament Speed: 0.00 mm/s
Filament Speed: 0.00 mm/s
Filament Speed: 0.00 mm/s
!!! FILAMENT JAM DETECTED !!! Sent M600. Printer Paused.
Filament Speed: 0.00 mm/s
Filament Speed: 0.00 mm/s
Posted : 21/12/2025 6:25 am
hyiger
(@hyiger)
Noble Member
Topic starter answered:
RE:

In case you are wondering above why the filament speed is erratic, I was pulling it by hand through the sensor to test. I'm in the process now of building a small controller board and single housing for the unit. I'm also thinking about how this would work in an INDX setup. That will be for later. 

Posted : 21/12/2025 5:39 pm
2 people liked
newprinter
(@newprinter)
Active Member
RE: Implementing a filament motion sensor for the Core One

keep us posted! this looks interesting

Posted : 01/01/2026 9:41 am
gb160
(@gb160)
Honorable Member
RE: Implementing a filament motion sensor for the Core One

Can it detect super slow extrusion mate? like when ironing ?

Posted : 01/01/2026 2:49 pm
hyiger
(@hyiger)
Noble Member
Topic starter answered:
RE:

 

Posted by: @gb160

Can it detect super slow extrusion mate? like when ironing ?

It can. I'll give a big update later today after a solve an interesting bug. But it's basically working. You can check out the project here: Filament Monitor It's in what I would call a "working prototype" state. Currently you need a Raspberry Pi connect to the printer's serial port. I'm working on shrinking down onto an ESP32 stamp. My goal is to have it completely replace the side filament sensor. At the moment it can detect filament jams, run-outs and is immune to slow extrusion (e.g. ironing). Here is an example of a run where I started a print then when it was extruding, grabbed to filament to simulate a jam:

 $ ./filament-monitor.py --config config.example.toml 
filament-monitor 1.0.4
For Generic Marlin-compatible printer
[2026-01-01 00:04:05] startup version=1.0.4 port=/dev/ttyACM0 baud=115200 motion_gpio=26 runout_gpio=None runout_active_high=False arm_min_pulses=12 jam_timeout_s=8.0 pause_gcode=M600 verbose=False
[2026-01-01 00:09:06] reset
[2026-01-01 00:09:06] enabled
[2026-01-01 00:09:06] armed
[2026-01-01 00:09:46] pause_triggered reason=jam
[2026-01-01 00:09:46] gcode_sent gcode=M600

Have a look at the projects README for details. It's still very much a WIP. I need to figure out a clean way to rearm it after clearing a filament jam. There is no easy way to do this on a Prusa printer. I might try for a manual push button for now. 

Quick note, this script also runs a service so when the Pi boots up will automatically be setup for monitoring. 

 

Posted : 01/01/2026 3:46 pm
1 people liked
hyiger
(@hyiger)
Noble Member
Topic starter answered:
RE: Implementing a filament motion sensor for the Core One

The prototype is completed and tested over 10 hrs. It requires a RaspberryPi connected to the printer's USB-C serial port. If you plan to implement this, please read through the documentation first: README . The code should work (in theory) with any pulsed filament sensor and Marlin based printer. I've only tested with a Core One and the BTT SFS v2.0 sensor. 

What it does:

  • Monitors filament movement, if there is a stall greater than the timeout period, send M600 (pause and replace filament) to the printer over the serial line
  • Monitors filament runout - this is off by default. Eventually this will replace the side sensor

Limitations

  • Does not automatically rearm after a filament snag or runout. This is due to the fact that Prusa does not echo g-code extruder movement over the serial wire. There is a manual rearm that can be done by sending a command to the monitor or wiring a physical pushbutton. See documentation for details
  • Currently only works with a Raspberry Pi connected to the serial port. Next version will be on a dedicated ESP32 stamp

Future Enhancements

  • Dedicated microcontroller board with small form factor
  • Will create a custom sensor that fits inside the current side filament sensor housing as a direct replacement. Will still require a serial port connection. 

 

Posted : 04/01/2026 6:06 pm
1 people liked
Share: