Scale project problem

Hi there

I am trying to build a scale with the following components:

ESP8266 aka Wemos D1 mini
HX711
Load cell [Load Sensor - 50kg (Generic) ]

I followed this tutorial where I used the below wiring from the right side of the HX711 and D1.

I plan to use 4 cells and used the wiring below between the load cell and HX711 ([50kg Load Cells with HX711 and Arduino. 4x, 2x, 1x Diagrams. - Circuit Journal ]

The problem is when I place weight on the scale, the values go down and when I take weight off the values go up. They are moving in the opposite direction. I have tried flipping the black and white wires, as it seems that can be the problem but that did not help. Any suggestions or assistance with troubleshooting would be helpful.

Other links I have used for input on this project:

No idea what your b/w are…
Anyway, if it’s working properly you can simply invert the calibrate_linear values without playing with the wiring.

1 Like

How can i do that?

how is your yaml?

Here is what i have.

esphome:
  name: keg01-scale
  friendly_name: Keg01-Scale

esp8266:
  #board: esp01_1m
  board: d1_mini

# Enable logging
logger:

# Enable Home Assistant API
api:
  encryption:
    key: "key"

ota:
  - platform: esphome
    password: "pw"

wifi:
  ssid: ssid
  password: ssidpw
  #fast_connect: True

  # Enable fallback hotspot (captive portal) in case wifi connection fails
  ap:
    ssid: "Keg01-Scale Fallback Hotspot"
    password: "pw"

captive_portal:

sensor:
  - platform: hx711
    name: "HX711 Value"
    dout_pin: D2
    clk_pin: D1
    gain: 128
    update_interval: 5s

Have you tried switching the E+ and E- wires? Those are the excitation signals for the Wheatstone Bridge you’ve built here, switching them around should invert the polarity (as it says in the tutorial you linked)

Probably (but others may correct me if I’m wrong) you could just as well put a - sign in front of the ‘gain’ parameter?

Hello,

Section converting units of the esphome doc:

And your code will look like:


sensor:
  - platform: hx711
    # ... Other HX711 options
    filters:
      - calibrate_linear:
          - -120 -> 0
          - -810 -> 1
    unit_of_measurement: kg

Probably you have to swap the connection to the E+ E- and A+ and A-, probably:
LR > E+
UL > E-
UR > A+
LL > A-
Like reversing the X

You don’t have any linear calibration on your code (yet).
When you add that you just change the sign and you don’t need to rewire your setup.

Here are the results after fliping the e± and a+ variations

[21:26:15][D][hx711:031]: ‘HX711 Value’: Got value 357113
[21:26:15][D][sensor:093]: ‘HX711 Value’: Sending state 357113.00000 with 0 decimals of accuracy
[21:26:20][D][hx711:031]: ‘HX711 Value’: Got value 356120
[21:26:20][D][sensor:093]: ‘HX711 Value’: Sending state 356120.00000 with 0 decimals of accuracy
[21:26:25][D][hx711:031]: ‘HX711 Value’: Got value 323168
[21:26:25][D][sensor:093]: ‘HX711 Value’: Sending state 323168.00000 with 0 decimals of accuracy
[21:26:30][D][hx711:031]: ‘HX711 Value’: Got value 322763
[21:26:30][D][sensor:093]: ‘HX711 Value’: Sending state 322763.00000 with 0 decimals of accuracy
[21:26:35][D][hx711:031]: ‘HX711 Value’: Got value 322562
[21:26:35][D][sensor:093]: ‘HX711 Value’: Sending state 322562.00000 with 0 decimals of accuracy

swapped a±

[21:27:25][D][sensor:093]: ‘HX711 Value’: Sending state -317240.00000 with 0 decimals of accuracy
[21:27:30][D][hx711:031]: ‘HX711 Value’: Got value -317230
[21:27:30][D][sensor:093]: ‘HX711 Value’: Sending state -317230.00000 with 0 decimals of accuracy
[21:27:35][D][hx711:031]: ‘HX711 Value’: Got value -299204
[21:27:35][D][sensor:093]: ‘HX711 Value’: Sending state -299204.00000 with 0 decimals of accuracy
[21:27:40][D][hx711:031]: ‘HX711 Value’: Got value -300118
[21:27:40][D][sensor:093]: ‘HX711 Value’: Sending state -300118.00000 with 0 decimals of accuracy
[21:27:45][D][hx711:031]: ‘HX711 Value’: Got value -300007
[21:27:45][D][sensor:093]: ‘HX711 Value’: Sending state -300007.00000 with 0 decimals of accuracy
[21:27:50][D][hx711:031]: ‘HX711 Value’: Got value -299920
[21:27:50][D][sensor:093]: ‘HX711 Value’: Sending state -299920.00000 with 0 decimals of accuracy

swapped e± – Numbers look to go the right direction now.

[21:37:20][D][sensor:093]: ‘HX711 Value’: Sending state 341239.00000 with 0 decimals of accuracy
[21:37:25][D][hx711:031]: ‘HX711 Value’: Got value 341282
[21:37:25][D][sensor:093]: ‘HX711 Value’: Sending state 341282.00000 with 0 decimals of accuracy
[21:37:30][D][hx711:031]: ‘HX711 Value’: Got value 341322
[21:37:30][D][sensor:093]: ‘HX711 Value’: Sending state 341322.00000 with 0 decimals of accuracy
[21:37:35][D][hx711:031]: ‘HX711 Value’: Got value 341412
[21:37:35][D][sensor:093]: ‘HX711 Value’: Sending state 341412.00000 with 0 decimals of accuracy
[21:37:40][D][hx711:031]: ‘HX711 Value’: Got value 362149
[21:37:40][D][sensor:093]: ‘HX711 Value’: Sending state 362149.00000 with 0 decimals of accuracy
[21:37:45][D][hx711:031]: ‘HX711 Value’: Got value 361796
[21:37:45][D][sensor:093]: ‘HX711 Value’: Sending state 361796.00000 with 0 decimals of accuracy
[21:37:50][D][hx711:031]: ‘HX711 Value’: Got value 361791
[21:37:50][D][sensor:093]: ‘HX711 Value’: Sending state 361791.00000 with 0 decimals of accuracy

second sampling not looking right no changes made

21:40:50][D][hx711:031]: ‘HX711 Value’: Got value 387033
[21:40:50][D][sensor:093]: ‘HX711 Value’: Sending state 387033.00000 with 0 decimals of accuracy
[21:40:55][D][hx711:031]: ‘HX711 Value’: Got value 387010
[21:40:55][D][sensor:093]: ‘HX711 Value’: Sending state 387010.00000 with 0 decimals of accuracy
[21:41:00][D][hx711:031]: ‘HX711 Value’: Got value 386867
[21:41:00][D][sensor:093]: ‘HX711 Value’: Sending state 386867.00000 with 0 decimals of accuracy
[21:41:05][D][hx711:031]: ‘HX711 Value’: Got value 373920
[21:41:05][D][sensor:093]: ‘HX711 Value’: Sending state 373920.00000 with 0 decimals of accuracy
[21:41:10][D][hx711:031]: ‘HX711 Value’: Got value 373090
[21:41:10][D][sensor:093]: ‘HX711 Value’: Sending state 373090.00000 with 0 decimals of accuracy
[21:41:15][D][hx711:031]: ‘HX711 Value’: Got value 372702
[21:41:15][D][sensor:093]: ‘HX711 Value’: Sending state 372702.00000 with 0 decimals of accuracy

