endail / hx711-rpi-py

Python bindings for Raspberry Pi HX711 C++ Library
MIT License
11 stars 4 forks source link

Numbers are jumping too much #5

Closed iyssoft closed 2 years ago

iyssoft commented 2 years ago

I have the same weight on the load cell. Even I am not doing anything , just watching the screen, as you see in the attached image, number jump suddenly almost double . What can be reason here Thank you so much for the help

//my code is from HX711 import SimpleHX711, Rate

with SimpleHX711(5, 6, 1489, -367471, Rate.HZ_80) as hx: while True: print(hx.weight(1))

image

image

endail commented 2 years ago

It's hard to know what could be causing it, because it could be from a number of issues. But here's what you can try:

  1. Because of the way the Raspberry Pi operates, it is impossible* to ensure the values from the HX711 chip are read within the very short frame of time according to the chip's specification. If there are other programs running, especially if they are CPU-bound, that will negatively impact the reliability of this software to obtain accurate values. Try stopping those programs.

  2. Try using nice to run the Python script.

  3. Try using AdvancedHX711 instead of SimpleHX711. See here for details.

  4. If all else fails, try either: a) increasing the number of samples you obtain; or b) lengthening the time spent obtaining samples and then filter them using the median function. Examples of how to do that are here.

* with the current configuration and installation of the software