Need Plugin for Smart Filament runout sensor

BIGTREETECH has a smart filament runout sensor that watches for movement of the filament not just if the filament is present so when the filament is moving it sends pulses. This sensor is designed to be wired to the printers main board and when the printer is printing and no longer receives pulses due to jam or filament runout Marlin sees this and pauses print. The problem is that Octoprint has no way of knowing this has happened and just keeps sending gcode.

  1. if the sensor could be wired to a GPIO pin on the raspberry pi and a plugin that would watch for pulses coming from this sensor which could then send the pause command when a pulse has not been seen in a configurable amount of time.

  2. Not sure if a plugin could be made to monitor if the pause command has been sent when the sensor is instead connected to the control screen of the printers main board like it is intended to.

There may be some way to incorporate Action Commands so that your firmware is indicating what's going on back to OctoPrint. Then a plugin could see that and do whatever. But maybe I've gotten this backwards, I've not used that.

In theory, though, Marlin pauses the print and says something back to OctoPrint at this moment.

This was an interesting read.

Agreed, if marlin is configured to send action commands it should pause octoprint.

I'm still waiting on my touch screen from BIGTREETECH (it's on the slow boat) and the filament sensor but am already running the SKR 1.4v Turbo. With my research that I have done the sensor gets connected to the touch screen which then sends gcodes to the board via one of the serial ports. When the filament sensor detects that the filament has run out or has stopped moving for a period of time (filament jam) the touch screen sends a gcode to marlin to initiate an "Advanced Pause" which is under Configuration_adv.h . I am not sure what the code is exactly but it looks like it is M600 and then M125 to pause the printing and park the nozzle.

Check this thread....

1 Like

ok so I just added a couple of lines to Configuration_adv.h and it compiled with no errors but I'm not sure how I can test to see if it works being that I do not have the sensor or touch screen yet

 * Host Action Commands
 * Define host streamer action commands in compliance with the standard.
 * See
 * Common commands ........ poweroff, pause, paused, resume, resumed, cancel
 * G29_RETRY_AND_RECOVER .. probe_rewipe, probe_failed
 * Some features add reason codes to extend these commands.
 * Host Prompt Support enables Marlin to use the host for user prompts so
 * filament runout and other processes can be managed from the host side.
  #define ACTION_ON_PAUSE "pause"
  #define ACTION_ON_RESUME "resume"

the lines that I added because they are not part of Configuration_adv.h file anymore are the following and I hope that they are formatted correctly but since I didn't get any errors I guess they are right.

#define ACTION_ON_PAUSE "pause"
#define ACTION_ON_RESUME "resume"


Can I ask how you got on with this please?

I have a BIGTREETECH 3.5 and a filament sensor (just a detection one not a movement one)

From what I understand this sensor when connected to the screen only works if you print from the screen (via usb or sd) so if I send a print to Octoprint then the sensor will not be active?

I am quite a newbie (first post) so please bear that in mind :smiley: