Octoprint Filament Runout Sensor

Octoprint Filament Run Out Sensor

Updated: Learned alot since this post, scroll down for updated instructions

(I dont know if any one has posted this already. But it was new to me and solves a big problem with a lot of 3d printers so I’m sharing.)

Octoprint is great. I love watching my printers while I’m working. (Octoprint Anywhere pluggin). I love getting picture progress and completion reports on my phone (pushbullet pluggin). Octoprint is just awesome.

Hate almost empty spools of filament laying about because your afraid they cant finish a print?
Do you use new rolls of filament on a big prints because a half empty roll might run out before job is complete?
Or maybe you check constantly, babysitting the printer if a roll is almost finished.
Im done with that. The sensor linked below works with Octoprint to pause a print if filament runs out. Once filament run out is detected, the print head moves away from model and cools down until you change filament. (Filament Sensor Reloaded)
So then come back to printer. Heat up extruder, change filament, extrude a little, hit resume on Taz 6 and then click resume on Octoprint. Then :smiley:

The sensor has 3 wires. But you only need red and white for it to work with Octoprint:
Red > GPIO 4, which is pin 7
White > any ground pin (I used pin 6)

Octoprint gcode scripts:
After print job is cancelled -

G91; Set to Relative position
G1 E-6 F300; retract the filament a bit before lifting the nozzle
G0 Z50; move z axis up 50
G1 Y150 F5000; move part out for inspection

After print job is paused -

M600 Z50; pauses print then moves the print head up 50mm so hotend doesn't burn model

So just mount the sensor into the filament path. Connect the wires to Octoprint. Add pluggin to Octoprint. Configure pluggin and reboot Octoprint.

The sensor comes in a 3d printed case. For now I just have it in the filament path, which has worked out so far. Im a noob at designing, but someone can whip up a better implementation. Some1 on thingiverse integrated a different filament sensor into the filament tube, which is awesome.

I think this method is a lot easier than adding the sensor to the printer itself. That would involve modifying the firmware and splicing the sensor into your printers circuit board. Which is a possible warranty issue. Besides Octoprint has so any other benefits this just puts it over the top.
There isn’t anything special about the module, it’s a standard mechanical endstop housed in a 3d printed case. So you could make your own. Just a matter of positioning the endstop so a break triggers it.

Amazon on Sensor

Now using new firmware (Marlin_TAZ6_SingleExtruder_1.1.5.32_e424c92.hex)
This firmware implements advanced pause:

  • Advanced Pause
  • Experimental feature for filament change support and for parking the nozzle when paused.
  • Adds the GCode M600 for initiating filament change.

    So a few changes to post above, but for the better :slight_smile:

Filament Sensor Reloaded (pluggin page)
Pin 7
Debouce Time: 200 ms
Switch Type: Normally Open
Board Pin Mode: Board Mode
Out of filament GCODE:

M300 ; beep sound
M600 X220 Y17 Z50 ; move Z up +50, move bed to rear for easy access nozzle

Pause print when out of filament u[/u]

GCODE Scripts
After print job is paused

; M601 ; pause print

Before print job is resumed

M602 ; Resume print


Noticed sometimes the printer would get stuck in a loop. It would move down to the print to start printing then immediately pause again.

Trying to figure out the cause of this behavior.
I think it may be the debounce timing of the sensor in the reloaded pluggin
me issuing m601 in “After print job is paused” gcode scripts section.
me changing the filament b4 the 45 sec timeout to cool nozzle down

Commenting out M601 in “After print job is paused” seems to have fixed the issue.


So now “After print job is paused” is:

;M601 ; pause print
G1 E-3
G92 E0;

I’m adding a small retraction to try and combat the blob that forms as the print resumes printing. Seems to work nicely. I’ll keep tweaking and report back.

Did you mount this sensor to the print head so it won’t move? Or is it free floating?

Its free floating. Works pretty well like that.

I lack the design skills to make a mount for it. But I’m learning slowly.

Thanks for the feedback. I just received mine and will be setting it up in the next couple of days. I cannot wait.

