Arduino and HX711 Load Cell Issue

Looking for help. I am working on a project for one of my classes, I'm trying to make a max grip strength tester, but I'm running into an issue. When I try and calibrate the system I am always getting a force value of 0. I've looked at a number of different posts with people having the same issue as me, but nothing has worked so far.
I checked all my connections and they visually appear to be good.
I am using a 200 kg S-type load cell and a HX711 load cell amp from sparkfun along the arduino nano.

Here is the wiring diagram I'm going off of.
Credit: DIY Engineers

Here is some pictures of my setup:

I had plastic casing around my connections but removed the casing to check the connection

Here is the code I used, I am aware that the wiring diagram has pin locations defined at 4 and 5, however in the code and on the arduino itself I have them at 2 and 3.
Credit: DIY Engineers

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

//pins:
const int HX711_dout = 3; //mcu > HX711 dout pin
const int HX711_sck = 2; //mcu > HX711 clk pin

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

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

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

  LoadCell.begin();
  //LoadCell.setReverseOutput(); //uncomment to turn a negative output value to positive
  unsigned long stabilizingtime = 2000; // preciscion right after power-up can be improved by adding a few seconds of stabilizing time
  boolean _tare = true; //set this to false if you don't want tare to be performed in the next step
  LoadCell.start(stabilizingtime, _tare);
  if (LoadCell.getTareTimeoutFlag() || LoadCell.getSignalTimeoutFlag()) {
    Serial.println("Timeout, check MCU>HX711 wiring and pin designations");
    while (1);
  }
  else {
    LoadCell.setCalFactor(1.0); // user set calibration value (float), initial value 1.0 may be used for this sketch
    Serial.println("Startup is complete");
  }
  while (!LoadCell.update());
  calibrate(); //start calibration procedure
}

void loop() {
  static boolean newDataReady = 0;
  const int serialPrintInterval = 0; //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 i = LoadCell.getData();
      Serial.print("Load_cell output val: ");
      Serial.println(i);
      newDataReady = 0;
      t = millis();
    }
  }

  // receive command from serial terminal
  if (Serial.available() > 0) {
    char inByte = Serial.read();
    if (inByte == 't') LoadCell.tareNoDelay(); //tare
    else if (inByte == 'r') calibrate(); //calibrate
    else if (inByte == 'c') changeSavedCalFactor(); //edit calibration value manually
  }

  // check if last tare operation is complete
  if (LoadCell.getTareStatus() == true) {
    Serial.println("Tare complete");
  }

}

void calibrate() {
  Serial.println("***");
  Serial.println("Start calibration:");
  Serial.println("Place the load cell an a level stable surface.");
  Serial.println("Remove any load applied to the load cell.");
  Serial.println("Send 't' from serial monitor to set the tare offset.");

  boolean _resume = false;
  while (_resume == false) {
    LoadCell.update();
    if (Serial.available() > 0) {
      if (Serial.available() > 0) {
        char inByte = Serial.read();
        if (inByte == 't') LoadCell.tareNoDelay();
      }
    }
    if (LoadCell.getTareStatus() == true) {
      Serial.println("Tare complete");
      _resume = true;
    }
  }

  Serial.println("Now, place your known mass on the loadcell.");
  Serial.println("Then send the weight of this mass (i.e. 100.0) from serial monitor.");

  float known_mass = 0;
  _resume = false;
  while (_resume == false) {
    LoadCell.update();
    if (Serial.available() > 0) {
      known_mass = Serial.parseFloat();
      if (known_mass != 0) {
        Serial.print("Known mass is: ");
        Serial.println(known_mass);
        _resume = true;
      }
    }
  }

  LoadCell.refreshDataSet(); //refresh the dataset to be sure that the known mass is measured correct
  float newCalibrationValue = LoadCell.getNewCalibration(known_mass); //get the new calibration value

  Serial.print("New calibration value has been set to: ");
  Serial.print(newCalibrationValue);
  Serial.println(", use this as calibration value (calFactor) in your project sketch.");
  Serial.print("Save this value to EEPROM adress ");
  Serial.print(calVal_eepromAdress);
  Serial.println("? y/n");

  _resume = false;
  while (_resume == false) {
    if (Serial.available() > 0) {
      char inByte = Serial.read();
      if (inByte == 'y') {
#if defined(ESP8266)|| defined(ESP32)
        EEPROM.begin(512);
#endif
        EEPROM.put(calVal_eepromAdress, newCalibrationValue);
#if defined(ESP8266)|| defined(ESP32)
        EEPROM.commit();
#endif
        EEPROM.get(calVal_eepromAdress, newCalibrationValue);
        Serial.print("Value ");
        Serial.print(newCalibrationValue);
        Serial.print(" saved to EEPROM address: ");
        Serial.println(calVal_eepromAdress);
        _resume = true;

      }
      else if (inByte == 'n') {
        Serial.println("Value not saved to EEPROM");
        _resume = true;
      }
    }
  }

  Serial.println("End calibration");
  Serial.println("***");
  Serial.println("To re-calibrate, send 'r' from serial monitor.");
  Serial.println("For manual edit of the calibration value, send 'c' from serial monitor.");
  Serial.println("***");
}

