maocypher / Octoprint-Smart-Filament-Sensor

OctoPrint plugin that lets integrate Smart Filament Sensors like BigTreeTechs SmartFilamentSensor directly to RaspberryPi GPIO pins.
GNU General Public License v3.0
13 stars 20 forks source link

Interference with other plugin #31

Open jtannenba opened 3 years ago

jtannenba commented 3 years ago

Don't know if this is a problem or just miscommunication of documentation. Have PSU set up and working just fine, then added the smart filament plugin and a sensor, now psu won't work. the Pi doesn't toggle, it appears it floats. The relay I'm using requires a low to turn off. Both plugins are set to BOARD and PSU is on pin 12 the filament sensor is on 11. If I disable the filament sensor, psu works again. Should I set one or the other to different pins?

maocypher commented 3 years ago

Hi, could you please try to uncomment the line with GPIO.cleanup in init.py? Maybe this causes it. If yes, I can fix that. A restart is needed after this

jtannenba commented 3 years ago

Where would I find this?

jtannenba commented 3 years ago

Before I saw this was trying to see if it would work if psu was board and sensor was bcm. the test seemed to work and psu worked, so tried a print with a short piece of filament to try to see if it would detect it and the nozzle parked without running out??? I Disabled it again and retried the print which completed fine.

I do all my printing through Octoprint. Love using the RaspberryPi's. I have them for file server, and Ups monitors in my house. I hope this gets fixed so I can re-install the sensor.

ChristianH99 commented 3 years ago

Removing the line GPIO.cleanup fixed the problem for me.

Follow these steps @jtannenba: Login on the pi via ssh cd ~/oprint/lib/python3.7/site-packages/octoprint_smart_filament_sensor nano init.py write an # in front of GPIO.cleanup Save with ctrl + x then y and enter Reboot pi

jtannenba commented 3 years ago

I will try this later today. I didn't realize how to get at it. What is the default login for the pi? Tried the standard pi and raspberry, but no go

maocypher commented 3 years ago

Hi thanks for the feedback, I am going to fix this in the next days.

Default login should be username pi and password raspberry

jtannenba commented 3 years ago

I'm getting access denied.

maocypher commented 3 years ago

Maybe z and y is changed on the keyboard? Sometimes by default the english keyboard is used. I have a german layout so y is a different key

jtannenba commented 3 years ago

Duh, just remembered, I changed the password when setting it up. Ok I'm in, but I had removed the plugin so the package is not there. I'll experiment later today or tomorrow, when I get some time. Thanks for your help.

jtannenba commented 3 years ago

Thank you, got it. Joe On Sunday, January 17, 2021, 06:56:54 AM MST, Anni L. notifications@github.com wrote:

Hi thanks for the feedback, I am going to fix this in the next days.

Default login should be username pi and password raspberry

— You are receiving this because you were mentioned. Reply to this email directly, view it on GitHub, or unsubscribe.

Drzet commented 3 years ago

PSU plugin has issues, I don't think your problem was caused by adding filament sensor. On quite a few occasions PSU would "forget" the pin or switch to gcode control altogether.

maocypher commented 3 years ago

@Drzet thanks for the information, do you have an issue number I can reference to? In that case I wait if there are others with the same issue, but other plugins. If not, this issue is goin to be closed in a few days

ChristianH99 commented 3 years ago

Actually PSU had the same issue some time ago: https://github.com/kantlivelong/OctoPrint-PSUControl/issues/5

There although was an issue a few months ago that PSU didn't store the GPIO pin correctly after leaving setting, but this is solved and I never had problems with PSU again.

jtannenba commented 3 years ago

I've been usng PSU since the day after I got my printer..The Monday after Christmas, and it's been working flawlessly. Getting ready to try the above fix. I hope you meant init.py and not init.py? Whoa! Underlines don't show up here!

jtannenba commented 3 years ago

Ok, PSU working again and the movement test works, but, I put a short piece of filament into the sensor and extruder (removed the bowden tube going to hotend-The sensor is in front of the extruder) and told it to print. It ran the filament completely out and nothing happened. So, what is supposed to happen? What did I miss. I didn't mess with the firmware at all. I'm using Marlin's edender 3 v2 stock firmware. Since I'm using the Pi, I still have this:Enabled Smart Filament Runout Sensor (Add M412 S0 in your Start G-Code if you do not have a filament sensor). in my start code. I believe that is only for when it is hooked into the main board? I left the settings default except changed to distance and left at 15 mm.

Edit: Removed the M412 from my start code and resliced and tried a print...Yes it paused, and when I replaced the filament it continued to cooldown till I pressed Print on printer, then reheat was done, told pi to print and it went. Is that the sequence? There doesn't seem to be any simple "this is what happens when attached to pi" instructions. Did I miss something?

Edit2: Sent a print to Octoprint from Cura and it heated up so I walked away and came back to heater time out??? It actually started the print, did the skirt then parked the nozzle and backed out the filament?? restarted and it did it again? What is set wrong? Once it's in this cycle it is hard to clear Octoprint. I get the continue message after pressing print on the printer and the continue message won't go away. Then it parks the nozzle again. (Thinks it had a jam?) Had to power down pi to get it to come back so I could try changing some settings...So far not a fan of this filament runout sensor. Changing the distance to 25 mm. This seemed to help. This time the print finished.

Sorry to be a pest, but I'm new to printers. Not really new to computers...Been doing them since 62..Just that this environment has a lot of "help" but no clear path of instruction. I didn't even know that these plugins run on Python, even though I have programmed Pi's and Arduino's, etc with python.

Thank you for your help, hope to see some sort of operation manual of using this with with smart sensor connected to the Pi.

maocypher commented 3 years ago

