Seregone
Posts: 30
Joined: Tue Apr 04, 2017 2:54 pm

Load cell and HX711

Mon May 15, 2017 10:12 am

Hello everyone,

I'm here today because I've some problem to get weight on my PI.
I'll firstly give the connections and informations:

Materials:
Load cell : 3kg
Chip : HX711
PI : Raspberry pi 3

Load cell to HX711:

RED: E+
BLACK:E-
WHITE : A+
GREEN: A-

HX711 to PI:

GND : PIN 25 (GROUND)
DT : PIN 21 (BCM GPIO9)
SCK : PIN 23 (BCM GPIO11)
VCC: PIN 1 (3.3V)

About scripts that i used:

Code: Select all

import RPi.GPIO as GPIO
import time
import sys
import numpy  # sudo apt-get python-numpy

GPIO.setwarnings(False)

class HX711:
    def __init__(self, dout, pd_sck, gain=32):
        self.PD_SCK = pd_sck
        self.DOUT = dout

        GPIO.setmode(GPIO.BCM)
        GPIO.setup(self.PD_SCK, GPIO.OUT)
        GPIO.setup(self.DOUT, GPIO.IN)

        self.GAIN = 0
        self.REFERENCE_UNIT = 1  # The value returned by the hx711 that corresponds to your reference unit AFTER dividing by the SCALE.
        
        self.OFFSET = 1
        self.lastVal = 0

        self.LSByte = [2, -1, -1]
        self.MSByte = [0, 3, 1]
        
        self.MSBit = [0, 8, 1]
        self.LSBit = [7, -1, -1]

        self.byte_range_values = self.LSByte
        self.bit_range_values = self.MSBit

        self.set_gain(gain)

        time.sleep(1)

    def is_ready(self):
        return GPIO.input(self.DOUT) == 0

    def set_gain(self, gain):
        if gain is 128:
            self.GAIN = 1
        elif gain is 64:
            self.GAIN = 3
        elif gain is 32:
            self.GAIN = 2

        GPIO.output(self.PD_SCK, False)
        self.read()
    
    def createBoolList(self, size=8):
        ret = []
        for i in range(8):
            ret.append(False)
        return ret

    def read(self):
        while not self.is_ready():
            #print("WAITING")
            pass

        dataBits = [self.createBoolList(), self.createBoolList(), self.createBoolList()]
        dataBytes = [0x0] * 4

        for j in range(self.byte_range_values[0], self.byte_range_values[1], self.byte_range_values[2]):
            for i in range(self.bit_range_values[0], self.bit_range_values[1], self.bit_range_values[2]):
                GPIO.output(self.PD_SCK, True)
                dataBits[j][i] = GPIO.input(self.DOUT)
                GPIO.output(self.PD_SCK, False)
            dataBytes[j] = numpy.packbits(numpy.uint8(dataBits[j]))

        #set channel and gain factor for next reading
        for i in range(self.GAIN):
            GPIO.output(self.PD_SCK, True)
            GPIO.output(self.PD_SCK, False)

        #check for all 1
        #if all(item is True for item in dataBits[0]):
        #    return long(self.lastVal)

        dataBytes[2] ^= 0x80

        return dataBytes

    def get_binary_string(self):
        binary_format = "{0:b}"
        np_arr8 = self.read_np_arr8()
        binary_string = ""
        for i in range(4):
            # binary_segment = binary_format.format(np_arr8[i])
            binary_segment = format(np_arr8[i], '#010b')
            binary_string += binary_segment + " "
        return binary_string

    def get_np_arr8_string(self):
        np_arr8 = self.read_np_arr8()
        np_arr8_string = "[";
        comma = ", "
        for i in range(4):
            if i is 3:
                comma = ""
            np_arr8_string += str(np_arr8[i]) + comma
        np_arr8_string += "]";
        
        return np_arr8_string

    def read_np_arr8(self):
        dataBytes = self.read()
        np_arr8 = numpy.uint8(dataBytes)

        return np_arr8

    def read_long(self):
        np_arr8 = self.read_np_arr8()
        np_arr32 = np_arr8.view('uint32')
        self.lastVal = np_arr32

        return self.lastVal

    def read_average(self, times=3):
        values = 0
        for i in range(times):
            values += self.read_long()

        return values / times

    def get_value(self, times=3):
        return self.read_average(times) - self.OFFSET

    def get_weight(self, times=3):
        value = self.get_value(times)
        value = value / self.REFERENCE_UNIT
        return value

    def tare(self, times=15):
       
        # Backup REFERENCE_UNIT value
        reference_unit = self.REFERENCE_UNIT
        self.set_reference_unit(1)

        value = self.read_average(times)
        self.set_offset(value)

        self.set_reference_unit(reference_unit)

    def set_reading_format(self, byte_format="LSB", bit_format="MSB"):
        if byte_format == "LSB":
            self.byte_range_values = self.LSByte
        elif byte_format == "MSB":
            self.byte_range_values = self.MSByte

        if bit_format == "LSB":
            self.bit_range_values = self.LSBit
        elif bit_format == "MSB":
            self.bit_range_values = self.MSBit

    def set_offset(self, offset):
        self.OFFSET = offset

    def set_reference_unit(self, reference_unit):
        self.REFERENCE_UNIT = reference_unit

    # HX711 datasheet states that setting the PDA_CLOCK pin on high for a more than 60 microseconds would power off the chip.
    # I used 100 microseconds, just in case.
    # I've found it is good practice to reset the hx711 if it wasn't used for more than a few seconds.
    def power_down(self):
        GPIO.output(self.PD_SCK, False)
        GPIO.output(self.PD_SCK, True)
        time.sleep(0.0001)

    def power_up(self):
        GPIO.output(self.PD_SCK, False)
        time.sleep(0.0001)

    def reset(self):
        self.power_down()
        self.power_up()

