Trouble with a load cell scale sketch

This is my first post and I am an absolute beginner at all this. So please forgive me if I don’t give enough information to describe my problem. I want to build a scale using four 50kg load cells with an HX711 amplifier going to a (genuine) Arduino Uno. Actually, I have the prototype scale build and wired up ready to test. For the display, I have a 128 X 32 OLED hooked up. I want to power this with a 9v battery eventually. This scale will always have the weight on it and I want to power it up once per day to check for additional weight and then power it off. So I need the weight saved into the board’s memory at power down. I found this main sketch that I believe is supposed to meet my needs. Only problem is it doesn’t work. I can verify the sketch with no problems. It also uploads fine with no issues. When I open the serial monitor it prints “starting… startup complete”. The OLED displays my personalized startup message “watermelons 2023” and “Initializing” below that but that is all. It just stops at that point. I then decided to try the calibration sketch in the HX711_ADC (library). It loaded fine and I was able to calibrate the scale no problems. I changed the calibration factor so that it was actually a very accurate scale in a variety of weights. So I believe that tells me that the wiring and loads cells are good. I know very little about code so I was hoping someone could take a look at it to see if something stands out. First I will add a pic of how I wired it up. The OLED wires are grd to grd, VCC to 5V, DT to pin 4, SCK to pin 5.

#include <HX711_ADC.h>
#include <SPI.h>
#include <Wire.h>
#include <Adafruit_GFX.h>
#include <Adafruit_SSD1306.h>
#include <U8g2lib.h>

#if defined(ESP8266) || defined(ESP32) || defined(AVR)
#include <EEPROM.h>
#endif

#define SCREEN_WIDTH 128  // OLED display width, in pixels
#define SCREEN_HEIGHT 32  // OLED display height, in pixels
#define Y_POS_0 0
#define X_POS_0 0
#define Y_POS_10 10
#define X_POS_10 10
#define TEXT_SIZE_SMALL 1
#define TEXT_SIZE_MED 2
#define TEXT_SIZE_LARGE 3
#define LONG_DELAY 4000
#define MED_DELAY 2000
#define SHORT_DELAY 1000

#define OLED_RESET 4         // Reset pin # (or -1 if sharing Arduino reset pin)
#define SCREEN_ADDRESS 0x3C  ///< See datasheet for Address; 0x3D for 128x64, 0x3C for 128x32
Adafruit_SSD1306 display(SCREEN_WIDTH, SCREEN_HEIGHT, &Wire, OLED_RESET);

//pins:
//OLED USES I2C -> ON ARDUINO UNO: SCL @ A5, SDA @ A4
const int HX711_dout = 4;  //mcu > HX711 dout pin
const int HX711_sck = 5;   //mcu > HX711 sck pin

//HX711 constructor:
HX711_ADC LoadCell(HX711_dout, HX711_sck);

const int calVal_eepromAdress = 0;
const int tareOffsetVal_eepromAdress = 4;
unsigned long t = 0;

void setup() {
  Serial.begin(57600);
  delay(10);
  Serial.println();
  Serial.println("Starting...");

  //SETUP LOAD CELLS
  LoadCell.begin();
  //LoadCell.setReverseOutput();
  float calibrationValue;
  20.9  // calibration value (see example file "Calibration.ino")

#if defined(ESP8266) || defined(ESP32)
    EEPROM.begin(512);
#endif

  ;
  EEPROM.get(calVal_eepromAdress, calibrationValue);  // uncomment this if you want to fetch the calibration value from eeprom

  //restore the zero offset value from eeprom:
  long tare_offset = 0;
  EEPROM.get(tareOffsetVal_eepromAdress, tare_offset);
  LoadCell.setTareOffset(tare_offset);

  unsigned long stabilizingtime = 2000;  // preciscion right after power-up can be improved by adding a few seconds of stabilizing time
  LoadCell.start(stabilizingtime, false);
  if (LoadCell.getTareTimeoutFlag()) {
    Serial.println("Timeout, check MCU>HX711 wiring and pin designations");
    while (1)
      ;
  } else {
    LoadCell.setCalFactor(calibrationValue);  // set calibration value (float)
    Serial.println("Startup is complete");
  }

  //SETUP OLED
  // SSD1306_SWITCHCAPVCC = generate display voltage from 3.3V internally
  if (!display.begin(SSD1306_SWITCHCAPVCC, SCREEN_ADDRESS)) {
    Serial.println(F("SSD1306 allocation failed"));
    for (;;)
      ;  // Don't proceed, loop forever
  }

  // Clear the buffer
  display.clearDisplay();

  // Draw a single pixel in white
  display.clearDisplay();
  display.setTextSize(TEXT_SIZE_SMALL);
  display.setTextColor(SSD1306_WHITE);  // Draw white text
  display.setCursor(Y_POS_0, X_POS_0);  // Start at top-left corner
  display.println("watermelons 2023");  //customize your own start screen message
  display.println("\nInitializing");
  display.display();
  delay(LONG_DELAY);
}