Nvever mind, I think I found it all.

Okay, so what does your out of filament gcode look like now? I see several different areas and I am not sure where it all goes.

Do the settings & scripts you have listed work well? Do you still get the looping at times? I just installed mine and it worked great the first test I did, but then the next instance it triggered it just looped. Had to kill the print. That said, my debounce setting on this particular machine was 250 at the time. I have reset it down to the recommended 200 on both machines.

Just wanted to see if I need to be worried about the potential for looping.

I still have this issue every now and then. I don’t think it’s the firmware or Octoprint debounce. I think the filament path maybe be too loose. Maybe need a way to make sure filament is straight going into the sensor. But It actually happens on all my printers that use an endstop as the dectector. Even cr10 that has a firmware supported filament sensor, no Octoprint involved experiences this.
I wanted to try bending the little metal arm that triggers the sensor inside the housing. Was also considering changing the sensors trigger for normally closed to normally open, or opposite to how every it’s wired now. That would involve just changing the wiring on the endstop. But i never tried opening the housing of the sensor case.

OK ok for fuck’s sake. I think I found this issue. (hopefully)

Turns out “I” was creating the filament loop at the end filament change… omg. This was super frustrating. Been playing with this on and off for months.

Seems the culprit was this code in Octroprint’s GCODES Scripts section:
Before print job is resumed: M602 ; Resume print

“I” was causing the filament change to be initiated again :unamused:
So the 1st pause would be called by a real out of filament condition but then once the filament change finished Octprint executed - “Before print job is resumed: M602 ; Resume print” thus making it do the whole procedure again…thus endless loop. Seems after M600 is completed thru LCD menu, no other action is required - printer will resume print. I thought M602 was needed.

So to be clear-
Octroprints GCODES Scripts section:
Before print job is resumed: ;nothing / empty;

On another note - seems some people also have issues with false positives from endstops as filament detection sensors. So the recommendation is adjusting the debounce timing and to put a capacitor across the endstop leads to filter electrical noise.


I really appreciate your posts. We’ve run through a couple spools using your setup tips and it sure is nice to have them empty!

Glad i was able to give back and help someone

Updated Instructions

Filament Runout Sensor Pluggin setup:

;M300 ; beep i hope, worked!!
M600 X220 Y17 Z50 ; move Z up +50, move bed back to clean nozzle

leave “Pause print when out of filament” unchecked

GCODE Scripts
Leave blank now - No other commands needed as far as filament changes go
After print job is paused - “empty”
Before print job is resumed - “empty”

The wiring for the sensor is same as 1st post.

Thanks for the follow-up! I totally understand.

I am glad it is something simple. Will update my setup.

Another follow up for those following this saga,

I have been chasing the filament change loop for ages. I’ve tweaked this and that. Finally looked at the github for the pluggin. There was a issue matching the exact problem we are having:


I’m “mylife4aiurr” responding to the issue. It may help if u guys also want to pile on to the issue, maybe it will help the developer see there is interest in his pluggin.

I’m more impressed with your goblin and kontronik! I used to run the same setup, had every goblin made, lol… and basically every other 700 clas made as well… :slight_smile:

My heli’s, love them. Haven’t flown in about 3 years, ever since union strike. Didnt want to crash and no money to fix. Afterwards I’d stopped going to field. Anyway wife stays wanting me to sell or fly. I cant bring myself to sell and I feel older, slower reflexs. So they hang on the wall, neglected.

Nice. I was the president of our local helicopter club. I had goblin 500, 2 700’s and the 770. Align 600, two 700e and a 700n. 2 synergy e7’s and 2 n7’s. Avant aurora, tdr, 2 whiplashes and a gasser whiplash. I had more but I forget, lol. I was addicted and like you, haven’t flown in 3 years. Difference though is I sold all my crap. :frowning:


Nice…love the pics.
Wonder if alot of ex heli guys turn into 3d printing guys. I’ve been thinking I’d get into quads or planes because u can 3d print the chassis’s