Code: Select all

import RPi.GPIO as GPIO
import time
import sys
from weight import HX711

def cleanAndExit():
    print("Cleaning...")
    GPIO.cleanup()
    print("Bye!")
    sys.exit()

hx = HX711(9, 11)

# I've found out that, for some reason, the order of the bytes is not always the same between versions of python, numpy and the hx711 itself.
# Still need to figure out why does it change.
# If you're experiencing super random values, change these values to MSB or LSB until to get more stable values.
# There is some code below to debug and log the order of the bits and the bytes.
# The first parameter is the order in which the bytes are used to build the "long" value.
# The second paramter is the order of the bits inside each byte.
# According to the HX711 Datasheet, the second parameter is MSB so you shouldn't need to modify it.
hx.set_reading_format("LSB", "MSB")

# HOW TO CALCULATE THE REFFERENCE UNIT
# To set the reference unit to 1. Put 1kg on your sensor or anything you have and know exactly how much it weights.
# In this case, 92 is 1 gram because, with 1 as a reference unit I got numbers near 0 without any weight
# and I got numbers around 184000 when I added 2kg. So, according to the rule of thirds:
# If 2000 grams is 184000 then 1000 grams is 184000 / 2000 = 92.
#hx.set_reference_unit(113)
hx.set_reference_unit(1)

hx.reset()
hx.tare()

while True:
    try:
        # These three lines are usefull to debug wether to use MSB or LSB in the reading formats
        # for the first parameter of "hx.set_reading_format("LSB", "MSB")".
        # Comment the two lines "val = hx.get_weight(5)" and "print val" and uncomment the three lines to see what it prints.
        #np_arr8_string = hx.get_np_arr8_string()
        #binary_string = hx.get_binary_string()
        #print binary_string + " " + np_arr8_string
        
        # Prints the weight. Comment if you're debbuging the MSB and LSB issue.
        val = hx.get_weight(5)
        print(val)

        hx.power_down()
        hx.power_up()
        time.sleep(0.5)
    except (KeyboardInterrupt, SystemExit):
        cleanAndExit()
As we can see, i've set referencUnit to 1 for testing 0 weight.
Some now here are my problems:

First of all : What mean "gain", when i change him, i have totally differents values with less or more fluctuation.
Second : I've my load cell just put on my table without any weight, but i have negative result with reference unit to 1 and gain to 32 as follow :

python3 testWeight.py
[-493.06666667]
[-489.06666667]
[-493.06666667]
[-503.06666667]
[-506.66666667]
[-1284.66666667]
[-488.46666667]
[-929.86666667]
[-544.66666667]
[-538.06666667]
[-92.66666667]
[-496.66666667]
[-611.86666667]
[-502.46666667]
[-473.66666667]
[-491.46666667]
Cleaning...
Bye!

