Scale sensor project problem

I have been working on a project to measure the weight of a keg of beer. I have followed and reconfimed wiring from many different resource, but I have been unable to solve this problem. The problem is when weight is placed on the scale the values go down, and when the weight is removed the values go up. So the scale is working in the opposite direction.

Here is the wiring I have used:

Thoughts?

What library are you using for the HX711?
Post all your code in code tags.

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
    

I think he meant the Arduino IDE, not HA :upside_down_face:

1 Like

Sorry if I wasn't clear, I need to see the code, not HA.

This is the only code i have.

The scale sensors are in a wheatbridge connected to an hx711 which connects to a d1 mini wemos board. The code above is what is pushed to the d1 mini board. The black and white wires are connected like the image above.

The numbers I get are directly from the d1 mini board.

Here is an example of that:

[13:37:25][D][hx711:031]: 'HX711 Value': Got value 292809
[13:37:25][D][sensor:093]: 'HX711 Value': Sending state 292809.00000 with 0 decimals of accuracy
[13:37:30][D][hx711:031]: 'HX711 Value': Got value 291824
[13:37:30][D][sensor:093]: 'HX711 Value': Sending state 291824.00000 with 0 decimals of accuracy
[13:37:35][D][hx711:031]: 'HX711 Value': Got value 290787
[13:37:35][D][sensor:093]: 'HX711 Value': Sending state 290787.00000 with 0 decimals of accuracy

Does that help?

Ok, you can prolly fix this error in HA as well, but then this isn't the right forum.

Hass got a good forum I recall.

Swap the wires going to A+ and A-

You should be using a Sparkfun HX711 board, which is designed for 3.3volt processors. It has a separate logic supply pin. The board pictured is for 5volt processors only. A work-around is a (2.2k:1k) voltage divider on the data line of the HX711, to drop the 5volt-logic from the HX711 to 3.3volt-logic for the ESP. Failing to do so could damage (or already has) the ESP.
Leo..

Here is the board I ordered. It looks like 5v is acceptable.

Load Cell https://a.co/d/6zRlxz7

I will try swapping tonight and report the results.

I am also using this board which supports 5v

QCCAN WEMOS D1 Mini v4 https://a.co/d/30Tbz1P

The board in the link from post#9 is 5volt only (supply and logic signals).

If you power the WeMos via USB, then you can steal 5volt for the HX711 from it's VBUS pin.

You still should use a voltage divider on the WeMos input pin, to reduce the 5volt DATA signal from the HX711 to a safe 3.3volt for the Wemos input pin. The CLK pin doesn't need that.

2k2 resistor between Wemos input pin and Wemos ground,
1k resistor between HX711 data pin and Wemos input pin.
Leo..

If I change to the 3.3v pin on the wemos would that be another option?

Would that also cause the problem I am seeing?

The analogue (load cell) part of an HX711 board has a 4.3volt excitation voltage regulator.

The board needs 5volt for this component to operate as intended. Powering the HX711 board with less than ~4.5volt could result in unstable readings (supply noise).

The problem you described (more weight, lower readout) can AFAIK only be corrected by swapping the wires to the A terminals.
Leo..

Okay, great information to know. I will be testing that later tonight.

Here are the results from flipping a+-/e+- 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

Could this be a soder or dupont connection problem? What would be the best way to validate that?

If the display is going negative with weight, then you should only swap the A-wires.

If you have a DMM, then check the voltage between E+ and E-
It should be very close to 4.3 volt.

Also check the voltage between A+ and A-
It should be less then 20 millivolt without weight.

If values are wrong, then check the way the four sensors are joined.
The Sparkfun website has a good explanation about connecting four load cells.

You could also have a board with a factory defect (which can be corrected). Hold the board against a strong light. You shouldn't see any light through it.
Leo..

This got nothing to do with the subject.

From amazons page:

  • Use two weight sensor 50kg to form a full-bridge measurement, measuring range for the sum of the two sensors: 50kgx2 = 100kg
  • Use four weight scale 50kg to form a full-bridge measurement, measuring range for the sum of four sensors: 50kgx4 = 200kg

200kg, assuming you place it exactly in the center..

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

The drawing does not show a ground from the cells to the Arduino or the HX-711.
[edit] Probably not necessary.

This topic was automatically closed 180 days after the last reply. New replies are no longer allowed.