Scale connected to Home Assistant

Hey guys!

I am trying to configure a new project: a scale to measure the weight of objects. In my case a gas cylinder. If the gas cylinder is heavy, then we still have gas in there!

I am using a hx711 sensor with 4 load cells:

I have installed the load cells on a small manhole cover:

I also used this schematic to connect all the wiring (the only difference is that I am using a NodeMCU with EspHome):
2770a69d7f02c5db237e9c92f5a6f2f9710a49a8_2_690x350

esphome:
  name: sensor_cilindro_gas_1
  platform: ESP8266
  board: d1_mini


wifi:
  ssid: !secret WiFiSSID
  password: !secret WiFiPassword
  
  # Enable fallback hotspot (captive portal) in case wifi connection fails
  ap:
    ssid: "Botijao Gas Fallback Hotspot"
    password: "MASKED"

captive_portal:

# Enable logging
logger:

# Enable Home Assistant API
api:

ota:

sensor:
  - platform: hx711
    name: "Cilindro de Gas 1"
    dout_pin: D1
    clk_pin: D2
    gain: 128
    icon: 'mdi:scale'
    update_interval: 10s
    accuracy_decimals: 2
    filters:
      - median:
         window_size: 6
         send_every: 6
      - calibrate_linear:
        - 321194.38  -> 0
        - 326688  -> 1.29
        - 351057.33  -> 73
    unit_of_measurement: kg

Despite all this, the sensor are working in a very strange (I would say spooky haha) way. The reads keep changing all the time. The differences are high. Take a look below:

INFO Reading configuration /config/esphome/sensor_cilindro_gas_1.yaml...
INFO Starting log output from sensor_cilindro_gas_1.local using esphome API
INFO Connecting to sensor_cilindro_gas_1.local:6053 (MASKED)
INFO Successfully connected to sensor_cilindro_gas_1.local
[07:17:18][I][app:105]: ESPHome version 1.15.3 compiled on Dec 18 2020, 23:33:53
[07:17:18][C][wifi:443]: WiFi:
[07:17:18][C][wifi:303]:   SSID: [redacted]
[07:17:18][C][wifi:304]:   IP Address: MASKED
[07:17:18][C][wifi:306]:   BSSID: [redacted]
[07:17:18][C][wifi:307]:   Hostname: 'sensor_cilindro_gas_1'
[07:17:18][C][wifi:311]:   Signal strength: -75 dB ▂▄▆█
[07:17:18][C][wifi:315]:   Channel: 6
[07:17:18][C][wifi:316]:   Subnet: MASKED
[07:17:18][C][wifi:317]:   Gateway: MASKED
[07:17:18][C][wifi:318]:   DNS1: MASKED
[07:17:18][C][wifi:319]:   DNS2: MASKED
[07:17:18][C][logger:185]: Logger:
[07:17:18][C][logger:186]:   Level: DEBUG
[07:17:18][C][logger:187]:   Log Baud Rate: 115200
[07:17:18][C][logger:188]:   Hardware UART: UART0
[07:17:18][C][hx711:021]: HX711 'Cilindro de Gas 1'
[07:17:18][C][hx711:021]:   Unit of Measurement: 'kg'
[07:17:18][C][hx711:021]:   Accuracy Decimals: 2
[07:17:18][C][hx711:021]:   Icon: 'mdi:scale'
[07:17:18][C][hx711:022]:   DOUT Pin: GPIO5 (Mode: INPUT)
[07:17:18][C][hx711:023]:   SCK Pin: GPIO4 (Mode: OUTPUT)
[07:17:18][C][hx711:024]:   Update Interval: 10.0s
[07:17:18][C][captive_portal:169]: Captive Portal:
[07:17:18][C][ota:029]: Over-The-Air Updates:
[07:17:18][C][ota:030]:   Address: sensor_cilindro_gas_1.local:8266
[07:17:18][C][api:095]: API Server:
[07:17:18][C][api:096]:   Address: sensor_cilindro_gas_1.local:6053
[07:17:20][D][hx711:031]: 'Cilindro de Gas 1': Got value 333199
[07:17:30][D][hx711:031]: 'Cilindro de Gas 1': Got value 331956
[07:17:40][D][hx711:031]: 'Cilindro de Gas 1': Got value 333005
[07:17:50][D][hx711:031]: 'Cilindro de Gas 1': Got value 331441
[07:18:00][D][hx711:031]: 'Cilindro de Gas 1': Got value 332222
[07:18:10][D][hx711:031]: 'Cilindro de Gas 1': Got value 332152
[07:18:10][D][sensor:092]: 'Cilindro de Gas 1': Sending state 22.70526 kg with 2 decimals of accuracy
[07:18:20][D][hx711:031]: 'Cilindro de Gas 1': Got value 332406
[07:18:30][D][hx711:031]: 'Cilindro de Gas 1': Got value 332254
[07:18:40][D][hx711:031]: 'Cilindro de Gas 1': Got value 331806
[07:18:50][D][hx711:031]: 'Cilindro de Gas 1': Got value 330852
[07:19:00][D][hx711:031]: 'Cilindro de Gas 1': Got value 332332
[07:19:00][I][ota:046]: Boot seems successful, resetting boot loop counter.
[07:19:10][D][hx711:031]: 'Cilindro de Gas 1': Got value 331803
[07:19:10][D][sensor:092]: 'Cilindro de Gas 1': Sending state 22.29773 kg with 2 decimals of accuracy
[07:19:20][D][hx711:031]: 'Cilindro de Gas 1': Got value 332857
[07:19:30][D][hx711:031]: 'Cilindro de Gas 1': Got value 331662
[07:19:40][D][hx711:031]: 'Cilindro de Gas 1': Got value 330762
[07:19:50][D][hx711:031]: 'Cilindro de Gas 1': Got value 331081
[07:20:00][D][hx711:031]: 'Cilindro de Gas 1': Got value 332121
[07:20:10][D][hx711:031]: 'Cilindro de Gas 1': Got value 329955
[07:20:10][D][sensor:092]: 'Cilindro de Gas 1': Sending state 20.58850 kg with 2 decimals of accuracy
[07:20:20][D][hx711:031]: 'Cilindro de Gas 1': Got value 331862
[07:20:30][D][hx711:031]: 'Cilindro de Gas 1': Got value 332660
[07:20:40][D][hx711:031]: 'Cilindro de Gas 1': Got value 331237
[07:20:50][D][hx711:031]: 'Cilindro de Gas 1': Got value 330377
[07:21:00][D][hx711:031]: 'Cilindro de Gas 1': Got value 329207
[07:21:10][D][hx711:031]: 'Cilindro de Gas 1': Got value 326778
[07:21:10][D][sensor:092]: 'Cilindro de Gas 1': Sending state 19.12323 kg with 2 decimals of accuracy
[07:21:20][D][hx711:031]: 'Cilindro de Gas 1': Got value 325756
[07:21:30][D][hx711:031]: 'Cilindro de Gas 1': Got value 325989
[07:21:40][D][hx711:031]: 'Cilindro de Gas 1': Got value 326746
[07:21:50][D][hx711:031]: 'Cilindro de Gas 1': Got value 325640
[07:22:00][D][hx711:031]: 'Cilindro de Gas 1': Got value 326373
[07:22:10][D][hx711:031]: 'Cilindro de Gas 1': Got value 326593
[07:22:10][D][sensor:092]: 'Cilindro de Gas 1': Sending state 7.11572 kg with 2 decimals of accuracy
[07:22:20][D][hx711:031]: 'Cilindro de Gas 1': Got value 326612
[07:22:30][D][hx711:031]: 'Cilindro de Gas 1': Got value 326861
[07:22:40][D][hx711:031]: 'Cilindro de Gas 1': Got value 326663
[07:22:50][D][hx711:031]: 'Cilindro de Gas 1': Got value 327124
[07:23:00][D][hx711:031]: 'Cilindro de Gas 1': Got value 326610
[07:23:10][D][hx711:031]: 'Cilindro de Gas 1': Got value 327237
[07:23:10][D][sensor:092]: 'Cilindro de Gas 1': Sending state 8.62378 kg with 2 decimals of accuracy
[07:23:20][D][hx711:031]: 'Cilindro de Gas 1': Got value 327216
[07:23:30][D][hx711:031]: 'Cilindro de Gas 1': Got value 327168
[07:23:40][D][hx711:031]: 'Cilindro de Gas 1': Got value 327490
[07:23:50][D][hx711:031]: 'Cilindro de Gas 1': Got value 327591
[07:24:00][D][hx711:031]: 'Cilindro de Gas 1': Got value 327550
[07:24:10][D][hx711:031]: 'Cilindro de Gas 1': Got value 327982
[07:24:10][D][sensor:092]: 'Cilindro de Gas 1': Sending state 10.59131 kg with 2 decimals of accuracy
[07:24:20][D][hx711:031]: 'Cilindro de Gas 1': Got value 327613
[07:24:30][D][hx711:031]: 'Cilindro de Gas 1': Got value 327842
[07:24:40][D][hx711:031]: 'Cilindro de Gas 1': Got value 327943
[07:24:50][D][hx711:031]: 'Cilindro de Gas 1': Got value 327627
[07:25:00][D][hx711:031]: 'Cilindro de Gas 1': Got value 328135
[07:25:10][D][hx711:031]: 'Cilindro de Gas 1': Got value 328170
[07:25:10][D][sensor:092]: 'Cilindro de Gas 1': Sending state 11.55817 kg with 2 decimals of accuracy
[07:25:20][D][hx711:031]: 'Cilindro de Gas 1': Got value 328175
[07:25:30][D][hx711:031]: 'Cilindro de Gas 1': Got value 328321
[07:25:40][D][hx711:031]: 'Cilindro de Gas 1': Got value 327820
[07:25:50][D][hx711:031]: 'Cilindro de Gas 1': Got value 328479
[07:26:00][D][hx711:031]: 'Cilindro de Gas 1': Got value 329879
[07:26:10][D][hx711:031]: 'Cilindro de Gas 1': Got value 330974
[07:26:10][D][sensor:092]: 'Cilindro de Gas 1': Sending state 12.87549 kg with 2 decimals of accuracy
[07:26:20][D][hx711:031]: 'Cilindro de Gas 1': Got value 332724
[07:26:30][D][hx711:031]: 'Cilindro de Gas 1': Got value 333769
[07:26:40][D][hx711:031]: 'Cilindro de Gas 1': Got value 333928
[07:26:50][D][hx711:031]: 'Cilindro de Gas 1': Got value 333745
[07:27:00][D][hx711:031]: 'Cilindro de Gas 1': Got value 333625
[07:27:10][D][hx711:031]: 'Cilindro de Gas 1': Got value 332687
[07:27:10][D][sensor:092]: 'Cilindro de Gas 1': Sending state 26.59357 kg with 2 decimals of accuracy
[07:27:20][D][hx711:031]: 'Cilindro de Gas 1': Got value 331891
[07:27:30][D][hx711:031]: 'Cilindro de Gas 1': Got value 333011
[07:27:40][D][hx711:031]: 'Cilindro de Gas 1': Got value 332817
[07:27:50][D][hx711:031]: 'Cilindro de Gas 1': Got value 332491
[07:28:00][D][hx711:031]: 'Cilindro de Gas 1': Got value 332001
[07:28:10][D][hx711:031]: 'Cilindro de Gas 1': Got value 332402
[07:28:10][D][sensor:092]: 'Cilindro de Gas 1': Sending state 23.37878 kg with 2 decimals of accuracy
[07:28:20][D][hx711:031]: 'Cilindro de Gas 1': Got value 332009
[07:28:30][D][hx711:031]: 'Cilindro de Gas 1': Got value 330978
[07:28:40][D][hx711:031]: 'Cilindro de Gas 1': Got value 332560
[07:28:50][D][hx711:031]: 'Cilindro de Gas 1': Got value 332062
[07:29:00][D][hx711:031]: 'Cilindro de Gas 1': Got value 331788
[07:29:10][D][hx711:031]: 'Cilindro de Gas 1': Got value 331412
[07:29:10][D][sensor:092]: 'Cilindro de Gas 1': Sending state 21.95636 kg with 2 decimals of accuracy
[07:29:20][D][hx711:031]: 'Cilindro de Gas 1': Got value 331653
[07:29:30][D][hx711:031]: 'Cilindro de Gas 1': Got value 331899
[07:29:40][D][hx711:031]: 'Cilindro de Gas 1': Got value 331834
[07:29:50][D][hx711:031]: 'Cilindro de Gas 1': Got value 332009
[07:30:00][D][hx711:031]: 'Cilindro de Gas 1': Got value 330595
[07:30:10][D][hx711:031]: 'Cilindro de Gas 1': Got value 332422
[07:30:10][D][sensor:092]: 'Cilindro de Gas 1': Sending state 21.87335 kg with 2 decimals of accuracy
[07:30:20][D][hx711:031]: 'Cilindro de Gas 1': Got value 331578
[07:30:30][D][hx711:031]: 'Cilindro de Gas 1': Got value 331405
[07:30:40][D][hx711:031]: 'Cilindro de Gas 1': Got value 331414
[07:30:50][D][hx711:031]: 'Cilindro de Gas 1': Got value 331207
[07:31:00][D][hx711:031]: 'Cilindro de Gas 1': Got value 331090
[07:31:10][D][hx711:031]: 'Cilindro de Gas 1': Got value 330657
[07:31:10][D][sensor:092]: 'Cilindro de Gas 1': Sending state 20.41846 kg with 2 decimals of accuracy
[07:31:20][D][hx711:031]: 'Cilindro de Gas 1': Got value 332146
[07:31:30][D][hx711:031]: 'Cilindro de Gas 1': Got value 331091
[07:31:40][D][hx711:031]: 'Cilindro de Gas 1': Got value 331715
[07:31:50][D][hx711:031]: 'Cilindro de Gas 1': Got value 330481
[07:32:00][D][hx711:031]: 'Cilindro de Gas 1': Got value 329261
[07:32:10][D][hx711:031]: 'Cilindro de Gas 1': Got value 326337
[07:32:10][D][sensor:092]: 'Cilindro de Gas 1': Sending state 19.06873 kg with 2 decimals of accuracy
[07:32:20][D][hx711:031]: 'Cilindro de Gas 1': Got value 326062
[07:32:30][D][hx711:031]: 'Cilindro de Gas 1': Got value 325667
[07:32:40][D][hx711:031]: 'Cilindro de Gas 1': Got value 326547
[07:32:50][D][hx711:031]: 'Cilindro de Gas 1': Got value 326853
[07:33:00][D][hx711:031]: 'Cilindro de Gas 1': Got value 326308
[07:33:10][D][hx711:031]: 'Cilindro de Gas 1': Got value 326455
[07:33:10][D][sensor:092]: 'Cilindro de Gas 1': Sending state 7.63611 kg with 2 decimals of accuracy
[07:33:20][D][hx711:031]: 'Cilindro de Gas 1': Got value 326785
[07:33:30][D][hx711:031]: 'Cilindro de Gas 1': Got value 326836
[07:33:40][D][hx711:031]: 'Cilindro de Gas 1': Got value 326792
[07:33:50][D][hx711:031]: 'Cilindro de Gas 1': Got value 327149
[07:34:00][D][hx711:031]: 'Cilindro de Gas 1': Got value 326900
[07:34:10][D][hx711:031]: 'Cilindro de Gas 1': Got value 326887
[07:34:10][D][sensor:092]: 'Cilindro de Gas 1': Sending state 8.88202 kg with 2 decimals of accuracy
[07:34:20][D][hx711:031]: 'Cilindro de Gas 1': Got value 327396
[07:34:30][D][hx711:031]: 'Cilindro de Gas 1': Got value 327223
[07:34:40][D][hx711:031]: 'Cilindro de Gas 1': Got value 327570
[07:34:50][D][hx711:031]: 'Cilindro de Gas 1': Got value 328058
[07:35:00][D][hx711:031]: 'Cilindro de Gas 1': Got value 327687
[07:35:10][D][hx711:031]: 'Cilindro de Gas 1': Got value 327916
[07:35:10][D][sensor:092]: 'Cilindro de Gas 1': Sending state 10.87292 kg with 2 decimals of accuracy
[07:35:20][D][hx711:031]: 'Cilindro de Gas 1': Got value 328089
[07:35:30][D][hx711:031]: 'Cilindro de Gas 1': Got value 328262
[07:35:40][D][hx711:031]: 'Cilindro de Gas 1': Got value 327941
[07:35:50][D][hx711:031]: 'Cilindro de Gas 1': Got value 328428