We can see an average around -500 but there is some strange fluctuation such as "-92, -1284" so i don't understand the fluctuation and the negative value.

Thirdly : How should i calibrate the weight sensor to get the reference unit, i mean when i set an objet on the load cell, values stayed unchange..

Thank you for your help and tell me if you need more informations
Have a good day.

User avatar
joan
Posts: 14376
Joined: Thu Jul 05, 2012 5:09 pm
Location: UK

Re: Load cell and HX711

Mon May 15, 2017 10:27 am

Have a look at my pigpio HX711 Python class.

http://abyz.co.uk/rpi/pigpio/examples.h ... n_HX711_py

Seregone
Posts: 30
Joined: Tue Apr 04, 2017 2:54 pm

Re: Load cell and HX711

Mon May 15, 2017 10:37 am

Hi thank for your reply :
I've change nothing except your script and here is the output :

python3 HX711.py
start with CH_B_GAIN_32 and callback
Change mode to CH_A_GAIN_64
Change mode to CH_A_GAIN_128
Pause
Start
1 1 -2294
2 1 -2268
3 1 -2261
4 1 -2279
5 1 -2271
6 1 -2231
7 1 -2231
8 1 -2226
9 1 -2208
10 1 -2205
11 1 -2219
12 1 -2211
13 1 -2246
14 1 -2285
15 1 -2258
16 1 -2216
17 1 -2188
18 1 -2204
19 1 -2184
20 1 -2192
21 1 -2181
22 1 -2187
23 1 -2152
24 1 -2209
25 1 -2242
26 1 -2177
27 1 -2204
28 1 -2192
29 1 -2155
30 1 -2179
31 1 -2148
32 1 -2186
33 1 -2195
34 1 -2146
35 1 -2153
36 1 -2180
37 1 -2190
38 1 -2130
39 1 -2137
40 1 -2187
41 1 -2170
42 1 -2175
43 1 -2175
44 1 -2157
45 1 -2205
46 1 -2148
47 1 -2143
48 1 -2148
Cancel callback and read manually
48
1 -2141
1 -2188
1 -2229
1 -2190
1 -2201
1 -2181
1 -2155
1 -2183
1 -2164
1 -2117
1 -2164
1 -2164
1 -2154
1 -2175
1 -2160
1 -2145
1 -2109
1 -2156
1 -2133
1 -2199
1 -2163
1 -2155
1 -2185
1 -2194
1 -2192
1 -2183
1 -2210
1 -2211
1 -2227
1 -2163
1 -2151
1 -2150
1 -2120
1 -2083
1 -2134
1 -2174
1 -2219
1 -2181
1 -2171
1 -2153
1 -2182
1 -2199
1 -2141
1 -2167
1 -2172
1 -2145
1 -2113
1 -2172
1 -2175
1 -2190
1 -2177
1 -2221
1 -2211
1 -2187

Is that result correct ? And what should i do with them ?
Thanks

User avatar
joan
Posts: 14376
Joined: Thu Jul 05, 2012 5:09 pm
Location: UK

Re: Load cell and HX711

Mon May 15, 2017 11:09 am

It's a year since I looked at the HX711.

The negative values are a bit of a surprise.

The script expects the data pin to be connected to GPIO 9 (Pi pin 21) and the clock pin on GPIO 11 (Pi pin 23).

Is that what you have connected?

Seregone
Posts: 30
Joined: Tue Apr 04, 2017 2:54 pm

Re: Load cell and HX711

Mon May 15, 2017 11:50 am

I've check again and yes there are connected like this :/

Any idea from what this problem can come from ? Did i need to change a value in your script ? Or make something special with my load cell ?

User avatar
joan
Posts: 14376
Joined: Thu Jul 05, 2012 5:09 pm
Location: UK

Re: Load cell and HX711

Mon May 15, 2017 11:59 am

Seregone wrote:I've check again and yes there are connected like this :/

Any idea from what this problem can come from ? Did i need to change a value in your script ? Or make something special with my load cell ?
I'm not sure.

I would experiment with different loads.