moved the a± back

[21:42:10][D][sensor:093]: ‘HX711 Value’: Sending state -394829.00000 with 0 decimals of accuracy
[21:42:15][D][hx711:031]: ‘HX711 Value’: Got value -395254
[21:42:15][D][sensor:093]: ‘HX711 Value’: Sending state -395254.00000 with 0 decimals of accuracy
[21:42:20][D][hx711:031]: ‘HX711 Value’: Got value -395342
[21:42:20][D][sensor:093]: ‘HX711 Value’: Sending state -395342.00000 with 0 decimals of accuracy
[21:42:25][D][hx711:031]: ‘HX711 Value’: Got value -385118
[21:42:25][D][sensor:093]: ‘HX711 Value’: Sending state -385118.00000 with 0 decimals of accuracy
[21:42:30][D][hx711:031]: ‘HX711 Value’: Got value -384550
[21:42:30][D][sensor:093]: ‘HX711 Value’: Sending state -384550.00000 with 0 decimals of accuracy
[21:42:35][D][hx711:031]: ‘HX711 Value’: Got value -384168
[21:42:35][D][sensor:093]: ‘HX711 Value’: Sending state -384168.00000 with 0 decimals of accuracy

If I add this to the code I see the same results. I am testing with something at 1090 grams.

21:50:15][D][sensor:093]: ‘HX711 Value’: Sending state 524.88556 kg with 0 decimals of accuracy
[21:50:20][D][hx711:031]: ‘HX711 Value’: Got value -335196
[21:50:20][D][sensor:093]: ‘HX711 Value’: Sending state 485.61740 kg with 0 decimals of accuracy
[21:50:25][D][hx711:031]: ‘HX711 Value’: Got value -334487
[21:50:25][D][sensor:093]: ‘HX711 Value’: Sending state 484.58987 kg with 0 decimals of accuracy

