Go Down

### Topic: 4 DIFFERENT LOAD CELLS WITH 4 HX711?? (Read 438 times)previous topic - next topic

#### nickpilot1

##### Aug 27, 2017, 03:38 pmLast Edit: Aug 27, 2017, 06:22 pm by nickpilot1
Hello. I need your help. I have an arduino uno board,4 x hx711 and 4 load cells... And I want to weigh with 4 scales each separately, and each scales to activate a servo. That is, the first scale when the weight is less than 53g (0-53g)  the first servo make 180 degrees else 0 degrees. The second scale when weighing is from 53g to 63g make the second servo 180 degrees otherwise 0. The third when the weigh is 63g to 73g make a sevo 180 degrees and the fourth when the weigh is Greater than 73g servo make a 180 degrees.

I can do it? You can tell me the code??

This is my code. I do not know how to put second load cell...

Code: [Select]
`#include "HX711.h"#define calibration_factor -5990.0 //This value is obtained using the SparkFun_HX711_Calibration sketch#define DOUT  A3#define CLK  A2HX711 scale(DOUT, CLK);#include "Servo.h"Servo Servosmall;int pos = 0;    int pos2=180;int small=53;void setup() {  Serial.begin(9600);  Serial.println("HX711 scale demo");  scale.set_scale(-5990); //This value is obtained by using the SparkFun_HX711_Calibration sketch  scale.tare(); //Assuming there is no weight on the scale at start up, reset the scale to 0      Serial.println("Readings:");    Servosmall.attach(9);}void loop() {  Serial.print("Reading: ");  Serial.print(scale.get_units(20), 1); //scale.get_units() returns a float  Serial.print(" g "); //You can change this to kg but you'll need to refactor the calibration_factor  Serial.println();if (scale.get_units() > small){     Servosmall.write(pos);}  else  {    Servosmall.write(pos2);}}`

#### PaulS

#1
##### Aug 28, 2017, 01:10 pm
Quote
I do not know how to put second load cell...
Explain why you need to. Is the object being weighed going to weigh significantly more or less when you weigh it again?

#### nickpilot1

#2
##### Aug 28, 2017, 01:38 pm
I'm trying to make this construction:

I want to sort the eggs by weight class.

Did you help?

#### PaulS

#3
##### Aug 28, 2017, 03:23 pm
Why do you have two threads going on the same topic?

#### patduino

#4
##### Aug 28, 2017, 06:18 pmLast Edit: Aug 28, 2017, 06:18 pm by patduino
I saw your YouTube link. Are you making one of those? It looks like the eggs might crack when they bang into each other.

Why not make a single weight measurement with a a single load cell and categorize the eggs based on the single measurement?
There are 10 types of people in the world, those who understand binary, and those that don't.

#### nickpilot1

#5
##### Sep 04, 2017, 06:05 pm
finally with a little effort I did it. it works perfectly.
Νow I want help.
I want with two buttons to change the price of small
a button for up (+1gr) and a button for down(-1gr)

how to do this;

This is my code

Code: [Select]
`#include "HX711.h"#define calibration_factor = -5990.0 HX711 scale(3,2);HX711 scale2(5,4);HX711 scale3(6,7);HX711 scale4(9,8);#include "Servo.h"Servo Servosmall;Servo Servomedium;Servo Servolarge;Servo Servoxlarge;int pos = 0;    int pos2=180;float small= 53;float medium=63;float large=73;float xlarge=83;void setup() {  Serial.begin(9600);  Serial.println("HX711 scale demo");  scale.set_scale(-5990); //This value is obtained by using the SparkFun_HX711_Calibration sketch  scale.tare(); //Assuming there is no weight on the scale at start up, reset the scale to 0  scale2.set_scale(-5990); //This value is obtained by using the SparkFun_HX711_Calibration sketch  scale2.tare(); //Assuming there is no weight on the scale at start up, reset the scale to 0  scale3.set_scale(-5990); //This value is obtained by using the SparkFun_HX711_Calibration sketch  scale3.tare(); //Assuming there is no weight on the scale at start up, reset the scale to   scale4.set_scale(-5990); //This value is obtained by using the SparkFun_HX711_Calibration sketch  scale4.tare(); //Assuming there is no weight on the scale at start up, reset the scale to     Serial.println("Readings:");    Servosmall.attach(13);  Servomedium.attach(12);  Servolarge.attach(11);  Servoxlarge.attach(10);  }void loop() {  Serial.print("scale 1: ");  Serial.print(scale.get_units(1), 2); //παρε μοναδες (1) με (2) δικαδικα ψιφια  Serial.print(" g \t|"); //You can change this to kg but you'll need to refactor the calibration_factor    Serial.print("scale 2: ");  Serial.print(scale2.get_units(1), 2); //scale.get_units() returns a float  Serial.print(" g\t| "); //You can change this to kg but you'll need to refactor the calibration_factor   Serial.print("scale 3: ");  Serial.print(scale3.get_units(1), 2); //scale.get_units() returns a float  Serial.print(" g \t|"); //You can change this to kg but you'll need to refactor the calibration_factor   Serial.print("scale 4: ");  Serial.print(scale4.get_units(1), 2); //scale.get_units() returns a float  Serial.print(" g "); //You can change this to kg but you'll need to refactor the calibration_factor   Serial.println();if (scale.get_units() > small){    Servosmall.write(pos);}  else  {    Servosmall.write(pos2);}if (scale2.get_units() < small && scale2.get_units() > medium){     Servomedium.write(pos);}  else  {    Servomedium.write(pos2);  }if (scale3.get_units() < medium && scale3.get_units() > large){     Servolarge.write(pos);}  else  {    Servolarge.write(pos2);  }  if (scale4.get_units() < large && scale4.get_units() > xlarge){     Servoxlarge.write(pos);}  else  {    Servoxlarge.write(pos2);  }      if(Serial.available())  {    char temp = Serial.read();    if(temp == '+' || temp == 'a')      small += 1;    else if(temp == '-' || temp == 'z')      small -= 1;  }}`

Go Up