void changeSavedCalFactor() {
  float oldCalibrationValue = LoadCell.getCalFactor();
  boolean _resume = false;
  Serial.println("***");
  Serial.print("Current value is: ");
  Serial.println(oldCalibrationValue);
  Serial.println("Now, send the new value from serial monitor, i.e. 696.0");
  float newCalibrationValue;
  while (_resume == false) {
    if (Serial.available() > 0) {
      newCalibrationValue = Serial.parseFloat();
      if (newCalibrationValue != 0) {
        Serial.print("New calibration value is: ");
        Serial.println(newCalibrationValue);
        LoadCell.setCalFactor(newCalibrationValue);
        _resume = true;
      }
    }
  }
  _resume = false;
  Serial.print("Save this value to EEPROM adress ");
  Serial.print(calVal_eepromAdress);
  Serial.println("? y/n");
  while (_resume == false) {
    if (Serial.available() > 0) {
      char inByte = Serial.read();
      if (inByte == 'y') {
#if defined(ESP8266)|| defined(ESP32)
        EEPROM.begin(512);
#endif
        EEPROM.put(calVal_eepromAdress, newCalibrationValue);
#if defined(ESP8266)|| defined(ESP32)
        EEPROM.commit();
#endif
        EEPROM.get(calVal_eepromAdress, newCalibrationValue);
        Serial.print("Value ");
        Serial.print(newCalibrationValue);
        Serial.print(" saved to EEPROM address: ");
        Serial.println(calVal_eepromAdress);
        _resume = true;
      }
      else if (inByte == 'n') {
        Serial.println("Value not saved to EEPROM");
        _resume = true;
      }
    }
  }
  Serial.println("End change calibration value");
  Serial.println("***");
}

I am attempting to run this from my computers USB which I believe it 5V. The load cell excitation range is 5-18V. Could the issue be that I have too low of an excitation voltage?

Thanks

Using 12 volt for the controller can be okey but then tapping the 5 volt pin is No, No.
Get a 5 volt power supply for the LCD and other stuff.

If I remove the LCD from the system would the 5V from the USB work? Or would still recommend a higher voltage?

Never used this but Sparkfun indicates the VDD pin is used, either shorted to VCC or used in conjunction with VCC. Is this the issue?

Once the load cell is is hooked up to the amplifier, you can hook up VDD, VCC, DAT, CLK, and GND to a microcontroller such as a RedBoard or Arduino board.
Note: VCC is the analog voltage to power the load cell. VDD is the digital supply voltage used to set the logic level.
In many cases, you can just short VCC and VDD together. If your microcontroller uses 3.3V logic however, you'll want to connect VCC to 5V and VDD to 3.3V.
The example code has DAT and CLK hooked up to pin 3 and 2 respectively, but this is easily changed in the code. Any GPIO pin will work for either. Then VCC and VDD just need to be hooked up to 2.7-5V and GND to ground on your microcontroller.

