# I used a compression load cell, a HX711 and a Raspberry and I get really terrible inconsistent readings, are these devices incompitable?

I wanted to create a 10-200 lbs scale using a FX1901-200 lbs load cell (https://www.digikey.ch/product-detail/en/te-connectivity-measurement-specialties/FX1901-0001-0200-L/223-1531-ND/5277314), a sparkfun HX711 (just the chip wired on a board), and a raspberry zero to make that happen. So I wired it up like this (I tried to wire yellow to ylw but that just wouldn't work at all, but it sorta works on grn, also white between the Raspberry and the chip goes to ground, its a slightly of center):

And ran this code:

#!/usr/bin/python3
from hx711 import HX711
import sys
import RPi.GPIO as GPIO
import math
import statistics
import os
import datetime

try:
print("connecting")
hx711 = HX711(
dout_pin=23,
pd_sck_pin=24,
channel='A',
gain=64
)
print("resetting")
result =hx711.reset()   # Before we start, reset the HX711 (not obligate)
if result:
print("success")
else:
print("failure")
raise ValueError("")

print("connected")
while(True):
measures = hx711.get_raw_data()

mea=sorted(measures)[2]/10000
mea=int(mea)
#val=math.floor(  math.log(abs(measures[0]))*10.0  )
val=measures
print(str(mea) + "\t" + str(val) +  "\t\t\t"+str(datetime.datetime.now()))
print("█"*(int(mea/5)))
finally:
GPIO.cleanup()  # always do a GPIO cleanup in your scripts!
print("cleaning up")


But the readings I get are terribly inconsistent and as soon as more than ~90lbs of pressure are applied, the cell sort of crashes and only gives negative readings no matter the load:

connecting
resetting
success
connected
15      [315807, 158020, 78229, 78288, 6541823]                 2018-12-18 18:48:43.137149
███
WARNING:root:setting gain and channel took more than 60µs. Time elapsed: 0.00012506
31      [156657, 318123, 318723, 318713, 159441]                2018-12-18 18:48:45.787850
██████
20      [157779, 319793, 320439, 192117, 209145]                2018-12-18 18:48:48.011792
████
43      [437001, 258052, 7888895, 5570559, 154869]              2018-12-18 18:48:49.244843
████████
37      [1907415, 373321, 170746, 220077, 466669]               2018-12-18 18:48:51.051037
███████
28      [467875, 234919, 256529, 285642, 287557]                2018-12-18 18:48:52.676789
█████
35      [550539, 549965, 276906, 352081, 278266]                2018-12-18 18:48:54.303139
███████
12      [127284, 126625, 125814, 124966, -6553601]              2018-12-18 18:48:55.640389
██
23      [246439, 239414, 115064, 228829, 447631]                2018-12-18 18:48:57.266976
████
44      [445075, 442543, 440237, 219052, 105688]                2018-12-18 18:48:58.099545
████████
40      [211267, 411997, 410381, 408623, 407239]                2018-12-18 18:48:58.943753
████████
39      [406205, 809083, 98400, 196181, 390213]                 2018-12-18 18:49:00.173517
███████
55      [194594, 240565, 550689, 553729, 555229]                2018-12-18 18:49:01.413470
███████████
28      [556783, 280107, 281821, 284658, 141996]                2018-12-18 18:49:03.029772
█████
28      [284305, 289232, 287863, 583893, 603753]                2018-12-18 18:49:05.147853
█████
WARNING:root:setting gain and channel took more than 60µs. Time elapsed: 0.00012802
-2      [607129, -24488, 1769471, -23315, -21833]               2018-12-18 18:49:08.060169

-1      [-14672, -16817, -16036, -12625, 16747]                 2018-12-18 18:49:10.967555

0       [17259, 18535, -10735, -2043905, -9326]                 2018-12-18 18:49:15.874284

0       [-9208, -8518, -8756, -9313, -11094]                    2018-12-18 18:49:17.532877

-1      [-18885, -18693, -18598, -19075, -18987]                2018-12-18 18:49:19.369511

-1      [-19012, -19027, -18971, -18952, -18915]                2018-12-18 18:49:21.070971

-1      [-18902, -18862, -18876, -18984, -19028]                2018-12-18 18:49:22.059373

-1      [-19039, -19050, -19064, -19030, -19007]                2018-12-18 18:49:22.681170

-1      [-19078, -19127, -19118, -19085, -19022]                2018-12-18 18:49:24.025283

-1      [-19015, -19219, -19203, -19185, -19209]                2018-12-18 18:49:25.546960

-1      [-19212, -19233, -19203, -19213, -19266]                2018-12-18 18:49:27.237327

-1      [-19309, -19352, -19346, -19336, -19342]                2018-12-18 18:49:28.403525

-1      [-19392, -19407, -19307, -19265, -19180]                2018-12-18 18:49:29.571867

-2      [-4894, -8942, -23532, -23257, -22924]                  2018-12-18 18:49:32.612460

-2      [-23036, -22834, -26684, -27857, -27999]                2018-12-18 18:49:34.123481

-2      [-28268, -28577, -28627, -28630, -28401]                2018-12-18 18:49:34.934208

-2      [-28107, -27639, -27481, -27301, -27442]                2018-12-18 18:49:35.733815

-2     [-30676, -29016, -28033, -27867, -27800]                2018-12-18 18:49:37.791934


Has anyone have any Idea what I could be doing wrong? It does sort of work with small forces up to around 70-80 but it still goes into the total negative sometimes and about half of the readings are completely random.

• The white and yellow from the load cell go to white and green on the HX711.
– JRE
Dec 18, 2018 at 19:39
• Yeah thats exactly how I did it white to WHT and yellow to GRN Dec 18, 2018 at 19:44
• Put a 0.1uF capacitor across the Bridge output, and 2 more 0.1uF from each output pin to GND near the ADC analog Ground. Dec 19, 2018 at 4:30
• What do you mean by bridge output and ADC? Dec 19, 2018 at 5:53

fx1901 sensor (up to 100 lbs max load) gives you 20 mV/V, and with gain 64, you'll get

0.02 * 64 * Vcc = 1.28 * Vcc

while allowed range of HX711 ADC is +/- 0.5 Vcc

So, max weight you can measure is about 39% of full sensor range

If you connect sensor to input B on HX711 board, you'll be able to use gain 32, i.e. about 78% of your full range

For fx1901-200 (200 lbs max load) situation is even worse - it has 36 mV/V, so even with gain 32 you'll get only 43% of full range

I believe situation can be improved if you decrease voltage applied to the sensor. Put 1.5kOhm from ground pin on HX711 board to sensor ground wire and another 1.5kOhm from Vcc on HX711 board to sensor Vcc wire. In this case voltage applied to the sensor will be twice smaller (because it's internal resistance is 3kOhm) and effectively you'll get twice smaller gain. I suggest to use 2 resistors symmetrically and not just one, because HX711 wants that absolute voltage on every input (A+, A-, B+ and B-) is 1.2V above ground and below Vcc-1.3V, i.e. Vcc / 2 is the best working point.