So… I am trying to find what I have to do to fix this. Anyone here can help me finishing this one?

There is absolutely nothing on the scale. I have tried to calibrate the scale via code but the values keep changing a lot!

1 Like

Where did you get your calibrate values from then?

I’m not sure if I can help.
But I’ve build something similar following the Video from the HookUp https://www.youtube.com/watch?v=ofHqZJTxBnE. Maybe you can check if your wiring is correct. For me it works well but I’m having problems with temperature drifts so you’ll need to use it for something heavy.

Looking at the photos you posted. Is it possible that your load cells are blocked from bending enough? As shown in the video, I think you might need more space underneath your cells.

1 Like

How much weight are you measuring with it? How “heavy” does the load need to be?

I’m starting on a similar build so knowing this stuff up front will be useful.

So I tried weighing a pottet plant in order to determine when I need to water it. The whole plant weights at around 4 kg while I water it with ~200 ml. For me, using the same load cells as in the pictures above (up to 50 kg each) is not feasible due to temperature drift. But I understand that there are load cells that are designed for lower weights and have less temperature dependence.
I guess for weighing a gas cylinder or a case of beer would be verymuch doable with those cells.

1 Like

Well… I used some objects I have here. I have a regular scale here. So I measured their weight then I used them at the sensors.

Thanks! Maybe that’s the answer!