Building a precise Measuring System using (4 x 50KG Load Cell) with HX711

I have built a project that measures the weight of an object using 4 pieces of 50KG Load Cell with HX711, similar schematic below

After some time, I can see the value fluctuates even when there's no object, this fluctuation goes up and down randomly.

I have tried, changing the power supply and modifying the code but it is still not accurate, Is there a way can I make it accurate?

How big is the fluctuation? Is it within 60g = 0.03% of 4X50kg?

(datasheet: https://www.sparkfun.com/datasheets/Sensors/loadsensor.pdf from https://www.sparkfun.com/products/10245 )

That sounds like normal sensor noise. As suggested above, post the details.

1 Like

yes, it usually ranges from 60g, and this goes up and down randomly.

It could be sensor's errors:

That is perfectly normal. Averaging several measurements will reduce, but never eliminate the noise.

For random (Gaussian distributed) noise, the average noise level is reduced as the square root of the number of measurements, so to reduce the noise by a factor of 10, make and average together 100 measurements.

1 Like

Thank you, I have tried you suggestion but still having problems, I wanna know is there any example code to do this?

For help, post the code, using code tags, and describe the problems. What did you expect to happen, and what happened instead?

1 Like

I have this example code from a library that I've been using

Library: GitHub - olkal/HX711_ADC: Arduino library for the HX711 24-bit ADC for weight scales

Note, in this code I have not yet added the previous suggestion of averaging 100 measurements

/*
   -------------------------------------------------------------------------------------
   HX711_ADC
   Arduino library for HX711 24-Bit Analog-to-Digital Converter for Weight Scales
   Olav Kallhovd sept2017
   -------------------------------------------------------------------------------------
*/

/*
   Settling time (number of samples) and data filtering can be adjusted in the config.h file
   For calibration and storing the calibration value in eeprom, see example file "Calibration.ino"

   The update() function checks for new data and starts the next conversion. In order to acheive maximum effective
   sample rate, update() should be called at least as often as the HX711 sample rate; >10Hz@10SPS, >80Hz@80SPS.
   If you have other time consuming code running (i.e. a graphical LCD), consider calling update() from an interrupt routine,
   see example file "Read_1x_load_cell_interrupt_driven.ino".

   This is an example sketch on how to use this library
*/

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

//pins:
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;
unsigned long t = 0;

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

  LoadCell.begin();
  //LoadCell.setReverseOutput(); //uncomment to turn a negative output value to positive
  float calibrationValue; // calibration value (see example file "Calibration.ino")
  calibrationValue = 696.0; // uncomment this if you want to set the calibration value in the sketch
#if defined(ESP8266)|| defined(ESP32)
  //EEPROM.begin(512); // uncomment this if you use ESP8266/ESP32 and want to fetch the calibration value from eeprom
#endif
  //EEPROM.get(calVal_eepromAdress, calibrationValue); // uncomment this if you want to fetch the calibration value from eeprom

  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()) {
    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");
  }
}

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, send 't' to initiate tare operation:
  if (Serial.available() > 0) {
    char inByte = Serial.read();
    if (inByte == 't') LoadCell.tareNoDelay();
  }

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

}

Note the "Creep" and "Zero Drift" entries in the spec sheet. It could drift 0.03% of 50kg*4=60g in 1 minute and it would be within manufacturer's spec.

Averaging will give you a very smooth, precise answer, but it could have significant systematic error.

I suggest to do so, and if it does not work as expected, post the revised code along with an explanation of the problem.

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