Hi, what should happen, if the sensor detects jams or runouts it should pause the print. After setting everything up, a configuration of the distance or Timeout might be necessary. You do not need to follow the instructions from videos about BTT sensor on the board, because this is totally different. Just the instructions in Readme.md

The plugin is implemented in python, because this is how the plugin architecture from Octoprint works. If you are interessted in more details, here is the tutorial for plugin: https://docs.octoprint.org/en/master/plugins/gettingstarted.html

jtannenba commented 3 years ago

Thank you, Can be closed?

maocypher commented 3 years ago

If everything is fine for you :) A feedback would be good, if you are running everything with or without GPIO.cleanup

I am not using PSU Control, so a short feedback from your side is necessary to decide

jtannenba commented 3 years ago

So far, so good. I did the edit and it saved a print last night.

jtannenba commented 3 years ago

When starting prints, it purged the nozzle it parks the nozzle, I see nothing wrong. Once printing, no problems Distance is set to 30mm. detection is set to distance.

maocypher commented 3 years ago

Sometimes higher values are needed. This depends e.g. on print speed. Unfortunately I currently have no solution to automatically find out the best values

jtannenba commented 3 years ago

It just parked again. This is frustrating. Printed most of yesterday just fine, now when I'm trying to tune in ABS, it keeps doing this. Once in this cycle, need to reboot to get the print to start correctly. octoprint.log I included the octoprint log. Looks like some of it is in German? Also looks like it's getting some kind of error? Only other thing I see is in the statuse it says the connection test is running and stopped. I used the test to see if it was still ok and got out of it. Shouldn't that have closed the connection test? By the way, Sensor is connected to 3.3v not 5v. per their manual.

maocypher commented 3 years ago

My plugin is completly coded in english. If there are german parts ins the log, this in not entered by my plugin.

For connection test, everything looked good as far as I could see.

octoprint.plugins.smartfilamentsensor - INFO - Error: Disabling filament sensors.

This line says that an error event was thrown from Octoprint that stopped the print. In this case the plugin is stopped.

2021-01-20 07:45:17,769 - octoprint.util.comm - ERROR - Unexpected error while connecting to serial port /dev/ttyUSB0, baudrate 115200 from hook default: SerialException: '[Errno 2] could not open port /dev/ttyUSB0: [Errno 2] No such file or directory: '/dev/ttyUSB0'' @ comm.py:_open_serial:3670
Traceback (most recent call last):
  File "/home/pi/oprint/local/lib/python2.7/site-packages/octoprint/util/comm.py", line 3670, in _open_serial
    settings().getFloat(["serial", "timeout", "connection"]),
  File "/home/pi/oprint/local/lib/python2.7/site-packages/octoprint/util/comm.py", line 3644, in default
    serial_obj.open()
  File "/home/pi/oprint/local/lib/python2.7/site-packages/serial/serialposix.py", line 268, in open
    raise SerialException(msg.errno, "could not open port {}: {}".format(self._port, msg))
SerialException: [Errno 2] could not open port /dev/ttyUSB0: [Errno 2] No such file or directory: '/dev/ttyUSB0'

Here it looks like an error on the USB port caused this error.

For different filaments it might happen that the sensor behaves different (sensitivity). For me TPU was detected the best so far

jtannenba commented 3 years ago

Do you think I should reload Octopi? I only have 2 plusgins, yours and PSU. Ater the reboot, it seems to be going ok. Print is over and hour into it. If I need to reload, is the edit in init.py ok now? or will it need to be done again?

maocypher commented 3 years ago

Maybe it is a good idea to restart the RaspberryPi completly. Not only OctoPrint. In most of the cases a reboot a OctoPrint helps when it is somehow "messy", but due to the USB error from the USB port - it could also be you just unplugged the cable - I would restart it. Maybe the Pi is already running a long time - like mine regularily ^^"

jtannenba commented 3 years ago

I had a pi 3b as a fileserver. Ran from when they came out till I got a 4. Only down times were when power went out (it was monitoring the UPS and powered other fileservers down before it shut down. They can run long times. That USB error, may be one of the times I powered the printer down.

maocypher commented 3 years ago

If you see a pattern what could cause the strange behaviour, let me know. Then I can try to search for something

jtannenba commented 3 years ago

Ok. Busy the next few days.

jtannenba commented 3 years ago

Got done printing a 4 hour print just fine, then I switched off PSU to change filaments and run an Esteps on the new one. Switch it back on (PSU is on when the Octopi's pin is low, so I put a switch in the relay box to disconnect when I want to use printer from control panel) After starting a 16 hr print, at about 13 min in it paused, parked nozzle and backed out filament. I told it to print and it seems like it is. (I hope, long print). Seems like it pulls this after working the printer from the control panel and going back Octoprint. I also noticed when it did it, the numbers for remaining distance on the status wasn't changing. Maybe something needs to initialized when going from local to Octoprint? Maybe the Pi needs to be rebooted before going back online?

Edit: 3 hrs in and it did it again. Nothing wrong with filament. After reheat and continue, it's going again. This time I got the log. octoprint.log

Edit 2: Print finally done.. no further pauses.

jtannenba commented 3 years ago

Printing with ABS.. 5 hr print. Prior to starting, rebooted Pi. 2 hrs into a 5 hr print, the nozzle parked. I got it going, but it messed up and parked again, this time on continue it was messing up the print and I had to kill it. Log was too big, I hope I have the revelant portion. Apparently the full screen plug it goes wild in the log. Also after loading the new version of Octopi, i didn't set the time to local. new 1.txt Redid this print and it went 7 hrs ok. Started next and it's on it's third pause. Distance is set at 35mm Here is a snippet of the log before the 3rd one: Octoprint_snippet.log

I am getting very frustrated. I think after this print, I will disable filament sensor and see if I can still print normally. If yes, I'll forget the sensor.