Are the readings consistent for a particular load? Do the readings vary with load?

Seregone
Posts: 30
Joined: Tue Apr 04, 2017 2:54 pm

Re: Load cell and HX711

Mon May 15, 2017 12:11 pm

No i'm trying to put my hand with a little pressure on the load to simulate a load but value are not changing :/

Thank you for being reactive in reply !

User avatar
joan
Posts: 14376
Joined: Thu Jul 05, 2012 5:09 pm
Location: UK

Re: Load cell and HX711

Mon May 15, 2017 12:41 pm

Hard to know what to suggest. The readings look like they are coming from the HX711 as they are non-zero, vary, but are consistent.

Perhaps confirm the above by removing power from the HX711 or removing one of the data or clock wires.

To my mind that suggests a problem between the load cell and the HX711.

Seregone
Posts: 30
Joined: Tue Apr 04, 2017 2:54 pm

Re: Load cell and HX711

Mon May 15, 2017 1:02 pm

So here are the result :

Without power :

start with CH_B_GAIN_32 and callback
Change mode to CH_A_GAIN_64
Change mode to CH_A_GAIN_128
Pause
Start
Cancel callback and read manually
0

Without DT :

start with CH_B_GAIN_32 and callback
Change mode to CH_A_GAIN_64
Change mode to CH_A_GAIN_128
Pause
Start
Cancel callback and read manually
0

Wihtout SCK :

start with CH_B_GAIN_32 and callback
Change mode to CH_A_GAIN_64
Change mode to CH_A_GAIN_128
Pause
Start
Cancel callback and read manually
0

With everyting wires :

Code: Select all

start with CH_B_GAIN_32 and callback
1 2 -2322
2 2 -869
3 2 -524
4 2 -370
5 2 -201
6 2 -115
7 2 -17
8 2 78
9 2 110
10 2 109
11 2 87
12 2 120
13 2 166
14 2 170
15 2 203
16 2 237
17 2 204
18 2 149
19 2 164
20 2 200
21 2 217
22 2 212
23 2 205
24 2 191
25 2 185
26 2 170
27 2 179
28 2 187
29 2 258
30 2 227
31 2 181
32 2 196
33 2 201
34 2 179
35 2 182
36 2 188
37 2 170
38 2 162
39 2 208
40 2 158
41 2 121
42 2 121
43 2 165
44 2 192
Change mode to CH_A_GAIN_64
45 0 -1868
46 0 -1873
47 0 -1862
48 0 -1838
49 0 -1852
50 0 -1865
51 0 -1872
52 0 -1890
53 0 -1866
54 0 -1881
55 0 -1887
56 0 -1842
57 0 -1867
58 0 -1886
59 0 -1855
60 0 -1877
61 0 -1906
62 0 -1878
63 0 -1856
64 0 -1871
65 0 -1868
66 0 -1879
67 0 -1903
68 0 -1894
69 0 -1891
70 0 -1857
71 0 -1813
72 0 -1852
73 0 -1883
74 0 -1877
75 0 -1859
76 0 -1874
77 0 -1877
78 0 -1885
79 0 -1869
80 0 -1825
81 0 -1857
82 0 -1906
83 0 -1896
84 0 -1882
85 0 -1866
86 0 -1878
87 0 -1911
88 0 -1872
89 0 -1840
90 0 -1873
91 0 -1871
92 0 -1862
Change mode to CH_A_GAIN_128
93 1 -2215
94 1 -2128
95 1 -2135
96 1 -2169
97 1 -2226
98 1 -2255
99 1 -2312
100 1 -2322
101 1 -2353
102 1 -2233
103 1 -2239
104 1 -2243
105 1 -2225
106 1 -2211
107 1 -2260
108 1 -2246
109 1 -2233
110 1 -2203
111 1 -2188
112 1 -2189
113 1 -2200
114 1 -2214
115 1 -2194
116 1 -2205
117 1 -2224
118 1 -2187
119 1 -2181
120 1 -2220
121 1 -2224
122 1 -2213
123 1 -2223
124 1 -2199
125 1 -2182
126 1 -2222
127 1 -2230
128 1 -2219
129 1 -2253
130 1 -2256
131 1 -2188
132 1 -2156
133 1 -2205
134 1 -2230
135 1 -2244
136 1 -2276
137 1 -2209
138 1 -2206
139 1 -2197
140 1 -2244
141 1 -2253
142 1 -2258
Pause
Start
143 1 -2371
144 1 -2340
145 1 -2387
146 1 -2331
147 1 -2254
148 1 -2301
149 1 -2330
150 1 -2305
151 1 -2323
152 1 -2349
153 1 -2313
154 1 -2327
155 1 -2312
156 1 -2249
157 1 -2262
158 1 -2277
159 1 -2276
160 1 -2276
161 1 -2290
162 1 -2236
163 1 -2264
164 1 -2267
165 1 -2237
166 1 -2255
167 1 -2219
168 1 -2176
169 1 -2213
170 1 -2301
171 1 -2295
172 1 -2272
173 1 -2184
174 1 -2185
175 1 -2234
176 1 -2273
177 1 -2242
178 1 -2239
179 1 -2194
180 1 -2212
181 1 -2266
182 1 -2228
183 1 -2245
184 1 -2255
185 1 -2222
186 1 -2236
187 1 -2252
188 1 -2282
189 1 -2275
190 1 -2243
191 1 -2239
Cancel callback and read manually
191
1 -2176
1 -2146
1 -2155
1 -2158
1 -2225
1 -2237
1 -2239
1 -2256
1 -2195
1 -2212
1 -2275
1 -2281
1 -2261
1 -2239
1 -2270
1 -2265
1 -2195
1 -2254
1 -2291
1 -2298
1 -2221
1 -2214
1 -2242
1 -2211
1 -2212
1 -2215
1 -2224
1 -2186
1 -2197
1 -2188
1 -2212
1 -2240
1 -2251
1 -2261
1 -2239
1 -2224
1 -2179
1 -2248
1 -2227
1 -2162
1 -2160
1 -2235
1 -2301
1 -2292
1 -2204
1 -2213
1 -2205
1 -2257
1 -2208
1 -2191
1 -2202
1 -2213
1 -2298
1 -2295
Note that with everything wire, i have positive value in the first set, why ? I don't really understand !
So as you say, it's probably a wire problem between load cell and load cell ? My wire at first post seem correct no ?