void setDisplayParameters(int cursorPosY, int cursorPosX, int textSize) {
  display.clearDisplay();
  display.setTextSize(textSize);
  display.setTextColor(SSD1306_WHITE);        // Draw white text
  display.setCursor(cursorPosY, cursorPosX);  // Starting point of display
}

void displayWeightInKGs(float weightInGrams, int cursorPosY, int cursorPosX, int size, int delayTime) {
  setDisplayParameters(cursorPosY, cursorPosX, size);
  float weight = weightInGrams / 1000;
  if (weight < 0) {
    weight = 0.00;
  }

  String weightInKGs = String(weight);
  display.println(weightInKGs);
  display.display();
  delay(delayTime);
}


void loop() {
  //GET VALUES FROM LOAD CELLS
  float value = 0.0;
  static boolean newDataReady = 0;
  const int serialPrintInterval = 250;  //increase value to slow down serial print activity

  // check for new data/start next conversion:
  if (LoadCell.update()) {
    newDataReady = true;
  }

  // get smoothed value from the dataset:
  if (newDataReady) {
    if (millis() > t + serialPrintInterval) {
      float value = LoadCell.getData();
      Serial.print("Load_cell output val: ");
      Serial.println(value);
      //DISPLAY VALUE ON THE OLED
      displayWeightInKGs(value, Y_POS_10, X_POS_10, TEXT_SIZE_LARGE, SHORT_DELAY);
      newDataReady = 0;
      t = millis();
    }
  }
}

It is possible that you are missing something in the code. Try another basic sketch. Try to omit the OLED in the new one and print the weight to the serial monitor only.

I just loaded the basic blink example and the board blinks. I then tried U8G2/full_buffer/Hello World and this displayed on the OLED. I loaded HX711_ADC/calibration and this code started the calibration process of the scale and seemed to work great. The serial monitor on the calibration sketch starts out by saying "starting...startup complete" and the goes to "start calibration" I was able to enter the calibration values in this sketch but I am unable to do this in the main sketch. This is my first project and any help fixing the code would be appreciated.

The main thing is:
more details what works and what not.
The code you have posted above does printing to the serial monitor

I have added more serial printing for analysing what is going on.
printing to the serial monitor is the best debug-method you have

#include <HX711_ADC.h>
#include <SPI.h>
#include <Wire.h>
#include <Adafruit_GFX.h>
#include <Adafruit_SSD1306.h>
#include <U8g2lib.h>

#if defined(ESP8266) || defined(ESP32) || defined(AVR)
#include <EEPROM.h>
#endif

#define SCREEN_WIDTH 128  // OLED display width, in pixels
#define SCREEN_HEIGHT 32  // OLED display height, in pixels
#define Y_POS_0 0
#define X_POS_0 0
#define Y_POS_10 10
#define X_POS_10 10
#define TEXT_SIZE_SMALL 1
#define TEXT_SIZE_MED 2
#define TEXT_SIZE_LARGE 3
#define LONG_DELAY 4000
#define MED_DELAY 2000
#define SHORT_DELAY 1000

#define OLED_RESET 4         // Reset pin # (or -1 if sharing Arduino reset pin)
#define SCREEN_ADDRESS 0x3C  ///< See datasheet for Address; 0x3D for 128x64, 0x3C for 128x32
Adafruit_SSD1306 display(SCREEN_WIDTH, SCREEN_HEIGHT, &Wire, OLED_RESET);

//pins:
//OLED USES I2C -> ON ARDUINO UNO: SCL @ A5, SDA @ A4
const int HX711_dout = 4;  //mcu > HX711 dout pin
const int HX711_sck = 5;   //mcu > HX711 sck pin

//HX711 constructor:
HX711_ADC LoadCell(HX711_dout, HX711_sck);

const int calVal_eepromAdress = 0;
const int tareOffsetVal_eepromAdress = 4;
unsigned long t = 0;

