Loading
brotherchris

Filament run out sensor manual switch octoprint plugin filter

by brotherchris Feb 9, 2017
Download All Files

Thing Apps Enabled

Please Login to Comment

Hello, thank you for your wonderful Tutorial. Is it possible to use a 3 Pin Sensor like this here?

https://www.amazon.de/BIQU-Filament-Erkennungsmodul-Rundlauf-erkennen/dp/B0748D1549/ref=sr_1_2?ie=UTF8&qid=1531297813&sr=8-2&keywords=filament+sensor

Thank you in advance

It should work the same way for both.

Yes I think you can. You might not need the 5v line. You would probably have to divide up the wires on the plug to get them on the correct pins.

Thanks for your answer. Can you also help me with this (see picture) I install the plugin, want to open it, but the page just stays white. Do you have any idea what might be the cause? Thank you so much

PS: Im using Pi3 b+.

Well that's not good. Login to ssh and see if there are errors in /var/log/messages you rebooted correct?

A friend of mine has the same problem with his octoprint. I'm afraid it's almost the latest Raspberry version. Yes i rebootet correct. I also have the problem that I don't have a power off button or restart button above. I don't know why:( I restarted with sudo reboot

Comments deleted.

You can use any ground pin on the Pi you like, there are lots available.

I was thinking of keeping my CR-10S filament sensor but creating a new cable for it to plug into my Pi so I could use the octoprint filament sensor reloaded plugin. The CR-10S filament sensor has Vcc (V), Gnd (G), and Signal (S). I noticed when the switch is in the OPEN mode (no filament), V=5V, and S=5V, but when the switch is CLOSED (filament present), S=0V (and the blue LED turns on - which I like as a nice visual). How would I wire this up to the Pi so the plugin works and the LED still turns on when filament is present?

I noticed that when using Octoprint, it overrides the filament sensor (ie: the CR-10S control box does not recognize if filament is present or not, it just prints). So I was thinking of just creating a new cable and plugging it into the stock CR10S filament sensor when using Octoprint and I could always pull the cable out and put the stock cable back in if I'm printing from a microSD card.

I haven't seen that switch, but I am guessing its a micro switch on a board that has some logic on it. You should be able to use it just fine. With this config you are just using the switch to pull the pin down to ground or up to voltage so you should be able to just unhook it and cabled to the gpio pin and it should work. You just don't want to feed any voltage to the Pi GPIO, you want to use the voltage provided by the Pi instead.

That's what I thought. 5V from Pi GPIO to the V pin of the stock switch, GND from Pi GPIO to the G pin of the stock switch, and then the S pin of the stock switch would go to the Pi GPIO 24 pin (or other one that gets defined in the plug-in). Great. Thanks.

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
GPIO.remove_event_detect(self.pin)

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

pi@octopi:~/.octoprint $ tail -f config.yaml
snapshot: http://127.0.0.1:8080/?action=snapshot
stream: /webcam/?action=stream
timelapse:
fps: 25
options:
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.

config.yaml
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

https://pastebin.com/tfyWtnjG

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.