source:
https://learn.sparkfun.com/tutorials/load-cell-amplifier-hx711-breakout-hookup-guide?_ga=2.175357728.34335181.1713028510-1292217417.1712158825

If You power the controller from USB the use of the 5 volt is okey but not when powering with 12 volt on Vin. The little onboard 5 volt converter gets overloaded and overheated.

I saw this on their website as well and gave it a try. Still encountering the same problem.

I am not using the 12V on VIN, only the 5V from USB.

No. The HX711 excitation is about 4.3 v and you should get decent results with that.

This is not optional. VDD must be connected to something: either VCC or the uC's supply voltage.
.
.
.
The best way I've found to troubleshoot the "I'm getting zeros" issues is to ditch all of the calibration code and simply print out raw values from the HX711. And I'd use the Bogde library for the HX711.

3 Likes

Instead of "its all not working" you need to establish where the problem lies.
So you need to have code that eg
JUST reads the HX711 and serial prints the raw result.
JUST writes simple text to the display
etc.

1 Like

I checked the voltage with a voltmeter on the output side of the HX711 and was getting 0.12-0.13 V no matter how much force I put on the load cell.
Could this mean that I have a bad load cell?

Did you read Post#4.
VCC and VDD must be connected to 5volt.
VCC is powering the load cell, VDD is powering the digital part of the chip.

Two power connections, so you have the option to use this board with a 5volt-logic and a 3.3volt-logic Arduino. With a 3.3volt-logic Arduino you would power VCC from 5volt and VDD from 3.3volt.
Leo..

@Wawa I have the VCC and VDD connected to the 5V pin already

Meaningless. The HX711 is a digital device.
You can only see the data stream with a scope.

Measure the load cell voltages, and report back.
With the black lead of your DMM held against the metal part of the USB socket...
Red should be between 4.25 and 4.30volt.
Black should be 0.0volt.
White and green should be "half of red", so ~2.14volt.

Move your DMM leads to white and green.
There should be less than 20mV between white and green.
Leo..

2 Likes

red im getting 4.87
black is 0
white is 1.6
green is 0
between white and green is 1.52

I assume you measured the load cell side of the HX711 board, not the Arduino side.
Leo..

My bad I measured the wrong side.
On the load cell side I'm getting:
red is 4.27
black is 0
white is 2.13
green is 2.13
between white and green I am getting 0

That sounds entirely reasonable. both white and green are near (4.27-0)/2=2.13V to the limits of your measurements.

If you could measure the 0V between the white and green to higher precision in the 0.001 or 0.0001 scale, you might be able to see the effects of load on the cell.

The HX711 amplifies that difference into a range that the HX711 ADC can read and deliver as a raw value to the Arduino.

If the difference between the white and the green was larger than +/-20mV or +/-40mV, the amplifying would peg the ADC atone of the limits and when the calibration process centers and scales it, you could get garbage results from the post-processing. Since your differential is close to zero, if the HX711 is working, it should produce some level of non-zero noise in the raw output.

If you're using HX711_ADC - Arduino Reference do a LoadCell.setSamplesInUse(1) to reduce the smoothing.

@DaveX Yes I am using HX711_ADC - Arduino Reference

I just had a thought as to why could be getting only zeros.
The wire from the load cell to the load cell amp is 3m long and I am am running the lowest allowable excitation voltage of 5V. Could it be that the signal from the load cell is just being lost to how long the wire is?

Excitation voltage is actually 4.27volt, as you have measured.
This is normal, as the HX711 board cleans it up to a stable voltage from that 5volt (4.87) supply.
Nothing to do with having zeroes.

You didn't post what voltage you have (without load) between white/green.
Set your DMM to the lowes voltage range.

Please try a basic example of that library, without modifications.
Leo..

1 Like

@Wawa
With no load on load cell, voltages between white and green:
Arduino side: 0.080V
Load cell side: 0.000