dieki-n / Octoprint-Filament-Scale

48 stars 31 forks source link

No weight reported NaN #1

Open Emparus opened 6 years ago

Emparus commented 6 years ago

This plugin doesn't work for me. Tried two scale setups with the green board. Under current reading NaN is reported and nothing can be calibrated.

Emparus commented 6 years ago

Using latest Octoprint 1.3.9

dieki-n commented 6 years ago

Can you post your octoprint.log?

dieki-n commented 6 years ago

Also, by any chance did you hit "calibrate" with a 0 in the "known weight" field? If so, try hitting calibrate again with any other value in the known weight field and see if it produces a real number.

Emparus commented 6 years ago

Thanks for responding. Will try that. What else is required/or needs to be installed to run the plugin? I think I maybe missing something. The upper most field can not be edited hovering with the mouse above it shows a red circle with line through it. When I hit calibrate it shows NaN. Played around with different input but NaN is the return. Known weight is 1300gr for full spool.

On Mon, Sep 10, 2018 at 11:35 PM Victor Noordhoek notifications@github.com wrote:

Also, by any chance did you hit "calibrate" with a 0 in the "known weight" field? If so, try hitting calibrate again with any other value in the known weight field and see if it produces a real number.

— You are receiving this because you authored the thread. Reply to this email directly, view it on GitHub https://github.com/dieki-n/Octoprint-Filament-Scale/issues/1#issuecomment-420135524, or mute the thread https://github.com/notifications/unsubscribe-auth/Ao7F31W_ofJVtdpqTrgOMw5EQthK8DZtks5uZy-egaJpZM4WWm3O .

dieki-n commented 6 years ago

The plugin has no requirements other than RPI.Gpio, which should be installed automatically when you install the plugin.

Can you post your octoprint.log as well as a screenshot of the plugin settings you are using?

Emparus commented 6 years ago

Will do tomorrow night

On Fri, Sep 21, 2018 at 9:19 PM Victor Noordhoek notifications@github.com wrote:

The plugins has no requirements other than RPI.Gpio, which should be installed automatically when you install the plugin.

Can you post your octoprint.log as well as a screenshot of the plugin settings you are using?

— You are receiving this because you authored the thread. Reply to this email directly, view it on GitHub https://github.com/dieki-n/Octoprint-Filament-Scale/issues/1#issuecomment-423706724, or mute the thread https://github.com/notifications/unsubscribe-auth/Ao7F3zOU2uP_ouSJ29JE-YVdIRCtjXczks5udZAzgaJpZM4WWm3O .

Emparus commented 6 years ago

[image: scale.JPG]

On Fri, Sep 21, 2018 at 9:37 PM Empiricus Dremomys empiricuus@gmail.com wrote:

Will do tomorrow night

On Fri, Sep 21, 2018 at 9:19 PM Victor Noordhoek notifications@github.com wrote:

The plugins has no requirements other than RPI.Gpio, which should be installed automatically when you install the plugin.

Can you post your octoprint.log as well as a screenshot of the plugin settings you are using?

— You are receiving this because you authored the thread. Reply to this email directly, view it on GitHub https://github.com/dieki-n/Octoprint-Filament-Scale/issues/1#issuecomment-423706724, or mute the thread https://github.com/notifications/unsubscribe-auth/Ao7F3zOU2uP_ouSJ29JE-YVdIRCtjXczks5udZAzgaJpZM4WWm3O .

AbuMaia commented 6 years ago

I'm having the same issue. I tared it with the scale empty, then I used an empty spool with a listed weight of 319 to calibrate, got "NaN". The OctoPrint log seems to be spammed by this plugin every 6 milliseconds (?, 23:46:56,400 ... 406 ... 412 ... etc) with "octoprint.plugins.filament_scale - INFO - 20". Sometimes the "Filament Remaining" display switches from "NaNg" to "Infinityg" for a second, then back to "NaNg".

Edit: I think the constant INFO -20 from the plugin is overwhelming the server. Twice now it's crashed since I installed the plugin and connected the scale.

Emparus commented 6 years ago

Thanks for letting me know that it is not just me or the hardware I got. Yes something is wrong here. For the first time in three years Octoprint was crashing on me during prints with the plugin installed. Removed it and hope that the issue can be resolved.

On Sun, Sep 23, 2018 at 1:55 AM AbuMaia notifications@github.com wrote:

I'm having the same issue. I tared it with the scale empty, then I used an empty spool with a listed weight of 319 to calibrate, got "NaN". The OctoPrint log seems to be spammed by this plugin every 6 milliseconds (?, 23:46:56,400 ... 406 ... 412 ... etc) with "octoprint.plugins.filament_scale - INFO - 20".

— You are receiving this because you authored the thread. Reply to this email directly, view it on GitHub https://github.com/dieki-n/Octoprint-Filament-Scale/issues/1#issuecomment-423793915, or mute the thread https://github.com/notifications/unsubscribe-auth/Ao7F38BK7DtGwnFUsdYRIOFXNaaDAuWUks5udyJagaJpZM4WWm3O .

AbuMaia commented 6 years ago

I haven't yet solved the problem, but I found a bug while searching through tho code for whatever was throwing that "INFO - 20" message repeatedly in the log.

In the Readme, it says, "This plugin assumed you connected the data pin to GPIO20, and the clock pin to GPIO21."

However, in init.py, under the default settings section, it has return dict( tare = 8430152, reference_unit=-411, spool_weight=200, clockpin=20, datapin=21, lastknownweight=0

I swapped my two wires around, but it didn't help.

dieki-n commented 6 years ago

The INFO - 20 is a debug message I forgot to remove before committing.

The good news is while I'm still not able to reproduce the NaN display, I am able to reproduce the crashes. Something is making octoprint segfault, which is confusing to me as I was not aware python was capable of segfaulting. Working on it.

Once I get the crashes figured out I'll upload a version with some diagnostic code so we can figure out what's causing the NaN issue. Thank you for your help and patience.

AbuMaia commented 6 years ago

I've found another problem, though fixing it didn't solve this issue either. I noticed different websites talking about wiring up the hx711 have different instructions. Some say the white wire goes to A+ and green goes to A-, others say white goes to A- and green to A+. So I went to the vendor where I bought the load cell, and their info says green A+ white A-. I unsoldered and swapped the two wires around, but still no change here.

dieki-n commented 6 years ago

Yeah, there are multiple kinds of hx711 boards/load cells out there and not all of them are wired the same.

Try the latest version. I've fixed the crashing, and I've also added some feedback if the sensor isn't connected correctly. If you are still getting a NaN, it will log some diagnostic data to the console - let me know what, if anything, you see there.

Emparus commented 6 years ago

Thanks a bunch. Will try the new version. What data rate is expected from the board? I tried one that has

I guess the output rate is critical here. Unfortunately the documentation that comes with these is poor to none.

On Mon, Sep 24, 2018 at 12:45 AM Victor Noordhoek notifications@github.com wrote:

Yeah, there are multiple kinds of hx711 boards/load cells out there and not all of them are wired the same.

Try the latest version. I've fixed the crashing, and I've also added some feedback if the sensor isn't connected correctly. If you are still getting a NaN, it will log some diagnostic data to the console - let me know what, if anything, you see there.

— You are receiving this because you authored the thread. Reply to this email directly, view it on GitHub https://github.com/dieki-n/Octoprint-Filament-Scale/issues/1#issuecomment-423876117, or mute the thread https://github.com/notifications/unsubscribe-auth/Ao7F3wabR7FcgCbgy1ew0AqaPBiK-Mklks5ueGNWgaJpZM4WWm3O .

AbuMaia commented 6 years ago

I think my load cell is faulty. Following some diagnostic instructions I found, in which you measure the resistance between each 6 pairs of wires. The resistance values you get should all be nearly equal, with one pair showing higher resistance. I got 3 different readings, and the highest resistance pair was not the red-black pair as it should be if they're the E+ and E-.

Emparus commented 6 years ago

That is why I got a second one. But same thing.

On Tue, Sep 25, 2018 at 2:09 AM AbuMaia notifications@github.com wrote:

I think my load cell is faulty. Following some diagnostic instructions I found, in which you measure the resistance between each 6 pairs of wires. The resistance values you get should all be nearly equal, with one pair showing higher resistance. I got 3 different readings, and the highest resistance pair was not the red-black pair as it should be if they're the E+ and E-.

— You are receiving this because you authored the thread. Reply to this email directly, view it on GitHub https://github.com/dieki-n/Octoprint-Filament-Scale/issues/1#issuecomment-424218627, or mute the thread https://github.com/notifications/unsubscribe-auth/Ao7F3_fqE5Bcu3eyKctZYG_LPijrekCQks5ueciWgaJpZM4WWm3O .

AbuMaia commented 6 years ago

I guess I really do have to get a new load cell. I soldered everything back together again, installed the updated plugin, and plugged the scale back into the pi. The Filament Scale just says "Calibration Error", and the settings page says the sensor isn't plugged in. Hi ho, hi ho, back to Amazon I go...

dieki-n commented 6 years ago

Yeah, if the settings page says the sensor isn't plugged in that means it's reading a full run of zeroes from the HX711.

If you send me a photo of your wiring I can double-check it.

dieki-n commented 6 years ago

Emparus, as far as I can tell that refers to the sample rate and should work either way. The way the interface works is that there's a data line and a clock line. Each time the pi sends a pulse on the clock line, the HX711 sends a bit on the data line. So it's not like serial where you have to match baud rates or anything.

This is the datasheet I'm basing off of: https://www.mouser.com/ds/2/813/hx711_english-1022875.pdf

AbuMaia commented 6 years ago

https://www.dropbox.com/s/f0t4cb4b1kw24j5/0929182214_HDR.jpg?dl=0

https://www.dropbox.com/s/d64xp4tzuidzvj4/0929182214b_HDR.jpg?dl=0

Emparus commented 6 years ago

Thanks for the explanation. Can you share specifically which board and weight bar you used? I have tried two different boards and had two sensor bars. No luck

On Sat, Sep 29, 2018 at 8:44 PM Victor Noordhoek notifications@github.com wrote:

Emparus, as far as I can tell that refers to the sample rate and should work either way. The way the interface works is that there's a data line and a clock line. Each time the pi sends a pulse on the clock line, the HX711 sends a bit on the data line. So it's not like serial where you have to match baud rates or anything.

This is the datasheet I'm basing off of: https://www.mouser.com/ds/2/813/hx711_english-1022875.pdf

— You are receiving this because you authored the thread. Reply to this email directly, view it on GitHub https://github.com/dieki-n/Octoprint-Filament-Scale/issues/1#issuecomment-425684744, or mute the thread https://github.com/notifications/unsubscribe-auth/Ao7F3-IsILfvOkf1HZ3GjKFMNWqC-E1tks5ugBPxgaJpZM4WWm3O .

dieki-n commented 6 years ago

This is the one I bought: https://www.ebay.com/itm/5KG-Scale-Load-Cell-Weight-Weighing-Sensor-HX711-Weighing-Sensor-AD-Module/112631226433

AbuMaia, nothing looks wrong with your wiring to me. I do see you have other stuff plugged into your GPIO ports as well; do you have other plugins using GPIO peripherals? If you do, maybe they're interfering. You could try turning off those plugins, restarting your pi, and seeing if it works.

AbuMaia commented 6 years ago

Progress. Received my new load cell and hx711 board, soldered it all up and plugged it in. The plugin now says "-infinity g" and "Filament Remaining: 0g". Now I just have to re-print the filament holder base I broke while trying to take the old load cell out (used superglue to strengthen a bad print area, it stuck to the load cell).

Yep, I have other things plugged into the GPIO. I have a bank of relays which I use to remotely switch power to the printer and lights, and a filament runout sensor.

Emparus: I just received this one: https://www.amazon.com/gp/product/B078JX3KJN and it seems to be working. I need to rebuild the filament holder in order to calibrate it to see if it really does work, but the plugin isn't complaining about it not being there.

AbuMaia commented 6 years ago

Ok, I got the filament holder rebuilt, and everything plugged in, and it seems to be working. It is outputting a weight. Whether it's the right weight is another matter. I calibrated it with an empty spool, but the plugin is reporting a weight of filament double that of what Filament Manager calculates should be remaining based on usage. Perhaps I should get a kitchen scale so I can calibrate the load cell with better numbers and have a more accurate comparison.

dieki-n commented 6 years ago

The accuracy of your "known weight" is important - if you're only estimating the weight, all the readings will be way off.

If you don't have an accurate scale I recommend finding a consumer good with a weight printed on it, like a bag of rice or a can of soda (12oz can of soda is what I used, it weighs 395mg). Or something like a smartphone whose weight you can look up online.

Emparus commented 6 years ago

Thanks for all the help. I think a got two bad load cells. Tried 4 boards with these cells. including two that came with the cells and are the same you had. The new plugin detects that something is connected ( sensor not connected if I unplug plus). But then it reports Callibration error. If I go to the plugin it says no filament sensor detected check the pins, which are all connected correctly. I guess bad luck.

On Sat, Sep 8, 2018 at 5:05 PM Victor Noordhoek notifications@github.com wrote:

Can you post your octoprint.log?

— You are receiving this because you authored the thread. Reply to this email directly, view it on GitHub https://github.com/dieki-n/Octoprint-Filament-Scale/issues/1#issuecomment-419672770, or mute the thread https://github.com/notifications/unsubscribe-auth/Ao7F3_6oiDg0KbBzDRIm2mL-926yLqT9ks5uZDErgaJpZM4WWm3O .

dieki-n commented 6 years ago

If you're getting a calibration error that's progress! It means we're getting some data from the load cell at least. When it gets a calibration error it should be putting some debug info in the console, can you post that in here?

AbuMaia commented 6 years ago

Dug around the cupboards, found a bag of farina that said "397g". Used it to calibrate. Filament Manager says there should be 288g remaining. Filament Scale is now reporting 299g. Though that is still using the 319g empty spool weight I had been using to calibrate before.

AbuMaia commented 6 years ago

Perhaps these load cells weren't intended for continuous use. Yesterday I said it was reporting 299g. I then did a print that used 30g of filament. Today it's reporting 924g, and is not stable. It jumps around to other readings, or "calibration error" occasionally. In the time it took me to type all of this it's now saying 604g.

It may be accurate enough soon after taring and calibrating, but leave it sit for a bit under load, it becomes quite unreliable.

Emparus commented 6 years ago

Will do. Waiting for a new cell from your eBay source. I already designed a nice rotating filament holder that integrates the load cell. https://www.thingiverse.com/thing:3054853

On Mon, Oct 8, 2018 at 2:00 PM Victor Noordhoek notifications@github.com wrote:

If you're getting a calibration error that's progress! It means we're getting some data from the load cell at least. When it gets a calibration error it should be putting some debug info in the console, can you post that in here?

— You are receiving this because you authored the thread. Reply to this email directly, view it on GitHub https://github.com/dieki-n/Octoprint-Filament-Scale/issues/1#issuecomment-427926004, or mute the thread https://github.com/notifications/unsubscribe-auth/Ao7F39rUET3UCmUq8FmzrMkljuSlRmBRks5ui5KngaJpZM4WWm3O .

dieki-n commented 6 years ago

They are definitely intended for continuous use - there can be long-term creep issues over months but it should be fine on the short term. Mine doesn't have that kind of instability.

Does jiggling the wires trigger the problem? I have found that the wires going from the load cell to the hx711 are very thin and can easily be strained.

AbuMaia commented 6 years ago

Nothing's pinched, nothing's strained, there's quite a bit of slack in the wires from lc > hx711 > pi. When running a print, the filament gets pulled off the top of the spool. I have noticed Calibration Error pop up more often during a print than when idle.

dieki-n commented 6 years ago

Odd. Can you copy-paste the console logs from the calibration errors?

dieki-n commented 6 years ago

That is a very nice rotating spool holder and I hope you can get it working because it'd be a shame for such a nice design to go to waste!

AbuMaia commented 6 years ago

I see nothing in the octoprint.log about the scale, other than the part where it's reported as installed.

Emparus commented 6 years ago

It will work - it is just these cheapo parts I am sure. Actually One Al bar had no sensor under the silicone only cable glued in. The other had the cable damaged were they are exposed going over the side. F that. May get something more reliable from mouser.

On Tue, Oct 9, 2018 at 9:41 PM Victor Noordhoek notifications@github.com wrote:

That is a very nice rotating spool holder and I hope you can get it working because it'd be a shame for such a nice design to go to waste!

— You are receiving this because you authored the thread. Reply to this email directly, view it on GitHub https://github.com/dieki-n/Octoprint-Filament-Scale/issues/1#issuecomment-428409183, or mute the thread https://github.com/notifications/unsubscribe-auth/Ao7F3wHKHO6Pma4d4etGLYl8MrJm4EO8ks5ujVBSgaJpZM4WWm3O .

dieki-n commented 6 years ago

It's not in octoprint.log - it's in your browser console. Press F12 and go to the console tab.

AbuMaia commented 6 years ago

Object { tare: 5697637, r_u: 244.4382871536524, parsed_r_u: 244, message: {…}, known_weight: 0, spool_weight: "319" }

They all look the same, I can't tell which ones are for the error and which are not.

dieki-n commented 6 years ago

Expand the message part and put that in here as well.

AbuMaia commented 6 years ago

message: {…} ​​ heightMessage: "24.80 / 250.00mm" ​​ navBarMessage: "Progress: 59% Layer: 118 of 174 Height: 24.80 of 250.00mm" ​​ showHeightInStatusBar: true ​​ showLayerInStatusBar: true ​​ stateMessage: "118 / 174"

AbuMaia commented 6 years ago

https://www.dropbox.com/s/fgjk26goq6hc7qq/Screenshot%20from%202018-10-09%2022-28-41.png?dl=0

dieki-n commented 6 years ago

Aha, it is conflicting with one of your other plugins.

I have updated it so it will no longer conflict with other plugins, please uninstall/reinstall and see if you still get the errors.

AbuMaia commented 6 years ago

Ok, that got rid of the Calibration Error messages.

wapiti59 commented 5 years ago

dieki-n: Hi! I have been trying to get this to work in vain for a while now, and have not been able to. I have tried two different HX711 boards from two different sources, though both with the same load cell, and have tried every GPIO connection pattern I can find documented - all the same - Sensor not connected error. I just ordered four of https://www.amazon.com/gp/product/B075317R45/ref=ppx_yo_dt_b_asin_title_o00_s00?ie=UTF8&psc=1 from Amazon (since they offer US based support) thinking that perhaps I have a bad load cell and MAYBE one of those will work. HELP???

wapiti59 commented 5 years ago

OK - Update - I'm getting closer, but not there yet, and still need help if anyone is still looking at this. I got a mated loadcell/HX711 set today from teh link on Amazon (in fact, I bought 4 of them), wired it up, and connected it. Once Octopi connected to the printer - it went from an error message of Sensor not Connected, to showing a weight of 0g - which stayed on for about 2 seconds, and then went back to the error message, about every 15 seconds or so, it shows 0g, and then back to the error message, and it keeps bouncing back and forth like that. Below is the console log (HELP???): Starting dependency resolution... packed_core.js:15624:9 ... dependency resolution done packed_core.js:15734:9 Initial application setup done, connecting to server... packed_core.js:16016:9 Initialized error tracking 10.0.0.27:9188:9 Connected to the server packed_core.js:13728:9 Finalizing application startup packed_core.js:15994:13 Going to bind 48 view models... packed_core.js:15875:13 Did not bind view model UsageViewModel to target #wizard_plugin_tracking since it does not exist packed_core.js:15928:33 addButtonsToTermTab packed_core.js:11012:44068 len: 4 packed_core.js:11012:44068 Did not bind view model SoftwareUpdateViewModel to target #softwareupdate_confirmation_dialog since it does not exist packed_core.js:15928:33 Did not bind view model SoftwareUpdateViewModel to target #wizard_plugin_softwareupdate since it does not exist packed_core.js:15928:33 addButtonsToTermTab packed_core.js:11012:44068 len: 4 packed_core.js:11012:44068 Adding button: [Save EEPROM] M500 packed_core.js:11012:44068 Adding button: [Clear EEPROM] M502 packed_core.js:11012:44068 Adding button: [EZABL Probe Test] M48 P10 X100 Y100 V2 packed_core.js:11012:44068 Adding button: [Home All] G28 packed_core.js:11012:44068 User ezpi logged in packed_core.js:2475:25 ... binding done packed_core.js:15967:13 Application startup complete packed_core.js:15979:13

wapiti59 commented 5 years ago

OK. I have now wired up and tried a total of 5 different load cell/HX711 combinations. Two of them exhibit the same behavior - Error: Sensor not Detected for 15 seconds, weight displayed for two seconds, and back to the error. Three of them never leave the Error message. I find it hard to believe that out of 5 sets, only two are semi-functional. What am I doing wrong here guys?

wapiti59 commented 5 years ago

Now it's cycling every 5 seconds - 5 seconds displaying weight, 5 seconds error message, back and forth. Head is starting to bleed from scratching so hard...

dieki-n commented 5 years ago

Commenting to let you know I haven't abandoned this project, I will look at your comments over the weekend and see if I can help.

wapiti59 commented 5 years ago

Thank you MOST kindly good sir!

wapiti59 commented 5 years ago

Sorry to have been such a pain sir