void setup() {
  Serial.begin(57600);
  delay(10);
  Serial.println();
  Serial.println("Starting...");

  //SETUP LOAD CELLS
  LoadCell.begin();
  Serial.println("LoadCell.begin() done");
  //LoadCell.setReverseOutput();
  float calibrationValue;
  //20.9  // calibration value (see example file "Calibration.ino")

#if defined(ESP8266) || defined(ESP32)
  EEPROM.begin(512);
#endif

  EEPROM.get(calVal_eepromAdress, calibrationValue);  // uncomment this if you want to fetch the calibration value from eeprom
  Serial.println("EEPROM.get(calVal_eepromAdress done");

  //restore the zero offset value from eeprom:
  long tare_offset = 0;
  EEPROM.get(tareOffsetVal_eepromAdress, tare_offset);
  Serial.println("EEPROM.get(tareOffsetVal_eepromAdress, tare_offset) done");
  LoadCell.setTareOffset(tare_offset);
  Serial.println("LoadCell.setTareOffset(tare_offset) done");

  unsigned long stabilizingtime = 2000;  // preciscion right after power-up can be improved by adding a few seconds of stabilizing time
  LoadCell.start(stabilizingtime, false);
  if (LoadCell.getTareTimeoutFlag()) {
    Serial.println("Timeout, check MCU>HX711 wiring and pin designations");
    while (1);
  } 
  else {
    LoadCell.setCalFactor(calibrationValue);  // set calibration value (float)
    Serial.println("Startup is complete");
  }

  //SETUP OLED
  // SSD1306_SWITCHCAPVCC = generate display voltage from 3.3V internally
  if (!display.begin(SSD1306_SWITCHCAPVCC, SCREEN_ADDRESS)) {
    Serial.println(F("SSD1306 allocation failed"));
    for (;;)
      ;  // Don't proceed, loop forever
  }
  Serial.println("if (!display.begin( done");

  // Clear the buffer
  display.clearDisplay();
  Serial.println("display.clearDisplay() done");

  // Draw a single pixel in white
  Serial.println("start printing to display");
  display.clearDisplay();
  display.setTextSize(TEXT_SIZE_SMALL);
  display.setTextColor(SSD1306_WHITE);  // Draw white text
  display.setCursor(Y_POS_0, X_POS_0);  // Start at top-left corner
  display.println("watermelons 2023");  //customize your own start screen message
  display.println("\nInitializing");
  display.display();
  Serial.println("printing to display done");
  delay(SHORT_DELAY);
  
  Serial.println("exiting setup()");
}


void setDisplayParameters(int cursorPosY, int cursorPosX, int textSize) {
  Serial.println("entering setDisplayParameters()");
  
  display.clearDisplay();
  display.setTextSize(textSize);
  display.setTextColor(SSD1306_WHITE);        // Draw white text
  display.setCursor(cursorPosY, cursorPosX);  // Starting point of display
  Serial.println("exiting setDisplayParameters()");
}


void displayWeightInKGs(float weightInGrams, int cursorPosY, int cursorPosX, int size, int delayTime) {
  Serial.println("entering displayWeightInKGs()");
  setDisplayParameters(cursorPosY, cursorPosX, size);
  float weight = weightInGrams / 1000;
  if (weight < 0) {
    weight = 0.00;
  }

  String weightInKGs = String(weight);
  display.println(weightInKGs);
  display.display();
  delay(delayTime);
  Serial.println("exiting displayWeightInKGs()");  
}


void loop() {
  //GET VALUES FROM LOAD CELLS
  float value = 0.0;
  static boolean newDataReady = 0;
  const int serialPrintInterval = 2000;  //increase value to slow down serial print activity

  // check for new data/start next conversion:
  if (LoadCell.update()) {
    newDataReady = true;
    Serial.println("newDataReady = true;");
  }

  // get smoothed value from the dataset:
  if (newDataReady) {
    if (millis() - t >= serialPrintInterval) {
      float value = LoadCell.getData();
      Serial.print("Load_cell output val: ");
      Serial.println(value);
      //DISPLAY VALUE ON THE OLED
      displayWeightInKGs(value, Y_POS_10, X_POS_10, TEXT_SIZE_LARGE, SHORT_DELAY);
      newDataReady = false;
      t = millis();
    }
  }
}

run this code-version and then copy & paste the serial monitor content as a code-section

best regards Stefan

1 Like

I ran your revised code and it loaded with no issues. This is what was on the serial monitor. Thanks for your help!!

怘�f~�����..
��
Starting...
LoadCell.begin() done
EEPROM.get(calVal_eepromAdress done
EEPROM.get(tareOffsetVal_eepromAdress, tare_offset) done
LoadCell.setTareOffset(tare_offset) done
Startup is complete
if (!display.begin( done
display.clearDisplay() done
start printing to display
printing to display done
exiting setup()

What can you conclude if the serial monitor stops printing after

exiting setup()?

1 Like

In my very limited experience with understanding code that would mean that it stops right before "setDisplayParameters" But I don't understand why it stopped.

No it did not stop before "setDisplayParameters"

You haven't yet understood how Arduino-programs work.
You do not yet know very fundamental basics about programming.

I recommend that you work through this tutorial

Arduino Programming Course

It is easy to understand and has a good mixture between explaining important concepts and example-codes to get you going. So give it a try and report your opinion about this tutorial.

You have chosen a project that is not very good suited for beginners.
This tutorial will teach you these very fundamental basics

best regards Stefan

Stefan is right, I have chosen a project that has turned out to be a lot more difficult than I had ever imagined. Three weeks ago, I didn’t even know what an Arduino board was. The only reason I picked this project is because I wanted to build a scale for a specific purpose and that led me to finding plans/ideas that led me to here. I have started the Arduino Programing Course that Stefan suggested and I believe it is a very comprehensive course. It is really starting to help me understand at least the basics. I will continues with the course but right now my brain is starting to go into overload and I wanted to come back in here with a few thoughts of what I have learned so far.

So, I understand that there is a setup function in the code that runs once and then a loop function that continues looping until the board is powered is off. After Stefan put the Serial.println to better debug the code, and reading the output in the serial monitor I can see the last thing printed is “exiting setup”. I now believe that means it’s finished with the setup but for some reason it’s not properly executing the functions. I believe it is the loop function that is causing the error. Is that correct? The big question for me is why it is not sending the weight to the display.

This is my basic understanding of what the loop function in my code it trying to do:
It checks if new data is available using the LoadCell.update(). If data is available the newDataReady variable is set to true. The function then checks if newDataReady is true and a certain amount of time has passed since the last time data was printed to the serial output. If both conditions are met, the function gets the data from the load cells using the LoadCell.getData() and prints it to the serial output. The function should also display the value on the OLED display using the displayWeightInKGs() function. Finally the newDataReady variable is set to false and the current time is stored in the t variable.

So, does this tell me that the function cannot find any new data using the LoadCell.update()?
If that is true, why can it not find new data?
Am I even close to finding the problem?

Hi @apiarist100,

very well done learning the course and good analysis of what the code does.

Yes this is it.

This can have various reasons.
Me personal I have only done some small testing with a single 4-wire load-cell and a HX711 board.
This did work with a testcode.

possible reasons:
wrong connected wires between HX711 and arduino Uno

wrong connected wires between loadcell and HX711-board

Do you have a digital multimeter for measuring the resistance of the loadcells?
The video explains that you have to measure the resistance between each of the loadcell-wires to determine which is the "middle"-wire

I guess you can't rely on the wire's color. You have to really determine by measuring it.

another possible reason is the HX711 might be damaged.

Me personal I have not done enough with the HX711 to know how to check this.

Another reason might be that your code tries to load a calibration-value from the EEPROM.
Though if no calibrationvalue has ever been stored it might retrieve the value zero which might cause no new data available.

To analyse this more serial output is needed to see more of the details what is going on the code

best regards Stefan

Here is a code-version that prints the values retrieved from the EEPROM
and in case it is zero assign a non-zero value

// MACRO-START * MACRO-START * MACRO-START * MACRO-START * MACRO-START * MACRO-START *
// a detailed explanation how these macros work is given in this tutorial
// https://forum.arduino.cc/t/comfortable-serial-debug-output-short-to-write-fixed-text-name-and-content-of-any-variable-code-example/888298

#define dbg(myFixedText, variableName) \
  Serial.print( F(#myFixedText " "  #variableName"=") ); \
  Serial.println(variableName);

#define dbgi(myFixedText, variableName,timeInterval) \
  { \
    static unsigned long intervalStartTime; \
    if ( millis() - intervalStartTime >= timeInterval ){ \
      intervalStartTime = millis(); \
      Serial.print( F(#myFixedText " "  #variableName"=") ); \
      Serial.println(variableName); \
    } \
  }

#define dbgc(myFixedText, variableName) \
  { \
    static long lastState; \
    if ( lastState != variableName ){ \
      Serial.print( F(#myFixedText " "  #variableName" changed from ") ); \
      Serial.print(lastState); \
      Serial.print( F(" to ") ); \
      Serial.println(variableName); \
      lastState = variableName; \
    } \
  }

#define dbgcf(myFixedText, variableName) \
  { \
    static float lastState; \
    if ( lastState != variableName ){ \
      Serial.print( F(#myFixedText " "  #variableName" changed from ") ); \
      Serial.print(lastState); \
      Serial.print( F(" to ") ); \
      Serial.println(variableName); \
      lastState = variableName; \
    } \
  }
// MACRO-END * MACRO-END * MACRO-END * MACRO-END * MACRO-END * MACRO-END * MACRO-END *



#include <HX711_ADC.h>
#include <SPI.h>
#include <Wire.h>
#include <Adafruit_GFX.h>
#include <Adafruit_SSD1306.h>
#include <U8g2lib.h>

#if defined(ESP8266) || defined(ESP32) || defined(AVR)
#include <EEPROM.h>
#endif

#define SCREEN_WIDTH 128  // OLED display width, in pixels
#define SCREEN_HEIGHT 32  // OLED display height, in pixels
#define Y_POS_0 0
#define X_POS_0 0
#define Y_POS_10 10
#define X_POS_10 10
#define TEXT_SIZE_SMALL 1
#define TEXT_SIZE_MED 2
#define TEXT_SIZE_LARGE 3
#define LONG_DELAY 4000
#define MED_DELAY 2000
#define SHORT_DELAY 1000

#define OLED_RESET 4         // Reset pin # (or -1 if sharing Arduino reset pin)
#define SCREEN_ADDRESS 0x3C  ///< See datasheet for Address; 0x3D for 128x64, 0x3C for 128x32
Adafruit_SSD1306 display(SCREEN_WIDTH, SCREEN_HEIGHT, &Wire, OLED_RESET);

//pins:
//OLED USES I2C -> ON ARDUINO UNO: SCL @ A5, SDA @ A4
const int HX711_dout = 4;  //mcu > HX711 dout pin
const int HX711_sck = 5;   //mcu > HX711 sck pin

//HX711 constructor:
HX711_ADC LoadCell(HX711_dout, HX711_sck);

const int calVal_eepromAdress = 0;
const int tareOffsetVal_eepromAdress = 4;
unsigned long t = 0;

void setup() {
  Serial.begin(57600);
  delay(10);
  Serial.println();
  Serial.println("Starting...");

  //SETUP LOAD CELLS
  LoadCell.begin();
  Serial.println("LoadCell.begin() done");
  //LoadCell.setReverseOutput();
  float calibrationValue;
  //20.9  // calibration value (see example file "Calibration.ino")

#if defined(ESP8266) || defined(ESP32)
  EEPROM.begin(512);
#endif

  EEPROM.get(calVal_eepromAdress, calibrationValue);  // uncomment this if you want to fetch the calibration value from eeprom
  Serial.println("EEPROM.get(calVal_eepromAdress done");
  dbg("1:",calVal_eepromAdress);
  dbg("2:",calibrationValue);
  if (calibrationValue == 0.0) {
    calibrationValue = 1.0; 
  }
  //restore the zero offset value from eeprom:
  long tare_offset = 0;
  EEPROM.get(tareOffsetVal_eepromAdress, tare_offset);
  Serial.println("EEPROM.get(tareOffsetVal_eepromAdress, tare_offset) done");
  dbg("3:",tareOffsetVal_eepromAdress);
  dbg("4:",tare_offset);

  if(tare_offset == 0) {
    tare_offset = 10;
  }

  LoadCell.setTareOffset(tare_offset);
  Serial.println("LoadCell.setTareOffset(tare_offset) done");

  unsigned long stabilizingtime = 2000;  // preciscion right after power-up can be improved by adding a few seconds of stabilizing time
  LoadCell.start(stabilizingtime, false);
  if (LoadCell.getTareTimeoutFlag()) {
    Serial.println("Timeout, check MCU>HX711 wiring and pin designations");
    while (1);
  } 
  else {
    LoadCell.setCalFactor(calibrationValue);  // set calibration value (float)
    Serial.println("Startup is complete");
  }

  //SETUP OLED
  // SSD1306_SWITCHCAPVCC = generate display voltage from 3.3V internally
  if (!display.begin(SSD1306_SWITCHCAPVCC, SCREEN_ADDRESS)) {
    Serial.println(F("SSD1306 allocation failed"));
    for (;;)
      ;  // Don't proceed, loop forever
  }
  Serial.println("if (!display.begin( done");

  // Clear the buffer
  display.clearDisplay();
  Serial.println("display.clearDisplay() done");

  // Draw a single pixel in white
  Serial.println("start printing to display");
  display.clearDisplay();
  display.setTextSize(TEXT_SIZE_SMALL);
  display.setTextColor(SSD1306_WHITE);  // Draw white text
  display.setCursor(Y_POS_0, X_POS_0);  // Start at top-left corner
  display.println("watermelons 2023");  //customize your own start screen message
  display.println("\nInitializing");
  display.display();
  Serial.println("printing to display done");
  delay(SHORT_DELAY);
  
  Serial.println("exiting setup()");
}


void setDisplayParameters(int cursorPosY, int cursorPosX, int textSize) {
  Serial.println("entering setDisplayParameters()");
  
  display.clearDisplay();
  display.setTextSize(textSize);
  display.setTextColor(SSD1306_WHITE);        // Draw white text
  display.setCursor(cursorPosY, cursorPosX);  // Starting point of display
  Serial.println("exiting setDisplayParameters()");
}


void displayWeightInKGs(float weightInGrams, int cursorPosY, int cursorPosX, int size, int delayTime) {
  Serial.println("entering displayWeightInKGs()");
  setDisplayParameters(cursorPosY, cursorPosX, size);
  float weight = weightInGrams / 1000;
  if (weight < 0) {
    weight = 0.00;
  }

  String weightInKGs = String(weight);
  display.println(weightInKGs);
  display.display();
  delay(delayTime);
  Serial.println("exiting displayWeightInKGs()");  
}


void loop() {
  //GET VALUES FROM LOAD CELLS
  float value = 0.0;
  static boolean newDataReady = 0;
  const int serialPrintInterval = 2000;  //increase value to slow down serial print activity

  // check for new data/start next conversion:
  if (LoadCell.update()) {
    newDataReady = true;
    Serial.println("newDataReady = true;");
  }

  // get smoothed value from the dataset:
  if (newDataReady) {
    if (millis() - t >= serialPrintInterval) {
      float value = LoadCell.getData();
      Serial.print("Load_cell output val: ");
      Serial.println(value);
      //DISPLAY VALUE ON THE OLED
      displayWeightInKGs(value, Y_POS_10, X_POS_10, TEXT_SIZE_LARGE, SHORT_DELAY);
      newDataReady = false;
      t = millis();
    }
  }
}

best regards Stefan

Thank you for the reply. Just a few minutes ago I went to the HX711 library and uploaded the calibration sketch to my board. In the serial monitor the calibration sketch started me through the calibration process and I was able to calibrate the scale. It was decided by the program that the calibration value was 20.9. I weighed myself and it was within a pound of my weight. This leads me to believe that the wiring and load cells are working correctly. I loaded the new version of the sketch that you just provided and the serial monitor only displays one line “exiting setup()”

I believe it might be something to do with your statement below

“Another reason might be that your code tries to load a calibration-value from the EEPROM.
Though if no calibrationvalue has ever been stored it might retrieve the value zero which might cause no new data available.”

Thank you for your time and knowledge, it is greatly appreciated!

This would be very strange if there would be only this single line

exiting setup()

Can you press reset to make the board restart again?
The minimum that should be printed is

Starting...

as this is the very first thing that gets printed

I uploaded your code again and got a different printout in the serial monitor.

Startup is complete
if (!display.begin( done
display.clearDisplay() done
start printing to display
printing to display done
exiting setup()

to make really sure what code-version is running
please make 101% sure that you upload the code from

this

posting
there are additional delay()s that shall make sure that all gets really printed

I have tested the code myself with an arduino Uno if it really is the actual code-version you should see this

20:25:53.877 -> Serial.begin(57600) done delay(2000)
20:25:55.935 -> 
20:25:55.935 -> Starting...
20:25:55.935 -> Code running comes from file 
20:25:55.935 -> F:\myData\Arduino\apiarist100-load-Cell-002.ino\apiarist100-load-Cell-002.ino.ino
20:25:55.935 ->   compiled Apr  8 2023 20:25:39
20:25:55.935 -> LoadCell.begin() done
20:25:55.935 -> EEPROM.get(calVal_eepromAdress done
20:25:55.935 -> "1:" calVal_eepromAdress=0
20:25:55.935 -> "2:" calibrationValue=nan
20:25:55.935 -> EEPROM.get(tareOffsetVal_eepromAdress, tare_offset) done
20:25:55.935 -> "3:" tareOffsetVal_eepromAdress=4
20:25:55.935 -> "4:" tare_offset=-1
20:25:55.935 -> LoadCell.setTareOffset(tare_offset) done
20:25:56.281 -> Startup is complete
20:25:56.314 -> if (!display.begin( done
20:25:56.314 -> display.clearDisplay() done
20:25:56.314 -> start printing to display
20:25:56.314 -> printing to display done
20:25:57.323 -> exiting setup()

This is the code

// MACRO-START * MACRO-START * MACRO-START * MACRO-START * MACRO-START * MACRO-START *
#define dbg(myFixedText, variableName) \
  Serial.print( F(#myFixedText " "  #variableName"=") ); \
  Serial.println(variableName);

#define dbgi(myFixedText, variableName,timeInterval) \
  { \
    static unsigned long intervalStartTime; \
    if ( millis() - intervalStartTime >= timeInterval ){ \
      intervalStartTime = millis(); \
      Serial.print( F(#myFixedText " "  #variableName"=") ); \
      Serial.println(variableName); \
    } \
  }

#define dbgc(myFixedText, variableName) \
  { \
    static long lastState; \
    if ( lastState != variableName ){ \
      Serial.print( F(#myFixedText " "  #variableName" changed from ") ); \
      Serial.print(lastState); \
      Serial.print( F(" to ") ); \
      Serial.println(variableName); \
      lastState = variableName; \
    } \
  }

#define dbgcf(myFixedText, variableName) \
  { \
    static float lastState; \
    if ( lastState != variableName ){ \
      Serial.print( F(#myFixedText " "  #variableName" changed from ") ); \
      Serial.print(lastState); \
      Serial.print( F(" to ") ); \
      Serial.println(variableName); \
      lastState = variableName; \
    } \
  }
// MACRO-END * MACRO-END * MACRO-END * MACRO-END * MACRO-END * MACRO-END * MACRO-END *

#include <HX711_ADC.h>
#include <SPI.h>
#include <Wire.h>
#include <Adafruit_GFX.h>
#include <Adafruit_SSD1306.h>
#include <U8g2lib.h>

#if defined(ESP8266) || defined(ESP32) || defined(AVR)
#include <EEPROM.h>
#endif

#define SCREEN_WIDTH 128  // OLED display width, in pixels
#define SCREEN_HEIGHT 32  // OLED display height, in pixels
#define Y_POS_0 0
#define X_POS_0 0
#define Y_POS_10 10
#define X_POS_10 10
#define TEXT_SIZE_SMALL 1
#define TEXT_SIZE_MED 2
#define TEXT_SIZE_LARGE 3
#define LONG_DELAY 4000
#define MED_DELAY 2000
#define SHORT_DELAY 1000

#define OLED_RESET 4         // Reset pin # (or -1 if sharing Arduino reset pin)
#define SCREEN_ADDRESS 0x3C  ///< See datasheet for Address; 0x3D for 128x64, 0x3C for 128x32
Adafruit_SSD1306 display(SCREEN_WIDTH, SCREEN_HEIGHT, &Wire, OLED_RESET);

//pins:
//OLED USES I2C -> ON ARDUINO UNO: SCL @ A5, SDA @ A4
const int HX711_dout = 4;  //mcu > HX711 dout pin
const int HX711_sck = 5;   //mcu > HX711 sck pin

//HX711 constructor:
HX711_ADC LoadCell(HX711_dout, HX711_sck);

const int calVal_eepromAdress = 0;
const int tareOffsetVal_eepromAdress = 4;
unsigned long t = 0;

void PrintFileNameDateTime() {
  Serial.println( F("Code running comes from file ") );
  Serial.println( F(__FILE__) );
  Serial.print( F("  compiled ") );
  Serial.print( F(__DATE__) );
  Serial.print( F(" ") );
  Serial.println( F(__TIME__) );  
}

void setup() {
  Serial.begin(57600);
  Serial.println("Serial.begin(57600) done delay(2000)");
  delay(2000);
  Serial.println();
  Serial.println("Starting...");
  PrintFileNameDateTime();
  //SETUP LOAD CELLS
  LoadCell.begin();
  Serial.println("LoadCell.begin() done");
  //LoadCell.setReverseOutput();
  float calibrationValue;
  //20.9  // calibration value (see example file "Calibration.ino")

#if defined(ESP8266) || defined(ESP32)
  EEPROM.begin(512);
#endif

  EEPROM.get(calVal_eepromAdress, calibrationValue);  // uncomment this if you want to fetch the calibration value from eeprom
  Serial.println("EEPROM.get(calVal_eepromAdress done");
  dbg("1:",calVal_eepromAdress);
  dbg("2:",calibrationValue);
  if (calibrationValue == 0.0) {
    calibrationValue = 1.0; 
  }
  //restore the zero offset value from eeprom:
  long tare_offset = 0;
  EEPROM.get(tareOffsetVal_eepromAdress, tare_offset);
  Serial.println("EEPROM.get(tareOffsetVal_eepromAdress, tare_offset) done");
  dbg("3:",tareOffsetVal_eepromAdress);
  dbg("4:",tare_offset);

  if(tare_offset == 0) {
    tare_offset = 10;
  }

  LoadCell.setTareOffset(tare_offset);
  Serial.println("LoadCell.setTareOffset(tare_offset) done");

  unsigned long stabilizingtime = 2000;  // preciscion right after power-up can be improved by adding a few seconds of stabilizing time
  LoadCell.start(stabilizingtime, false);
  if (LoadCell.getTareTimeoutFlag()) {
    Serial.println("Timeout, check MCU>HX711 wiring and pin designations");
    while (1);
  } 
  else {
    LoadCell.setCalFactor(calibrationValue);  // set calibration value (float)
    Serial.println("Startup is complete");
  }

  //SETUP OLED
  // SSD1306_SWITCHCAPVCC = generate display voltage from 3.3V internally
  if (!display.begin(SSD1306_SWITCHCAPVCC, SCREEN_ADDRESS)) {
    Serial.println(F("SSD1306 allocation failed"));
    for (;;)
      ;  // Don't proceed, loop forever
  }
  Serial.println("if (!display.begin( done");

  // Clear the buffer
  display.clearDisplay();
  Serial.println("display.clearDisplay() done");

  // Draw a single pixel in white
  Serial.println("start printing to display");
  display.clearDisplay();
  display.setTextSize(TEXT_SIZE_SMALL);
  display.setTextColor(SSD1306_WHITE);  // Draw white text
  display.setCursor(Y_POS_0, X_POS_0);  // Start at top-left corner
  display.println("watermelons 2023");  //customize your own start screen message
  display.println("\nInitializing");
  display.display();
  Serial.println("printing to display done");
  delay(SHORT_DELAY);
  
  Serial.println("exiting setup()");
}


void setDisplayParameters(int cursorPosY, int cursorPosX, int textSize) {
  Serial.println("entering setDisplayParameters()");
  
  display.clearDisplay();
  display.setTextSize(textSize);
  display.setTextColor(SSD1306_WHITE);        // Draw white text
  display.setCursor(cursorPosY, cursorPosX);  // Starting point of display
  Serial.println("exiting setDisplayParameters()");
}


void displayWeightInKGs(float weightInGrams, int cursorPosY, int cursorPosX, int size, int delayTime) {
  Serial.println("entering displayWeightInKGs()");
  setDisplayParameters(cursorPosY, cursorPosX, size);
  float weight = weightInGrams / 1000;
  if (weight < 0) {
    weight = 0.00;
  }

  String weightInKGs = String(weight);
  display.println(weightInKGs);
  display.display();
  delay(delayTime);
  Serial.println("exiting displayWeightInKGs()");  
}


void loop() {
  //GET VALUES FROM LOAD CELLS
  float value = 0.0;
  static boolean newDataReady = 0;
  const int serialPrintInterval = 2000;  //increase value to slow down serial print activity

  // check for new data/start next conversion:
  if (LoadCell.update()) {
    newDataReady = true;
    Serial.println("newDataReady = true;");
  }

  // get smoothed value from the dataset:
  if (newDataReady) {
    if (millis() - t >= serialPrintInterval) {
      float value = LoadCell.getData();
      Serial.print("Load_cell output val: ");
      Serial.println(value);
      //DISPLAY VALUE ON THE OLED
      displayWeightInKGs(value, Y_POS_10, X_POS_10, TEXT_SIZE_LARGE, SHORT_DELAY);
      newDataReady = false;
      t = millis();
    }
  }
}

if you see less than these lines in the serial monitor you are doing something wrong

You can keep the arduino connected and the serial monitor opened all the time

I uploaded the most recent code your provided in the post above. I am going to paste the serial monitor display directly into this text box because for some reason I cannot get the code tab to format the information correctly.

Serial.begin(57600) done delay(2000)

Starting...
Code running comes from file
C:\Users\elain\AppData\Local\Temp.arduinoIDE-unsaved202338-1088-m8h0u9.cz36r\sketch_apr8b\sketch_apr8b.ino
compiled Apr 8 2023 14:42:12
LoadCell.begin() done
EEPROM.get(calVal_eepromAdress done
"1:" calVal_eepromAdress=0
"2:" calibrationValue=20.68
EEPROM.get(tareOffsetVal_eepromAdress, tare_offset) done
"3:" tareOffsetVal_eepromAdress=4
"4:" tare_offset=-1
LoadCell.setTareOffset(tare_offset) done
Startup is complete
if (!display.begin( done
display.clearDisplay() done
start printing to display
printing to display done
exiting setup()

Before we go on testing
what exact type of microcontroller do you use?

I bought it recently from Amazon the description said "Arduino UNO REV3 [A000066]"

This is an actual picture of my board

Arduino Uno board

This isn't your immediate issue, but one concern with these sensors is creep. If you leave them loaded and stressed for long periods of time, the readings can shift. Typical usage does re-zeroing in each session, which minimizes the effect of long term creep, but if you are planning on long-term accuracy, you should be aware of creep, and occasionally un-load the scale, re-check the zero and the calibration to measure the long-term creep.

Well I tried to compile your code for the same type of board and I get these messages

22:14:01.212 -> Serial.begin(57600) done delay(2000)
22:14:03.245 -> 
22:14:03.245 -> Starting...
22:14:03.245 -> Code running comes from file 
22:14:03.245 -> F:\myData\Arduino\apiarist100-load-Cell-003.ino\apiarist100-load-Cell-003.ino.ino
22:14:03.245 ->   compiled Apr  8 2023 22:13:27
22:14:03.245 -> LoadCell.begin() done
22:14:03.245 -> EEPROM.get(calVal_eepromAdress done
22:14:03.245 -> "1:" calVal_eepromAdress=0
22:14:03.245 -> "2:" calibrationValue=nan
22:14:03.245 -> "nan" isnan(calibrationValue)=1
22:14:03.245 -> calibrationValue nan set to 2.0
22:14:03.245 -> "finally" calibrationValue=2.00
22:14:03.245 -> EEPROM.get(tareOffsetVal_eepromAdress, tare_offset) done
22:14:03.245 -> "3:" tareOffsetVal_eepromAdress=4
22:14:03.245 -> "4:" tare_offset=-1
22:14:03.245 -> "finally" tare_offset=-1
22:14:03.245 -> LoadCell.setTareOffset(tare_offset) done
22:14:03.592 -> HX771-Startup is complete
22:14:03.592 -> SSD1306 allocation failed

SSD1306 allocation failed
the reason is an arduino uno has only 2kB of RAM

Using an OLED-display in graphics mode occupies a lot of RAM
In combination with the HX711 there is not enough RAM for all
and this is the reason why I get the message
SSD1306 allocation failed

I am astonished that you do not get the same message