Giter Club home page Giter Club logo

filament-scale-enhanced's People

Contributors

ali1234 avatar dieki-n avatar techman83 avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar

filament-scale-enhanced's Issues

Use of other GPIO Pins

Hi,
is it possible to use other GPIO pins for connecting the load cell? 20 and 21 are already in use for me. Can I simply change the values in init.py or are these pins somehow "hardware-required"?

Thanks,
Christian

Inconsistent Weight Readings

I am not able to get a constant load readings from my setup with this plugin. It fluctuates in a wide range. I did the following troubleshooting steps:

  • Checked and measured the wire connections. All looked good.
  • Measured the load cells resistance directly while applying voltage and some load. All looked normal on the cell.
  • Connected everything (cell+sensor board) to an Arduino Nano and running some tests. I got good and precise readings from a know weight.

At this point I am pretty sure its not my equipment (of course it is the almost the cheapest stuff you can get) because it worked fine on the Arduino. I am thinking maybe it has to do something with the way the plugin reads the cell. Maybe it is the refreshing frequency? Or the calibration factor is a problem, I had to set some really high values on the Arduino setup.

If needed I could provide more information. I do not want to spam logs or anything else here without request :)

EDIT: I have hooked up a filament sensor and a relays module, too. Some other GPIO pins are in use.

I found only one "kind of" error in the log file:
2021-08-18 18:00:48,259 - py.warnings - WARNING - /home/pi/oprint/lib/python3.7/site-packages/filament_scale_enhanced/hx711.py:28: RuntimeWarning: This channel is already in use, continuing anyway. Use GPIO.setwarnings(False) to disable warnings.

Request: receive calibrated weight from home assistant?

Hello, I have not seen this plugin before now, have been using Home Assistant & esphome for my scale and rfid tagging, was wondering if it would be a massive amount of work to set up an endpoint that home assistant could relay the current scale reading to? I didn't get a raspberry pi before they became solid gold so I have to rely on an esp32 to see what my current filament weight is. If it's way outside scope or a lot of work it's ok I don't expect to even get a response on this but just thought I'd give it a go, thank you!

use average to avoid reading fluctuations

the reading keeps fluctiation with 10/15g to more or less... we could have a more "inteligent"algoritm to discart strange readings.... assuming the printer takes slow portions in the printing...

time.sleep behaviour for microsecond sleeps has changed in Python 3

GPIO.output(self.PD_SCK, True)
dataBits[j][i] = GPIO.input(self.DOUT)
GPIO.output(self.PD_SCK, False)
time.sleep(0.000001)

This line will behave differently under Python 3.5+. In older versions this will behave like time.sleep(0) and sleep for between 0.5 and 14 usec. In Python 3.5+ it will sleep for 60 to 100 usec (ie the minimum non-zero sleep). See pimoroni/blinkt#72 for details.

Since the delay is only while PD_SCK is low it should not cause spurious resets but I wanted to point it out anyway.

ValueError: A different mode has already been set!

Good Morning -

Just installed HX711 on Raspberry Pi 4 and successfully tested it using example.py from the hx711py library after editing script to use 20 & 21. Installed your plugin in OctoPrint, but always shows "Loading" in console. If I tear it in plugin config, it goes to 0g, but never shows any measurements.

Looked in octoprint.log and found the below:

2022-01-21 09:25:23,202 - octoprint.plugin - ERROR - Error while calling plugin filament_scale
Traceback (most recent call last):
  File "/home/pi/oprint/lib/python3.7/site-packages/octoprint/plugin/__init__.py", line 271, in call_plugin
    result = getattr(plugin, method)(*args, **kwargs)
  File "/home/pi/oprint/lib/python3.7/site-packages/octoprint/util/__init__.py", line 1737, in wrapper
    return f(*args, **kwargs)
  File "/home/pi/oprint/lib/python3.7/site-packages/filament_scale_enhanced/__init__.py", line 50, in on_startup
    self.hx = HX711(20, 21)
  File "/home/pi/oprint/lib/python3.7/site-packages/filament_scale_enhanced/hx711.py", line 27, in __init__
    GPIO.setmode(GPIO.BCM)
