Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

No weight reported NaN #1

Open
Emparus opened this issue Sep 2, 2018 · 76 comments
Open

No weight reported NaN #1

Emparus opened this issue Sep 2, 2018 · 76 comments

Comments

@Emparus
Copy link

Emparus commented Sep 2, 2018

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
Copy link
Author

Emparus commented Sep 2, 2018

Using latest Octoprint 1.3.9

@dieki-n
Copy link
Owner

dieki-n commented Sep 8, 2018

Can you post your octoprint.log?

@dieki-n
Copy link
Owner

dieki-n commented Sep 11, 2018

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
Copy link
Author

Emparus commented Sep 11, 2018 via email

@dieki-n
Copy link
Owner

dieki-n commented Sep 22, 2018

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
Copy link
Author

Emparus commented Sep 22, 2018 via email

@Emparus
Copy link
Author

Emparus commented Sep 22, 2018 via email

@AbuMaia
Copy link

AbuMaia commented Sep 23, 2018

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
Copy link
Author

Emparus commented Sep 23, 2018 via email

@AbuMaia
Copy link

AbuMaia commented Sep 23, 2018

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
Copy link
Owner

dieki-n commented Sep 23, 2018

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
Copy link

AbuMaia commented Sep 23, 2018

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
Copy link
Owner

dieki-n commented Sep 24, 2018

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
Copy link
Author

Emparus commented Sep 24, 2018 via email

@AbuMaia
Copy link

AbuMaia commented Sep 25, 2018

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
Copy link
Author

Emparus commented Sep 25, 2018 via email

@AbuMaia
Copy link

AbuMaia commented Sep 29, 2018

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
Copy link
Owner

dieki-n commented Sep 30, 2018

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
Copy link
Owner

dieki-n commented Sep 30, 2018

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

@Emparus
Copy link
Author

Emparus commented Oct 1, 2018 via email

@dieki-n
Copy link
Owner

dieki-n commented Oct 2, 2018

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
Copy link

AbuMaia commented Oct 3, 2018

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
Copy link

AbuMaia commented Oct 8, 2018

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
Copy link
Owner

dieki-n commented Oct 8, 2018

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
Copy link
Author

Emparus commented Oct 8, 2018 via email

@dieki-n
Copy link
Owner

dieki-n commented Oct 8, 2018

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
Copy link

AbuMaia commented Oct 8, 2018

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
Copy link

AbuMaia commented Oct 9, 2018

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
Copy link
Author

Emparus commented Oct 9, 2018 via email

@wapiti59
Copy link

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
Copy link
Owner

dieki-n commented Jul 12, 2019

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
Copy link

Thank you MOST kindly good sir!

@wapiti59
Copy link

Sorry to have been such a pain sir

@dieki-n
Copy link
Owner

dieki-n commented Jul 14, 2019

No worries. Can you post a picture of your wiring setup? Also the output in your browser console (hit F12)

@wapiti59
Copy link

wapiti59 commented Jul 14, 2019

@wapiti59
Copy link

HX711

@wapiti59
Copy link

Pi

@wapiti59
Copy link

Yellow wire is data connected to GPIO20, Purple is Clock, connected to GPIO 21 as instructed

@wapiti59
Copy link

Power for the HX711 is tapped into the 5v pin, ground to the adjoining ground pin

@wapiti59
Copy link

Octoprint server is Pi III B+ from EzPi

@dieki-n
Copy link
Owner

dieki-n commented Jul 14, 2019

I have noticed that the HX711 is very susceptible to loose connections. Personally I soldered my wires directly to the HX711 rather than use connectors. Please try this and let me know if the same thing still happens.

@wapiti59
Copy link

No luck - never leaves sensor not connected error

@wapiti59
Copy link

wapiti59 commented Jul 14, 2019

additionally, all of this testing is being done without the printer running any jobs, so there is no vibration present in the system

@wapiti59
Copy link

I just tried every combination of the HX711 boards I have with every sensor I have. The ONLY one that even attempts to work is the one in the picture and logs I posted. It's almost sounding like a clock issue of some kind?

@wapiti59
Copy link

Ordered another load cell and HX711 board from different manufacturers. We'll see. I've checked my wiring and connections 6 ways from Sunday. None of this makes sense...

@wapiti59
Copy link

Any other ideas sir?

@wapiti59
Copy link

OK - grabbing at straws here. The actual measured voltage out of the 5v pin on the pi is 5.12v - could that be too high and it's blowing the HX711 circuit board? Should I be powering this off of the 3.3v pin instead?

@wapiti59
Copy link

wapiti59 commented Jul 17, 2019

Which, BTW, now it never comes alive, always stays at Sensor Not Connected Error

@dieki-n
Copy link
Owner

dieki-n commented Jul 17, 2019

The HX711 has a range of 2.6 ~ 5.5V so it should be fine at 5.12v. You could probably try 3.3v as well if you wanted but I don't think it would make a difference.

The "sensor not connected" error happens when we get no signal at all from the board.

One possibility I can think of is that some other plugin or program on your PI is interfering. Try disabling all other octoprint plugins. Do you have anything else using GPIO? There's nothing unusual in your console log, but can you upload your octoprint.log as well so I can have a look? (please use pastebin this time)

@wapiti59
Copy link

I have the latest octoprint.log for you. My most humble apologies for the etiquette breach last time, However, I can't seem to post it to pastebin. I created an account, and pasted it in, but it exceeded the allowable limits for a free account, and it says there are no Pro accounts available for purchase which would allow it., so, I copied it to the public folder in my Onedrive. You can access it here: https://1drv.ms/u/s!Ah04pUrIwGvItUw3tDNUZ6WuJxXw

@wapiti59
Copy link

wapiti59 commented Jul 25, 2019 via email

@wapiti59
Copy link

wapiti59 commented Jul 29, 2019 via email

@dieki-n
Copy link
Owner

dieki-n commented Jul 29, 2019

Those designations refer to if you're using the Raspberry Pi's built-in hardware I2C or SPI. We're not using those (the HX711 uses a simpler 2-wire communication protocol), so it has no effect.

I've updated the plugin to hopefully be a little more forgiving about imperfect timing, please update and give it a try.

@wapiti59
Copy link

wapiti59 commented Jul 31, 2019 via email

@wapiti59
Copy link

wapiti59 commented Jul 31, 2019 via email

@dieki-n
Copy link
Owner

dieki-n commented Jul 31, 2019

That's great it works now! Was it the update that made it work or a different HX711 chip?

You may want to try different kinds of connectors on the ends of the wires connecting to the pi - you may be able to get a better connection.

There will be some variability during a print because the extruder pulls on the filament, applying force to the scale.

@wapiti59
Copy link

wapiti59 commented Jul 31, 2019 via email

@wapiti59
Copy link

wapiti59 commented Aug 6, 2019 via email

@wapiti59
Copy link

wapiti59 commented Aug 23, 2019 via email

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants