Royrdan / 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
7 stars 10 forks source link

Randomly triggers, causes false positive #10

Open Chaarlemagne opened 2 years ago

Chaarlemagne commented 2 years ago

No matter what I have the runout distance set to, I have had it provide a false positive several times.

cods69 commented 2 years ago

So, long story - I had the same issue for years (or nearly) since the original plugin came out. I gave up after trying many solutions which did not help. Even the new plugin update here did not help last week when I tried. Now, not sure if this is a solution for everyone or not, but the Pi4 I'm using (with Pi-camera, small light, bought from Amazon with 3rd party PSU) started giving me voltage alerts in OctoPrint.
Bought an offical Pi4 PSU and just ran the first print, after deciding to let OctoPrint Smart Filament Sensor be activated again. No false positive! So far, this MAY have been my issue, so I'll post back in here in a few months after giving it a workout, with an update.

EDIT: BTW, thanks go to the new developer for picking this up. Will be incredibly handy if it's actually going to start working for me now. EDIT2: 3 full prints later and still working, which I could not have got through when I first set this up. Was definitely the PSU. Also, love the new status on the front page for the SFS - not sure if the new dev did that, but it's a great feature to have!

Chaarlemagne commented 2 years ago

That's odd, I have the official PSU and still had those issues. What specs is your PSU?

cods69 commented 2 years ago

The new one that works is just offical stock for Pi4. The faulty one I removed was from Labists that used to sell on Amazon.

cods69 commented 2 years ago

I've been using this for about 7 prints (3-8 hour jobs) and had 2 random stops. (Far less than it used to - I couldn't get through a 2hr print prior to this PSU change) They were pretty standard 25mm/s wall 50mm/s infill prints and I didn't actually catch it pausing, but I've increased my distance detection from 35 to 50 to see if it trips again.
Asides, as I said, it's behaving FAR better than it used to. Often, once tripped back with the issues, it would struggle to get past multiple tripping episodes, but I don't have that now. Will post back after some time to report. EDIT - damn - should not have spoken - just happened again.

airsharkie commented 2 years ago

I haven't had any issues with this sensor false tripping EVER in the past year of service until the last few days. I took a few months off of printing and when I booted Octoprint, it notified me of a new maintainer for the Smart Filament Sensor plugin. I deleted the plugin and reinstalled.

Now I can't get through even a few layers of a print without it triggering.

I've upped my detection distance time. I've pulled apart everything several times to verify that nothing is jammed or broken.

It registers movement and counts correctly.

Every time I walk away from it, I come back to find it paused with no indication of why.

If you need any data gathering or investigation to figure out what's going on, please let me know. I'm happy to assist.

airsharkie commented 2 years ago

I don't know if it helps, but here's the DEBUG section from my last random pause. No clogs, no jams, no break found, just had to hit the resume button:

2022-04-28 14:59:34,465 - octoprint.plugins.smartfilamentsensor - DEBUG - ----- RUNNING calc_distance ----- 2022-04-28 14:59:34,467 - octoprint.plugins.smartfilamentsensor - DEBUG - Found extrude command in 'G1 F3000 E129.17759' with value: 129.17759 2022-04-28 14:59:34,468 - octoprint.plugins.smartfilamentsensor - DEBUG - Ignoring Retraction CurrentE: 129.17759 - LastE: 133.17759 = 0 2022-04-28 14:59:34,469 - octoprint.plugins.smartfilamentsensor - DEBUG - Remaining: 0.18143999999998073 - Extruded: 0 = 0.18143999999998073 2022-04-28 14:59:34,576 - octoprint.plugins.smartfilamentsensor - DEBUG - ----- RUNNING calc_distance ----- 2022-04-28 14:59:34,577 - octoprint.plugins.smartfilamentsensor - DEBUG - Found extrude command in 'G1 F3000 E133.17759' with value: 133.17759 2022-04-28 14:59:34,577 - octoprint.plugins.smartfilamentsensor - DEBUG - CurrentE: 133.17759 - LastE: 129.17759 = 4.0 2022-04-28 14:59:34,578 - octoprint.plugins.smartfilamentsensor - DEBUG - Remaining: 0.18143999999998073 - Extruded: 4.0 = -3.8185600000000193 2022-04-28 14:59:34,716 - octoprint.plugins.smartfilamentsensor - DEBUG - ----- RUNNING calc_distance ----- 2022-04-28 14:59:34,717 - octoprint.plugins.smartfilamentsensor - DEBUG - Found extrude command in 'G1 F720 X104.882 Y204.387 E133.18784' with value: 133.18784 2022-04-28 14:59:34,717 - octoprint.plugins.smartfilamentsensor - DEBUG - Motion sensor detected no movement 2022-04-28 14:59:34,718 - octoprint.plugins.smartfilamentsensor - INFO - Pause command: M600 2022-04-28 14:59:34,901 - octoprint.plugins.octoeverywhere - INFO - Fireing On Filament Change Notification From GcodeSent: M600 2022-04-28 14:59:34,921 - octoprint.util.comm - INFO - Changing monitoring state from "Printing" to "Pausing" 2022-04-28 14:59:34,927 - octoprint.printer.standard.job - INFO - Print job paused - origin: local, path: CE3PRO_Seester Money Slab filler (4).gcode, owner: bryan, user: None 2022-04-28 14:59:35,012 - octoprint.plugins.smartfilamentsensor - INFO - PrintPaused: Pausing filament sensors. 2022-04-28 14:59:35,401 - octoprint.plugins.octoeverywhere - INFO - NotificationsHandler successfully sent 'filamentchange'; ETA: 5742 2022-04-28 14:59:35,444 - octoprint.plugins.octoeverywhere - INFO - NotificationsHandler successfully sent 'paused'; ETA: 5742 2022-04-28 14:59:42,899 - octoprint.plugins.octoeverywhere - INFO - Fireing On User Interaction Required From GcodeReceived: echo:busy: paused for user

LordNobady commented 2 years ago

I did find that this happened to me on parts with a lot of retractions. I did find that making the retraction distance significantly longer than the detection distance helps.

Royrdan commented 2 years ago

Hi @LordNobady @airsharkie @cods69 @Chaarlemagne Thanks for the feedback. Really appreciated. I have been a bit busy lately and not printing much to test some things. Thankfully I have had some time and have done a bit of reshuffling with the code and research to check for the false positives. If you have debug on you might notice that the GPIO pin events dont seem to trigger for a short period of time say 2-5 seconds and if you go over the remaining distance this will trigger the change filament action. I was not 100% sure how to fix this with my research and it seems that it should really work but I have added a test that if the last motion detection was less than 5 seconds it will ignore it and see if it triggers the motion detection before this interval. Im still testing to see if this works but fingers crossed. Also found an issue that after resuming it would reset the last extrusion and make it think it had just extruded the entire amount of its position. I have hopefully fixed this and testing today / tomorrow and will upload the new changes asap if all is working. Please let me know if any issues after the update. Thanks