Adding readings of two load cell

Hello, I'm working on a project in which I need to add the readings of two load cells that I'm getting in the serial monitor.
Is there any example for that or please can anyone help me with the code?

Your post was MOVED to its current location as it is more suitable.

Could you also take a few moments to Learn How To Use The Forum.

Other general help and troubleshooting advice can be found here.
It will help you get the best out of the forum in the future.

Can you read the value of two load cells and print them in the Serial monitor ?

If so, then post your sketch using code tags as advised in How to get the best out of this forum

Yes ,I do get two values of load cell on serial ,now I want to just add these two readings which I'm getting on serial monitor and third reading should be total of two load cell reading:
this is my code for two reading of load cell:

#include "HX711.h"

#define calibration_factor -430

#define LOADCELL_DOUT_PIN1  3
#define LOADCELL_SCK_PIN1  2
#define LOADCELL_DOUT_PIN2  5
#define LOADCELL_SCK_PIN2  4

HX711 scale1;
HX711 scale2;
void setup() {
  Serial.begin(9600);
  Serial.println("HX711 scale demo");

  scale1.begin(LOADCELL_DOUT_PIN1, LOADCELL_SCK_PIN1);
  scale2.begin(LOADCELL_DOUT_PIN2, LOADCELL_SCK_PIN2);
  scale1.set_scale(calibration_factor); 
  scale2.set_scale(calibration_factor);
  scale1.tare(); 
  scale2.tare(); 
  Serial.println("Readings:");
}

void loop() {
  Serial.print("Reading: ");
  Serial.print(scale1.get_units(), 1);
  Serial.print(scale2.get_units(), 1);//scale.get_units() returns a float
  Serial.print("g"); 
  Serial.println();
}

Which statements in your code read the 2 values that you want to add together ?

This :

Serial.print(scale1.get_units(), 1);
  Serial.print(scale2.get_units(), 1);
[/quote]

Not quite what I asked, but close

There is a better way, but have you tried

Serial.print(scale1.get_units() + scale2.get_units(), 1);

I assume that you know what the 1 parameter does

I tried with + it was giving difference of two load cell reading but with - it's giving addition is it correct?

Try


    Serial.println(scale1.get_units(), 1);
    Serial.println(scale2.get_units(), 1);
    Serial.println(scale1.get_units() + scale2.get_units(), 1);

Math works, dunno what’s happening at your end.

a7

I find that hard to believe. Please post the complete sketch that you tried

As I said, there is a better way that will allow debugging but try the simple ay first

I originally did this only but it was giving me difference instead of adding the values, so I tried to use - to see what values will I get,and I got an addition of two values with -, it's weird but I don't know what is happening
this is my sketch:

#include "HX711.h"
#define calibration_factor -430
#define LOADCELL_DOUT_PIN1  3
#define LOADCELL_SCK_PIN1  2
#define LOADCELL_DOUT_PIN2  5
#define LOADCELL_SCK_PIN2  4

HX711 scale1;
HX711 scale2;
void setup() {
  Serial.begin(9600);
  Serial.println("HX711 scale demo");

  scale1.begin(LOADCELL_DOUT_PIN1, LOADCELL_SCK_PIN1);
  scale2.begin(LOADCELL_DOUT_PIN2, LOADCELL_SCK_PIN2);
  scale1.set_scale(calibration_factor); 
  scale2.set_scale(calibration_factor);
  scale1.tare(); //Assuming there is no weight on the scale at start up, reset the scale to 0
  scale2.tare(); 
  Serial.println("Readings:");
}

void loop() {
  Serial.print("Reading:1:");
  Serial.print(scale1.get_units(), 1);
  Serial.print(scale2.get_units(), 1);//scale.get_units() returns a float
  Serial.println(scale1.get_units() + scale2.get_units(), 1);
  Serial.print("g"); //You can change this to kg but you'll need to refactor the calibration_factor
  Serial.println();
}
#include "HX711.h"
#define calibration_factor -430
#define LOADCELL_DOUT_PIN1  3
#define LOADCELL_SCK_PIN1  2
#define LOADCELL_DOUT_PIN2  5
#define LOADCELL_SCK_PIN2  4

HX711 scale1;
HX711 scale2;
void setup() {
  Serial.begin(9600);
  Serial.println("HX711 scale demo");

  scale1.begin(LOADCELL_DOUT_PIN1, LOADCELL_SCK_PIN1);
  scale2.begin(LOADCELL_DOUT_PIN2, LOADCELL_SCK_PIN2);
  scale1.set_scale(calibration_factor); 
  scale2.set_scale(calibration_factor);
  scale1.tare(); //Assuming there is no weight on the scale at start up, reset the scale to 0
  scale2.tare(); 
  Serial.println("Readings:");
}

void loop() {
  Serial.print("Reading:1:");
  Serial.print(scale1.get_units(), 1);
  Serial.print("Reading:2:");
  Serial.print(scale2.get_units(), 1);//scale.get_units() returns a float
  Serial.print("Reading:Total:");
  Serial.println(scale1.get_units()+ scale2.get_units(), 1);
  Serial.print("g"); //You can change this to kg but you'll need to refactor the calibration_factor
  Serial.println();
}

What serial output does that give you?

Try it like this

void loop()
{
  float reading1 = scale1.get_units();
  float reading2 = scale2.get_units();
  Serial.print("Reading:1:");
  Serial.println(reading1, 1);
  Serial.print("Reading:2:");
  Serial.println(reading2, 1);
  float sum = reading1 + reading2;
  Serial.print("Sum of readings:");
  Serial.println(sum, 1);
  Serial.print("g");
  Serial.println();
}

One thing that may be influencing the results is that most Arduinos (which one are you using ?) have only 1 ADC and switch it between pins. It is sometimes advised to take dummy readings from the second pin before taking the real readings to allow settling time

I figured it out just now that one of the load cell readings are negative value that's why I was getting difference with+ and addition with -, can you please see my sketch and tell me why I"m getting other load cell reading negative
I'm using 5Kg load cell

I'll guess that the calibration factor is not the same for both scales - try testing with some known weights.

What is the difference between the get_units() function and the get_value() function ?

The caliberation factor is same ,I'm keeping the known weight but the value of that weight comes as negative value ,the weight is correct but it is negative.

Have you got something wired up backwards?

I'm using Arduino Nano 3