ValueError: A different mode has already been set!

Not a Python expert, but seems there's a conflict setting the mode as GPIO.BCM perhaps after a recent OP update? What may be done to address this?

UPDATE: Did see that another plugin, LED Strip Control; sets GPIO.BOARD which may be the conflict. That plugin works, though; and is used. Would potential fix be as easy as changing "GPIO.BCM" to "GPIO.BOARD" in hx711.py, then changing the 20, 21 values in init.py to board pin numbers? (In middle of long print currently, so can't test.)

Thank You

Configurable Pins

As noted in #16, having fixed pins means the only choice if you have already occupied 20/21, is to alter code.

Filament Sensor Simplified also has a UI for Pin Configuration, which we could also use as an opportunity to make it clearer about what wire goes to which pin.
2021-05-18_10-49-56

To ease with transition, we should ensure a default of 20/21 is set.

Configurable Board Mode

Currently the library forces a board mode of BCM, which can make getting the right pins confusing and could impact configuration of other plugins.

Filament Sensor Simplified has a reasonable UI to config this, of which we could draw inspiration from.
2021-05-18_10-45-13

To ease with transition, we should set this to BCM if we already have settings, otherwise GPIO mode should be the default choice presented.

Suggestions on how to solve the accuracy and NaN issues.

Hi,

Python is a script language and not a good language for time-sensitive comms. The HX711 is a very simple device with little tolerance on its comms at 80hz. That's why python can never achieve that accurate timing to communicate with HX711 effectively.

I would propose looking that https://github.com/endail/hx711 C++ library with python bindings @https://github.com/endail/hx711-rpi-py.

Let C++ handle the time-sensitive stuff and the library returns the median reading of 3 readings. I think this will be more accurate than the python Hx711 library being used.

Sorry I am unable to do the integration because I don't know anything about the octoprint framework and I don't really have time to work on it, hope somebody with time to spare can work on this.

request-output for display

hi sorry to be a pain but is there a way to add asimple display to the pi gpio's to display the weight in real time.
eg - TM1637 or a SH1106, SSD1306
thanks
martin
keep up the good work much apreciated

compatible with octoprint 1.73

Hi, can't get it working with 1.73 octoprint version. 1.72 works fine
scale

Lightning says:
Incompatible with Octoprint or the Python environment

Plugin not showing up

Hi,

I am a noob at this. I installed the plugin in Octoprint with the link and it showed up in plugin manager. I activated it and nothing shows up under plugins. I have installed the wire as the link showed. Everytime I restart Octoprint the plugin is deactivated in plugin manager. Need help

Contextual Save

Whilst there is text mentioning to save after certain actions, it's pretty easy to miss (I certainly have). With the client side framework in use, it wouldn't take a lot to have a save button appear next to an action when required.

Add "Print Pause" function

Like many with older printers, mine continues to print after running out of filament. Adding the ability to pause printing when the reading reaches a predetermined weight would be brilliant.

calibrate for printing mode

when i start printing here, the scale receives more หœ100g. probably, because of the force applied from pulling the material... whold be great two calibrations.... idle and printing.

IDEX dual extruder

Hi,
I have a dual extruder printer. Can I install 2 devices on the same raspberry pi to weight 2 spools?

Missing dependencies RPi.GPIO and Mock

When attempting to install plugin using the plugin manager on octopi 0.18 stable the following error happens:

2021-05-03 20:45:54,303   /home/pi/oprint/bin/python3 -m pip --disable-pip-version-check install file:///tmp/tmp_0eg9bt7/Filament_Scale_Enhanced.zip --no-cache-dir
2021-05-03 20:45:56,801 > Looking in indexes: https://pypi.org/simple, https://www.piwheels.org/simple
2021-05-03 20:45:56,802 > Processing /tmp/tmp_0eg9bt7/Filament_Scale_Enhanced.zip
2021-05-03 20:45:58,780 ! ERROR: Command errored out with exit status 1:
2021-05-03 20:45:58,781 ! command: /home/pi/oprint/bin/python3 -c 'import sys, setuptools, tokenize; sys.argv[0] = '"'"'/tmp/pip-req-build-hlp1on8u/setup.py'"'"'; __file__='"'"'/tmp/pip-req-build-hlp1on8u/setup.py'"'"';f=getattr(tokenize, '"'"'open'"'"', open)(__file__);code=f.read().replace('"'"'\r\n'"'"', '"'"'\n'"'"');f.close();exec(compile(code, __file__, '"'"'exec'"'"'))' egg_info --egg-base /tmp/pip-pip-egg-info-iz4lm_4h
2021-05-03 20:45:58,781 ! cwd: /tmp/pip-req-build-hlp1on8u/
2021-05-03 20:45:58,781 ! Complete output (16 lines):
2021-05-03 20:45:58,782 ! Traceback (most recent call last):
2021-05-03 20:45:58,782 ! File "/tmp/pip-req-build-hlp1on8u/filament_scale_enhanced/hx711.py", line 5, in <module>
2021-05-03 20:45:58,782 ! import RPi.GPIO as GPIO
2021-05-03 20:45:58,782 ! ModuleNotFoundError: No module named 'RPi'
2021-05-03 20:45:58,783 ! 
2021-05-03 20:45:58,783 ! During handling of the above exception, another exception occurred:
2021-05-03 20:45:58,783 ! 
2021-05-03 20:45:58,784 ! Traceback (most recent call last):
2021-05-03 20:45:58,784 ! File "<string>", line 1, in <module>
2021-05-03 20:45:58,784 ! File "/tmp/pip-req-build-hlp1on8u/setup.py", line 5, in <module>
2021-05-03 20:45:58,785 ! from filament_scale_enhanced import __version__
2021-05-03 20:45:58,785 ! File "/tmp/pip-req-build-hlp1on8u/filament_scale_enhanced/__init__.py", line 7, in <module>
2021-05-03 20:45:58,785 ! from .hx711 import HX711
2021-05-03 20:45:58,785 ! File "/tmp/pip-req-build-hlp1on8u/filament_scale_enhanced/hx711.py", line 7, in <module>
2021-05-03 20:45:58,786 ! import Mock.GPIO as GPIO
2021-05-03 20:45:58,786 ! ModuleNotFoundError: No module named 'Mock'
2021-05-03 20:45:58,786 ! ----------------------------------------
2021-05-03 20:45:58,786 ! ERROR: Command errored out with exit status 1: python setup.py egg_info Check the logs for full command output.

Add saving different spools

A nice feature would be to have several slots to save empty spool weight and give them a name. You could then switch between them as you change filament.

Error: No filament sensor detected.

The plugin can be installed now but it still doesn't work.

It works with Victor's version, and with the original standalone hx711py library.

Add support for NAU7802 I2C load cell ADC

The NAU7802 ADC is a pretty solid ADC that has one major advantage over the HX711: I2C communication. This allows for much more reliable reads (addressing #28) from higher-level code since it doesn't require any time-sensitive bit banging while still using only four pins.

The first downside is that the NAU7802 is a bit more expensive, but not prohibitively so. While HX711 breakouts can be found in the $1-5 range from a variety of vendors, NAU7802 breakouts are typically in the $5-20 range from only a few vendors.

Its also much more complex device to set up/manage than comparatively super-simple HX711. On the other hand, that makes it a lot more configurable for different use cases, and there are already some decent drivers to work with.

Driver options/examples:

Boards:

use a different GPIO lib for support for non pi boards

Pi's are really expensive rn, 200+ for a 4 and 100+ for a 3+. Having support for non pi boards would help reach this out to more people.

If this isn't an option, I know the Pico's are still relatively cheap. 14$ or so for one with sodered pins. running the sensor off of this and as a slave device over USB should be a viable alternative for those using anything other than Pi's

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.