HX711 Drifting Data, using a wheatstone Bridge

Hi,
I want to measure pull forces on a rope in a dynamic environment.

My problem is, my data is drifting, although I have no weight, or a constant weight.
I use the hx711 with a quarter wheatstone bridge.
I tried a library I found the arduino website, and I wrote my own code. Unfortunatly the same results.

I hope someone encountered a similiar problem and has a solution for me.

I attach you my data and my code.

Kind Regards

Scorqio

Code:

long reading;
long offset;

long sum;

float samples[20];
double printing;
long m;

QuickStats stats; //initialize an instance of this class

void setup() {
Serial.begin(9600);
pinMode(dt, INPUT);
pinMode(sck, OUTPUT);

Serial.println(“Starting…”);
digitalWrite(sck, HIGH);
delay(100);
digitalWrite(sck, LOW);
delay(100);
get_value();
delay(5000);

tare();
}

long get_value() {

uint8_t data[3] = { 0 };
uint8_t filler = 0x00;
long value;
while (digitalRead(dt) != LOW) {
Serial.print(".");
delay(50);
}

// pulse the clock pin 24 times to read the data
data[2] = shiftIn(dt, sck, MSBFIRST);
data[1] = shiftIn(dt, sck, MSBFIRST);
data[0] = shiftIn(dt, sck, MSBFIRST);

//uint8_t gain = 3; //gain: 64
uint8_t gain = 1; //gain: 128

for (unsigned int i = 0; i < gain; i++) {
digitalWrite(sck, HIGH);
digitalWrite(sck, LOW);
}

// Replicate the most significant bit to pad out a 32-bit signed integer
if (data[2] & 0x80) {
filler = 0xFF;
} else {
filler = 0x00;
}

// Construct a 32-bit signed integer
value = (long) ( (unsigned long) (filler) << 24
| (unsigned long) (data[2]) << 16
| (unsigned long) (data[1]) << 8
| (unsigned long) (data[0]) );

return value;
}

void tare() { //setting a zeropoint
Serial.println("");
Serial.println(“Calibration initiated.”);
long long temp = 0;
for (unsigned int i = 0; i < 8; i++) {
temp += get_value();
Serial.print(".");
delay(2000);
}

offset = temp >> 3;
Serial.println("");
Serial.print(“Offset Value: “);
Serial.print(offset);
Serial.println(””);
Serial.println("");

}

void loop() {
sum = 0;
reading = 0;
printing = 0;
for ( int j = 0; j < 19; j++) { // getting an Array with 20 values
samples[j] = get_value();

}

stats.bubbleSort(samples, 20); //sorting with the lowest first, highest last

for (int i = 2; i < 17; i++) {
sum = sum + samples*;*

  • }*
  • reading = sum >> 4;*
  • m = reading - offset;*
  • printing = (double) (m - 90100) / 3163, 5;*
  • Serial.print("reading: ");*
  • Serial.print(printing, 2);*
  • Serial.println(" Kg");*
  • delay(100);*
    }
    Data.txt (5.13 KB)

Load cell drift is a fact of life....

What is your load cell? If it's a 500 kg loadcell 2 kg noise is less than 0.5% which is not bad for a hacked together circuit. If it's a 10 kg sensor, then you have a problem.

How did you make the bridge? Do you have a bypass capacitor across the bridge power? Is the bridge located far from the amplifier? If yes, is it shielded? Is the band gap reference pin properly bypassed? (cap close to pin, direct path the IC ground pin) Is the IC properly bypassed? Are there any noisy circuits around?

Hi, thanks for your help.

  1. Iam using a quarter wheatstone bridge with a BF350-3AA strain gauge. I added you a picture
  2. I have a capacitator parallel to the bridges power supply.
  3. I attach you a drawing of my circuit
  4. The IC is a hx711 HX711 Datasheet

Unfortunatly Iam new to working with arduino and electrical circuits…

The corner of the board is red, so I assume you are using the Sparkfun HX711 breakout board. We can assume the IC is bypassed properly. I also assume that the capacitor on the bridge is close to the resistors and the wires between the strain gauge and resistors and from the bridge to the board are all short. I further assume that there is no major sources of EMI around the setup.

Your original data doesn't have any time values. How fast was the data taken? If it was taken fast (in a second or two) can you get better reading by averaging a large number of samples? If it was taken slowly (minutes) could the temperature have changed? That will affect the metal strip and the resistors. Hopefully the strain gauge and amplifier have good temperature compensation, but I don't know that for sure.

It looks like you are using metal bar and trying to measure the stretch as weight increases. If that's aluminum or other metals that expand and contract a lot you might be seeing a thermal effect. If it's galvanized steel I just stumbled on this blog post that says you shouldn't mount a strain gauge on the zinc plating.

Unfortunatly the type of board Iam using is not in fritzing,HX711 Board.

Iam taking 20 values a second, sorting them with bubblesort and after that, Iam taking the two highest and lowest away and calculating the average. Before I was taking every measurment. With the bubblsort and the spezial type of the average it got better.

the plate is stainless steel.

I tried another attempt, instead of using strain gauges I used four static resistors in the same configuration and still get that drift... I think it is because of the chip, the hx711. I hope someone can confirm my theory.

Kind Regards

Scorqio

Did you read and understand the linked document in post #1?

Maybe you can confirm your theory by creating graphs like its Figure 2 and Figure 6 or 7 and by doing the simple calculations in the Test Results section.

But don't short the inputs to the reference voltage like they did - that would violate the HX711's common mode voltage limits - just apply half of the excitation voltage to both inputs (using a simple voltage divider).

And then disconnect the voltage divider, connect your load cell, and do the same graphs and calculations again.

Compare.....

Load cells are not very linear, repeatable or stable near zero, you need to maintain at least 5% preload on it.

Scorqio: Unfortunatly the type of board Iam using is not in fritzing,HX711 Board.

Iam taking 20 values a second, sorting them with bubblesort and after that, Iam taking the two highest and lowest away and calculating the average. Before I was taking every measurment. With the bubblsort and the spezial type of the average it got better.

the plate is stainless steel.

That's the wrong way to average noisy signals. Just average them (take the mean). Your method is introducing some whacky quantization noise of its own that is probably very hard to analyze!

Or, as in the reference link in reply #1, throw out the max and min (not the two highest and two lowest), and then use the average. No need for the bubble sort.