Weight Scale on ESP32-C3 on Liliygo T-Zigbee Board
Posted: Sat Jun 08, 2024 11:27 am
Hello,
i'm trying to build an weight scale with with the Liliygo T-Zigbee Board using an HX711 and 4x 50kg weight cells. I get different reading on every calibation and the reading dont really change as expeced on adding or removing weights on the cells and the measurement drifts.
I have rewired it multiple times already to make sure there are no mistakes there. I changed the the DT and SCK Pin connection to other GPIO-Pins without success.
I don't really know what else could be wrong. Could someone take a look and give me advice what i should change to get correct measurement and calibation.
The HX711 and the loadcells are wired like this
The HX711 is currently connected to the board as follows
GND -> GND
DT -> GPIO08
SCK -> GPIO06
VCC-> 3.3V
And The Pins on the board are like this
This is my current code
The output and measurement i get while an 1000g wheight is on the scale is as follows
i'm trying to build an weight scale with with the Liliygo T-Zigbee Board using an HX711 and 4x 50kg weight cells. I get different reading on every calibation and the reading dont really change as expeced on adding or removing weights on the cells and the measurement drifts.
I have rewired it multiple times already to make sure there are no mistakes there. I changed the the DT and SCK Pin connection to other GPIO-Pins without success.
I don't really know what else could be wrong. Could someone take a look and give me advice what i should change to get correct measurement and calibation.
The HX711 and the loadcells are wired like this
The HX711 is currently connected to the board as follows
GND -> GND
DT -> GPIO08
SCK -> GPIO06
VCC-> 3.3V
And The Pins on the board are like this
This is my current code
- #include <Arduino.h>
- #include "HX711.h"
- #include "soc/rtc.h"
- HX711 scale;
- uint8_t dataPin = 8;
- uint8_t clockPin = 6;
- void setup()
- {
- delay(2000);
- Serial.begin(115200);
- Serial.println();
- rtc_cpu_freq_config_t config;
- rtc_clk_cpu_freq_get_config(&config);
- rtc_clk_cpu_freq_mhz_to_config(80, &config);
- rtc_clk_cpu_freq_set_config_fast(&config);
- scale.begin(dataPin, clockPin);
- delay(2000);
- Serial.print("UNITS: ");
- Serial.println(scale.get_units(10));
- Serial.println("\nEmpty the scale, press a key to continue");
- while(!Serial.available());
- while(Serial.available())
- Serial.read();
- delay(5000);
- scale.tare();
- Serial.print("UNITS: ");
- Serial.println(scale.get_units(10));
- Serial.println("\nPut 1000 gram in the scale, press a key to continue");
- while(!Serial.available());
- while(Serial.available()) Serial.read();
- delay(5000);
- scale.calibrate_scale(1000, 5);
- Serial.print("UNITS: ");
- Serial.println(scale.get_units(10));
- Serial.println("\nScale is calibrated, press a key to continue");
- Serial.print("Scale:");
- Serial.println(scale.get_scale());
- Serial.print("OFFSET:");
- Serial.println(scale.get_offset());
- while(!Serial.available());
- while(Serial.available()) Serial.read();
- Serial.println("");
- Serial.println("");
- Serial.println("");
- Serial.print("UNIT");
- Serial.print("\t;");
- Serial.print("VALUE");
- Serial.print("\t;");
- Serial.println("READ");
- }
- void loop()
- {
- long UNIT = scale.get_units(1);
- long VALUE = scale.get_value(1);
- long READ = scale.read();
- Serial.print(UNIT);
- Serial.print("\t;");
- Serial.print(VALUE);
- Serial.print("\t;");
- Serial.println(READ);
- }
- UNITS: -158241.80
- Empty the scale, press a key to continue
- UNITS: -111.80
- Put 1000 gram in the scale, press a key to continue
- UNITS: 13139.30
- Scale is calibrated, press a key to continue
- Scale:-0.01
- OFFSET:-158227
- UNIT ;VALUE ;READ
- 3610 ;-81 ;-158274
- 802 ;-62 ;-158252
- -401 ;28 ;-158202
- 4312 ;-45 ;-158268
- 200 ;12 ;-158177
- -4312 ;14 ;-158238
- 2607 ;-43 ;-158222
- 2908 ;-37 ;-158332
- 17953 ;-106 ;-158299
- 17151 ;-174 ;-158385
- 14242 ;-168 ;-158421
- 17351 ;-242 ;-158470
- 16750 ;-132 ;-158338
- 14142 ;-172 ;-158376
- 16449 ;-118 ;-158285
- 6018 ;-135 ;-158279
- 7622 ;-78 ;-158302
- 11033 ;-102 ;-158320
- 9929 ;-59 ;-158316
- 12236 ;-111 ;-158337
- 5416 ;-72 ;-158386
- 9227 ;-75 ;-158308
- 8625 ;-140 ;-158386
- 12938 ;-129 ;-158337
- 11534 ;-168 ;-158348
- 5616 ;-20 ;-158273
- 8425 ;-100 ;-158285
- -200 ;18 ;-158138
- -9929 ;101 ;-158131
- -9628 ;143 ;-158042
- -23269 ;201 ;-158004
- -28886 ;216 ;-158027
- -18856 ;138 ;-158130
- -20260 ;240 ;-157978
- -20461 ;182 ;-157996
- -23169 ;203 ;-158000
- -26579 ;218 ;-158048
- -15145 ;143 ;-158126
- -7422 ;55 ;-158172
- -3510 ;27 ;-158168
- -1705 ;14 ;-158158
- -7923 ;23 ;-158220
- -13640 ;196 ;-158122
- -9829 ;139 ;-158056
- -22868 ;208 ;-157940
- -27983 ;300 ;-157925
- -30290 ;324 ;-157839
- -29989 ;312 ;-157896
- -30992 ;344 ;-157852
- -42326 ;429 ;-157781
- -37512 ;428 ;-157762
- -51052 ;572 ;-157584
- -67401 ;648 ;-157559
- -58575 ;615 ;-157517
- -71413 ;753 ;-157297
- -100199 ;1140 ;-156859
- -143529 ;1442 ;-156896
- -115345 ;1492 ;-156586
- -174020 ;1796 ;-156508
- -165795 ;1656 ;-156583
- -168403 ;1603 ;-156698
- -163087 ;1692 ;-156439
- -191071 ;1813 ;-156463
- -188664 ;1924 ;-156416
- -186959 ;1918 ;-156285
- -191974 ;1949 ;-156324
- -196487 ;1967 ;-156212
- -188664 ;1888 ;-156339
- -189065 ;1716 ;-156582
- -170911 ;1807 ;-156363
- -188664 ;1764 ;-156469
- -172917 ;1614 ;-156439
- -177330 ;1786 ;-156329
- -186758 ;1879 ;-156348
- -181843 ;1852 ;-156272
- -201903 ;2022 ;-156291
- -186457 ;1906 ;-156305
- -195384 ;1949 ;-156247
- -205815 ;2055 ;-156194
- -208022 ;2161 ;-156053
- -216748 ;2162 ;-156046
- -217751 ;2211 ;-156015
- -215745 ;2114 ;-156146
- -206517 ;2056 ;-156148
- -210329 ;2051 ;-156154
- -208924 ;2053 ;-156172
- -211933 ;2099 ;-156065
- -215444 ;2154 ;-156108
- -212134 ;2121 ;-156080
- -218453 ;2073 ;-156133
- -212435 ;2153 ;-156141
- -207119 ;2081 ;-156161
- -206216 ;2008 ;-156190
- -207420 ;2089 ;-156121
- -225073 ;2337 ;-155858
- -239115 ;2385 ;-155800
- -244130 ;2417 ;-155906
- -227179 ;2315 ;-155817
- -240920 ;2365 ;-155895
- -232796 ;2356 ;-155859
- -245333 ;2447 ;-155844
- -242525 ;2524 ;-155715
- -249546 ;2452 ;-155820
- -242324 ;2371 ;-155911
- -228383 ;2198 ;-155964
- -229386 ;2230 ;-155975
- -229787 ;2317 ;-155926
- -228182 ;2289 ;-155943
- -233498 ;2297 ;-155943
- -236407 ;2391 ;-155815
- -244631 ;2395 ;-155768
- -249747 ;2475 ;-155769
- -246637 ;2490 ;-155770
- -249646 ;2575 ;-155574
- -264992 ;2593 ;-155646
- -257169 ;2617 ;-155559
- -272314 ;2711 ;-155452
- -280037 ;2767 ;-155505
- -279837 ;2751 ;-155475
- -275624 ;2719 ;-155484
- -276125 ;2690 ;-155560
- -266798 ;2676 ;-155502
- -267801 ;2660 ;-155514
- -262485 ;2603 ;-155604
- -263889 ;2623 ;-155573
- -272414 ;2578 ;-155673
- -257068 ;2616 ;-155580
- -263287 ;2605 ;-155621
- -261883 ;2625 ;-155646
- -252354 ;2523 ;-155655
- -250750 ;2469 ;-155783
- -250148 ;2473 ;-155666
- -262986 ;2624 ;-155693
- -251251 ;2576 ;-155712
- -246336 ;2485 ;-155752
- -250649 ;2446 ;-155828
- -246035 ;2438 ;-155906
- -240720 ;2419 ;-155903
- -233899 ;2383 ;-155881
- -235103 ;2393 ;-155909
- -237410 ;2412 ;-155823
- -239215 ;2307 ;-155926
- -240419 ;2341 ;-155843
- -244732 ;2434 ;-155809
- -245133 ;2529 ;-155696
- -257670 ;2536 ;-155753
- -251753 ;2531 ;-155716
- -250850 ;2510 ;-155714
- -257369 ;2543 ;-155731
- -241221 ;2340 ;-155793
- -250047 ;2439 ;-155792