Thanks again !

Seregone
Posts: 30
Joined: Tue Apr 04, 2017 2:54 pm

Re: Load cell and HX711

Mon May 15, 2017 1:12 pm

Update :I have remanage wires and now the first ouput seem more consistent and still positive :

Code: Select all

start with CH_B_GAIN_32 and callback
1 2 -2417
2 2 4336
3 2 4359
4 2 4363
5 2 4390
6 2 4359
7 2 4323
8 2 4346
9 2 4366
10 2 4359
11 2 4302
12 2 4309
13 2 4351
14 2 4355
15 2 4340
16 2 4351
17 2 4365
18 2 4366
19 2 4359
20 2 4337
21 2 4331
22 2 4345
23 2 4354
24 2 4325
25 2 4345
26 2 4372
27 2 4324
28 2 4341
29 2 4362
30 2 4366
31 2 4389
32 2 4397
33 2 4393
34 2 4392
35 2 4390
36 2 4368
37 2 4368
38 2 4401
39 2 4383
40 2 4358
41 2 4346
42 2 4369
43 2 4339
44 2 4334
45 2 4343
Change mode to CH_A_GAIN_64
46 0 -1926
47 0 -1877
48 0 -1893
49 0 -1894
50 0 -1881
51 0 -1886
52 0 -1898
53 0 -1902
54 0 -1907
55 0 -1906
56 0 -1906
57 0 -1907
58 0 -1902
59 0 -1895
60 0 -1869
61 0 -1897
62 0 -1905
63 0 -1914
64 0 -1910
65 0 -1910
66 0 -1918
67 0 -1895
68 0 -1891
69 0 -1938
70 0 -1932
71 0 -1920
72 0 -1881
73 0 -1871
74 0 -1893
75 0 -1921
76 0 -1885
77 0 -1881
78 0 -1908
79 0 -1914
80 0 -1920
81 0 -1902
82 0 -1885
83 0 -1879
84 0 -1900
85 0 -1903
86 0 -1919
87 0 -1909
88 0 -1944
89 0 -1932
90 0 -1899
91 0 -1873
92 0 -1911
93 0 -1889
Change mode to CH_A_GAIN_128
94 1 -2257
95 1 -2262
96 1 -2246
97 1 -2295
98 1 -2292
99 1 -2252
100 1 -2311
101 1 -2335
102 1 -2322
103 1 -2341
104 1 -2318
105 1 -2346
106 1 -2315
107 1 -2242
108 1 -2261
109 1 -2241
110 1 -2248
111 1 -2236
112 1 -2219
113 1 -2282
114 1 -2249
115 1 -2294
116 1 -2275
117 1 -2242
118 1 -2263
119 1 -2320
120 1 -2310
121 1 -2336
122 1 -2392
123 1 -2302
124 1 -2290
125 1 -2291
126 1 -2298
127 1 -2278
128 1 -2257
129 1 -2288
130 1 -2291
131 1 -2293
132 1 -2300
133 1 -2269
134 1 -2289
135 1 -2337
136 1 -2296
137 1 -2226
138 1 -2248
139 1 -2261
140 1 -2309
141 1 -2278
142 1 -2282
143 1 -2290
Pause
Start
144 1 -2424
145 1 -2366
146 1 -2358
147 1 -2405
148 1 -2391
149 1 -2379
150 1 -2374
151 1 -2338
152 1 -2332
153 1 -2349
154 1 -2362
155 1 -2331
156 1 -2379
157 1 -2378
158 1 -2387
159 1 -2390
160 1 -2337
161 1 -2320
162 1 -2363
163 1 -2350
164 1 -2364
165 1 -2379
166 1 -2323
167 1 -2335
168 1 -2331
169 1 -2349
170 1 -2356
171 1 -2304
172 1 -2279
173 1 -2316
174 1 -2292
175 1 -2286
176 1 -2287
177 1 -2319
178 1 -2276
179 1 -2284
180 1 -2316
181 1 -2328
182 1 -2332
183 1 -2306
184 1 -2349
185 1 -2325
186 1 -2335
187 1 -2319
188 1 -2272
189 1 -2338
190 1 -2324
191 1 -2289
192 1 -2288
193 1 -2269
Cancel callback and read manually
193
1 -2273
1 -2279
1 -2286
1 -2321
1 -2275
1 -2238
1 -2252
1 -2267
1 -2255
1 -2294
1 -2279
1 -2274
1 -2310
1 -2300
1 -2294
1 -2312
1 -2300
1 -2318
1 -2288
1 -2279
1 -2251
1 -2285
1 -2311
1 -2329
1 -2298
1 -2331
1 -2314
1 -2296
1 -2323
1 -2248
1 -2223
1 -2271
1 -2281
1 -2313
1 -2349
1 -2316
1 -2284
1 -2284
1 -2312
1 -2300
1 -2216
1 -2255
1 -2300
1 -2314
1 -2338
1 -2332
1 -2279
1 -2252
1 -2244
1 -2224
1 -2225
1 -2294
1 -2292


