tatobari / hx711py

HX711 Python Library for Raspberry Pi.
Apache License 2.0
210 stars 154 forks source link

How to tare & define 1kg #2

Closed u-l-m-i closed 8 years ago

u-l-m-i commented 8 years ago

ello Tato,

thanks for providing your code and explanation, but I’m still struggling with a few things.

First: Can you please explain how to evaluate the tare value and the value for the defined (1kg)

Second: Maybe depended on above

With changing the Vcc to 3,3 V the results get better, but still a very inconstant. My scale consists out of 4 Load Cells which are linked as Wheatstone Bridge. (tare & 1kg as in our example)

e.g. Empty scale: pi@raspberrypi:~/scale/hx711 $ python hx.py 0.000 1.076 -0.043 4.500 -0.033 0.000 -0.033 0.000 0.022 -0.022 -0.033 0.022 -0.011 -0.011 -0.022 ^CCleaning... Bye! pi@raspberrypi:~/scale/hx711 $ python hx.py ## with 1kg 0.000 0.043 0.043 0.033 18.261 0.011 0.196 0.022 0.087 0.087 0.000 0.011 ^CCleaning... Bye! pi@raspberrypi:~/scale/hx711 $ python hx.py ##wtih 5kg

0.000 0.022 0.033 0.033 0.076 0.043 0.043 0.065 -0.011 0.022 0.033 ^CCleaning... Bye! pi@raspberrypi:~/scale/hx711 $

Any idea or advice?

Thanks u-l-m-i

tatobari commented 6 years ago

It is possible that the BeagleBone is too fast and the frequency it's clocking the SCK pin is too high. Try reading the datasheet. If possible, try finding an oscilloscope to find out the frequency. Then you can delay the clocking a bit adding some microseconds delay between line 68 and 69 to respect the minimum microseconds explained on the HX711 datasheet.

SooranSaeed commented 6 years ago

Hey bro i put 50 microseconds delay and the result is not changing, bro my big question is why my clk pin voltage is 125 mv ?! This happen for fast loop in this library ?! Although in hx711 datasheet says the clk input is 250 mv

tatobari commented 6 years ago

If you're using a voltmeter, you'll only get an average voltage of a signal that's changing with time.

GPIO.output(self.PD_SCK, GPIO.HIGH) # Voltage is 3.3V here.
GPIO.output(self.PD_SCK, GPIO.LOW) # Voltage is 0.0V here.

But the above happens so fast that your tester won't change fast enough.

If you finally got an oscilloscope, then send me a picture of the screen to see the wave form. Thanks!