Could this be a problem with a soder or a dupunt connecter? Would there be a way to validate the connections?

Hello,

You should adapt the data according to your output.

Like:

Signal with 0 kg on scale → 0
Signal with 1 kg on scale → 1

You can’t just copy my code, i don’t have your raw data

Very interesting. I should have calabrated it to begin with. I used a 5lb weight.

While the numbers went down on the reading, it was still accurate.

Numbers I used to feed the config:

10:59:14][D][hx711:031]: ‘HX711 Value’: Got value 556076
[10:59:14][D][sensor:093]: ‘HX711 Value’: Sending state 556076.00000 with 0 decimals of accuracy
[10:59:19][D][hx711:031]: ‘HX711 Value’: Got value 555853
[10:59:19][D][sensor:093]: ‘HX711 Value’: Sending state 555853.00000 with 0 decimals of accuracy
[10:59:24][D][hx711:031]: ‘HX711 Value’: Got value 555853
[10:59:24][D][sensor:093]: ‘HX711 Value’: Sending state 555853.00000 with 0 decimals of accuracy
[10:59:29][D][hx711:031]: ‘HX711 Value’: Got value 555560
[10:59:29][D][sensor:093]: ‘HX711 Value’: Sending state 555560.00000 with 0 decimals of accuracy
[10:59:34][D][hx711:031]: ‘HX711 Value’: Got value 555297
[10:59:34][D][sensor:093]: ‘HX711 Value’: Sending state 555297.00000 with 0 decimals of accuracy

11:00:34][D][sensor:093]: ‘HX711 Value’: Sending state 353918.00000 with 0 decimals of accuracy
[11:00:39][D][hx711:031]: ‘HX711 Value’: Got value 353209
[11:00:40][D][sensor:093]: ‘HX711 Value’: Sending state 353209.00000 with 0 decimals of accuracy
[11:00:44][D][hx711:031]: ‘HX711 Value’: Got value 352907
[11:00:44][D][sensor:093]: ‘HX711 Value’: Sending state 352907.00000 with 0 decimals of accuracy
[11:00:49][D][hx711:031]: ‘HX711 Value’: Got value 352728
[11:00:49][D][sensor:093]: ‘HX711 Value’: Sending state 352728.00000 with 0 decimals of accuracy
[11:00:54][D][hx711:031]: ‘HX711 Value’: Got value 352471
[11:00:54][D][sensor:093]: ‘HX711 Value’: Sending state 352471.00000 with 0 decimals of accuracy


sensor:
  - platform: hx711
    name: "HX711 Value"
    dout_pin: D2
    clk_pin: D1
    gain: 128
    update_interval: 5s
    filters:
      - calibrate_linear:
          - 555727.8 -> 0
          - 352828.75 -> 4.87
    unit_of_measurement: lb

There may still be some accuracy to work on, but I will work on that with further testing once I have a keg on it.

[11:20:16][D][sensor:093]: ‘HX711 Value’: Sending state 2.82936 lb with 0 decimals of accuracy
[11:20:21][D][hx711:031]: ‘HX711 Value’: Got value 437685
[11:20:21][D][sensor:093]: ‘HX711 Value’: Sending state 2.83327 lb with 0 decimals of accuracy
[11:20:26][D][hx711:031]: ‘HX711 Value’: Got value 437652
[11:20:26][D][sensor:093]: ‘HX711 Value’: Sending state 2.83407 lb with 0 decimals of accuracy
[11:20:31][D][hx711:031]: ‘HX711 Value’: Got value 437553
[11:20:31][D][sensor:093]: ‘HX711 Value’: Sending state 2.83644 lb with 0 decimals of accuracy

Good to hear it works!
Some load cell might have double “direction” of measurement compression and extension.
Might be that in your case you should pull instead of pushing to produce positive signal (increase signal with increasing weight)?
I mean might be the load cell can be physically turned upside down?
I don’t know if is your specific case, please pay attention not doing mechanical stress on the gauge as it might get damaged.

All they have if the physical structure allows it or if it’s not limited electronically.
It’s not worth to play at hardware level if you can do in software.

Agree, just wondering why the “inversed” signal.

Thank you!! I very much appricate the assistance! Now on to print 8 more and get my 9 taps of beer started to be measured.

Finally something useful on this forum… :grin: