Filament run out sensor manual switch octoprint plugin filter

by brotherchris, published

Filament run out sensor manual switch octoprint plugin filter by brotherchris Feb 9, 2017
0 Share
Download All Files

Thing Apps Enabled

Order This Printed View All Apps


Liked By

View All

Give a Shout Out

If you print this Thing and display it in public proudly give attribution by printing and displaying this tag.

Print Thing Tag

Thing Statistics

2777Views 176Downloads Found in 3D Printer Accessories


This filament run off switch uses the Octoprint plugin filament sensor software (not the reloaded one). This is running on a raspberry Pi 3. I use a manual switch that I took the roller off of and bent the head forward to give the filament more room to glide over. It is some what of a sharp edge, but it seems to work just fine.

Filament sensor reloaded plugin, the one in the video:
All you have to do is cable up to the 18 and 20 pins, 24 GPIO and ground. The code uses the internal pull up sensor, so you should be good.

Old filament plugin, kinda unpredictable.:
I use a pull down resistor, with physical pins 1 3.3v, 6 ground, 32 gpio 12 in this config. See jpg for .octoprint/config.yaml file and wiring diagram. On octoprint command line enter gpio read 26 to check pin status, 1 will be filament there, 0 is filament gone.

I will be added some more housing options soon.

Video here: https://youtu.be/ChjwIGxnivw

Added a sensor 3 file, tweaked it a little to keep the filament a little straighter.

Switch link http://www.ebay.com/itm/5-Pcs-Micro-Limit-Switch-Metal-Roller-Arm-Subminiature-SPDT-Snap-Action-LOT-/321356308879?hash=item4ad254218f

Old plugin:
Octoprint plugin link: http://plugins.octoprint.org/plugins/filament_sensor/

New plugin:

Print Settings


Geeetech prob










I added an optional screw on switch cover. Switch fits pretty tight without it.

More from 3D Printer Accessories

view more

All Apps

Auto-magically prepare your 3D models for 3D printing. A cloud based 3D models Preparing and Healing solution for 3D Printing, MakePrintable provides features for model repairing, wall thickness...

App Info Launch App

Kiri:Moto is an integrated cloud-based slicer and tool-path generator for 3D Printing, CAM / CNC and Laser cutting. *** 3D printing mode provides model slicing and GCode output using built-in...

App Info Launch App
KiriMoto Thing App

With 3D Slash, you can edit 3d models like a stonecutter. A unique interface: as fun as a building game! The perfect tool for non-designers and children to create in 3D.

App Info Launch App

Print through a distributed network of 3D printing enthusiasts from across the US, at a fraction of the cost of the competitors. We want to change the world for the better through technology, an...

App Info Launch App

Quickly Scale, Mirror or Cut your 3D Models

App Info Launch App

3D Print a wide range of designs with Treatstock. Easy to use tools to get the perfect result. The global 3D printing network that connects you with high-quality and fast working print services nea...

App Info Launch App

I cant seem to get the pi to recognize the switch using 18 and 20 like in the video. Any steps missing beyond connecting the switch to those two pins?

octoprint.plugin - ERROR - Error while calling plugin filamentreload
Traceback (most recent call last):
File "/home/pi/oprint/local/lib/python2.7/site-packages/OctoPrint-1.3.4-py2.7.egg/octoprint/plugin/init.py", line 229, in call_plugin
result = getattr(plugin, method)(*args, **kwargs)
File "/home/pi/oprint/local/lib/python2.7/site-packages/octoprint_filamentreload/init.py", line 113, in on_event

Either will work. You have to use 3 pins and a pull down if you use the filament sensor plugin. You can use just 2 if you use the filament sensor reloaded plugin. It looks like there is an issue with the plugin. I will check on mine and make sure it is working.

smoothieware on the mks sbase has an option for filament runout sensor. do you know if octoprint will freak out if the controllers runout sensor option is used?

I am not sure what it will do, but yes, I think octoprint will get lost and not know what to do.

I am using the reloaded plugin but when i do gpio read all or after starting a print using the the tail -f thing you show in the video I do not get a toggle on the gpio 24. Is there any other configuration needed for that beyond shorting pin 18 and 20?

That should be all you need to do. It looks like a software problem. Have you tried reinstalling the plugin? How about a hard reboot of the Pi? What does the output of this command look like? cat .octoprint/config.yaml

Before I worry about the plugin i guess i need to just simply get the pi to see the 18 and 20 pin shorting ya? If i understand right this should show up on gpio readall command or am i incorrect there?

Ya plugin has been removed and reinstalled. It has been soft booted but ill try a hard boot next.

You should see
2017-09-23 19:22:22,548 - octoprint.plugins.filamentreload - INFO - Filament Sensor Reloaded started
2017-09-23 19:22:22,549 - octoprint.plugins.filamentreload - INFO - Setting up sensor.
2017-09-23 19:22:22,550 - octoprint.plugins.filamentreload - INFO - Using BCM Mode
2017-09-23 19:22:22,551 - octoprint.plugins.filamentreload - INFO - Filament Sensor active on GPIO Pin [24]

in cat .octoprint/logs/octoprint.log when the pi reboots.

You should see the 18 | 1 | IN | GPIO. 5 | 5 | 24 |
flip from 0 to 1.

i always get this 18 | 0 | IN | GPIO. 5 | 5 | 24

Yah, that doesn't appear to be happening. I can measure with the meter though that the switch is acually working at the connector

[email protected]:~/.octoprint $ tail -f config.yaml
stream: /webcam/?action=stream
fps: 25
capturePostRoll: true
interval: 10
postRoll: 0
type: timed
watermark: false

Lets see the whole file, cat config.yaml.

You are actually dealing with GPIO pin 5.

gpio read 5
gpio mode 5 up
gpio mode 5 down

Use these commands to set the internal pull up and down resistor for testing.

So i thought using the commands you listed would cause the print to pause but it does not. gpio mode up causes a 1 to display and down causes a 0 to display.
when trying to run those during printing nothing happens.

it might list using N/C switch but that was just at the time i grabbed it. I have it set to N/O as you do and also the switch is wires N/O


Not sure, you might have conflicting plugins. Try uninstalling a few then try installing filament reloaded. Some of them might be stepping on each other.

I switched from BCM to board and it seems to have helped. need to do some more testing. thanks for the help

The last line of this concerns me. Any idea what its talking about setting up the GPIO channel?

octoprint.plugin - ERROR - Error while calling plugin filamentreload
Traceback (most recent call last):
File "/home/pi/oprint/local/lib/python2.7/site-packages/OctoPrint-1.3.4-py2.7.egg/octoprint/plugin/init.py", line 229, in call_plugin
result = getattr(plugin, method)(*args, **kwargs)
File "/home/pi/oprint/local/lib/python2.7/site-packages/octoprint_filamentreload/init.py", line 89, in on_event
if event is Events.PRINT_STARTED and self.no_filament():
File "/home/pi/oprint/local/lib/python2.7/site-packages/octoprint_filamentreload/init.py", line 81, in no_filament
return GPIO.input(self.pin) != self.switch
RuntimeError: You must setup() the GPIO channel first

My guess is something is wrong in the config.yaml file.

Brotherchris I was wondering are the resistors, and the green wire attached to the other end of the wire with the shrink rap connected to the center pin on the micro switch?

They are connected to the outer pin on the switch. They are soldered together on the wire. I added a rough drawing to the post.

Ok thanks i just wanted to make sure before i did this wrong and it didn't or fried the pi.