Help with filament runout sensor in Octoprint-Enclosure

I am tearing out my hair with this, so any help would be greatly appreciated.

I finally got the parts in yesterday to build a runout sensor, and figured this would be a pretty quick upgrade... Just slap the parts together, add a couple of soldered joints and done... Nothing could be further from the truth. So if anyone has an idea on what I am doing wrong I would really appreciate it.

The set up so far:

  1. A microswitch wired to read continuity when the filament is installed (just two wired).
  2. One leg is connected to the pi's GPIO Pin 21, the other to ground.
  3. The settings for octoprint-enclosure:

a) Input type - GPIO input

b) Action Type - Printer

c) Input IO Number 21

d) Input Pull Resistor - Input Pulldown

e) Event trigger - Fall

f) Printer action - Filament change

g) Enabled (checked)

The expected response is that when the sensor trips the printer stops and moves to XY home for a filament change. The actual response is that Octoprint pauses any attempt to print as soon as the command is given. The only way to actually start a print is to disable the plugin. This behavior is independent of if the filament is inserted or not.

I am not tied to the enclosure plugin if someone is failure with a working runout plugin, there seem to be a good number of them, but since I am working on an enclosure I figured learning this one would be worth doing now anyway.

Try setting the event trigger to Rise and the resistor to Pullup.

Your normally closed switch will ground the GPIO pin, then when the filament runs out it will open and the pin will go high (rise).

1 Like

Thank you very much for the help. Stupid user error seems to be at faulty, and the sensor now seems to be working correctly.

Any thoughts on the Gcode? What was there just seemed to randomly do stuff and on restart would start 20mm above the bed. I removed what was there and replaced it with just M600. Which seems to work reasonably well, except for two issues

  1. On restart I often have to go thru the load/unload process a few times. Its like it ques up M600 commands one after the other until filament is reinstated then has to cycle thru all of them before actually starting to print.

  2. There seems to be a delay from when the filament is removed and the printer stops. Then when it starts printing it looks like there is a small line between the old and new material. Any thoughts on minimizing this interruption?

Sorry, can't be much help here. My filament sensor is run by the mainboard (SKR 1.3) and my pause/resume scripts in OctoPrint are stock.