Seregone
Posts: 30
Joined: Tue Apr 04, 2017 2:54 pm

Re: Load cell and HX711

Tue May 16, 2017 4:42 pm

Up ! :(

I really don't understand what is going wrong with my load cell but i've still have tis ~ -2300 value and i don't get why ...

Any suggestion ?

User avatar
joan
Posts: 14376
Joined: Thu Jul 05, 2012 5:09 pm
Location: UK

Re: Load cell and HX711

Tue May 16, 2017 4:45 pm

Could you post some clear photos showing the various connections?

Seregone
Posts: 30
Joined: Tue Apr 04, 2017 2:54 pm

Re: Load cell and HX711

Tue May 16, 2017 5:36 pm

Hey thanks for the reply ! Here are the photos, sorry i can't really do more clear because the loadcell take part on a larger project but i think we can see clearly the wires targeted for the load cell and hx711:

Load cell to HX711 :

http://hpics.li/d4c1753

HX711 to pi :
http://hpics.li/9f2009e

Thanks

Seregone
Posts: 30
Joined: Tue Apr 04, 2017 2:54 pm

Re: Load cell and HX711

Wed May 17, 2017 9:18 pm

Up :oops:

My photos aren't clear enough maybe ? :x

User avatar
joan
Posts: 14376
Joined: Thu Jul 05, 2012 5:09 pm
Location: UK

Re: Load cell and HX711

Wed May 17, 2017 9:57 pm

Seregone wrote:Up :oops:

My photos aren't clear enough maybe ? :x
I couldn't see anything wrong with the Pi - HX711 connections. Can't comment on the others.

Seregone
Posts: 30
Joined: Tue Apr 04, 2017 2:54 pm

Re: Load cell and HX711

Thu May 18, 2017 12:22 pm

Hi ! You can't comment the load cell - HX711 connection because the photos isn't clear enough or because you won't see any problems in the connections ?

User avatar
joan
Posts: 14376
Joined: Thu Jul 05, 2012 5:09 pm
Location: UK

Re: Load cell and HX711

Thu May 18, 2017 1:07 pm

Seregone wrote:Hi ! You can't comment the load cell - HX711 connection because the photos isn't clear enough or because you won't see any problems in the connections ?
Neither, because I am not competent to judge! I have no experience with actual load cells.

If I can find my HX711 module I'll hook it up later and see if there is an alternative testing method.

Seregone
Posts: 30
Joined: Tue Apr 04, 2017 2:54 pm

Re: Load cell and HX711

Thu May 18, 2017 3:01 pm

Ok thank you for your help

User avatar
joan
Posts: 14376
Joined: Thu Jul 05, 2012 5:09 pm
Location: UK

Re: Load cell and HX711

Fri May 19, 2017 11:21 am

I have set up a test circuit.

My HX711 module has the SPI interface and connections E+/- for the excitation voltage output to the load cell and A+/-, B+/- inputs from the load cell.

I left E+/- unconnected as irrelevant to a test.

I put a 700k resistor in series with a 10k pot. I fed 3V3 into the resistor and ground to the pot. I connected ground to B- and the pot wiper to B+.

The B+/- interface is 80mV full scale (HX711 spec). The test should give (10/710)*3300 maximum, or 46.5mV maximum.

Twiddling the pot gave the following in a 120 second test. The software works, it may just need a different interpretation for the scale.

I went from one extreme to the other several times and then left the pot centred.
HX711.png
HX711.png (36.65 KiB) Viewed 14754 times

Heavenwalker
Posts: 1
Joined: Sat Oct 07, 2017 9:31 pm

Re: Load cell and HX711

Sat Oct 07, 2017 9:34 pm

Hello,

I am experiencing the exams same results. May I ask if you succeeded in calibrating the load sensor eventually ?

Thank you.

mjay
Posts: 1
Joined: Tue Jan 02, 2018 10:06 pm

Re: Load cell and HX711

Tue Jan 02, 2018 10:09 pm

for me it turned out that connecting the HX711's VCC to 3.3V instead of 5V was the solution. With 5V I get really varying results while they are stable with 3.3V. Probably this depends on the loading cell you are using. Br

abinaya kannan
Posts: 1
Joined: Sat Dec 08, 2018 12:43 pm

Re: Load cell and HX711

Sat Dec 08, 2018 12:53 pm

i am using raspberry pi 3. can anyone please send correct load cell python code and also I need weight formula with simple and clear explanation.. :cry: Thank you

lixunhui
Posts: 1
Joined: Sat Oct 12, 2019 7:24 am

Re: Load cell and HX711

Sat Oct 12, 2019 7:29 am

abinaya kannan wrote:
Sat Dec 08, 2018 12:53 pm
i am using raspberry pi 3. can anyone please send correct load cell python code and also I need weight formula with simple and clear explanation.. :cry: Thank you
Do you accomplish it?i am using raspberry pi 4b,but alway get the wrong value

User avatar
joan
Posts: 14376
Joined: Thu Jul 05, 2012 5:09 pm
Location: UK

Re: Load cell and HX711

Sun Oct 13, 2019 12:20 pm

lixunhui wrote:
Sat Oct 12, 2019 7:29 am
abinaya kannan wrote:
Sat Dec 08, 2018 12:53 pm
i am using raspberry pi 3. can anyone please send correct load cell python code and also I need weight formula with simple and clear explanation.. :cry: Thank you
Do you accomplish it?i am using raspberry pi 4b,but alway get the wrong value
What software? How is it wired?

Return to “General discussion”