Go Down

Topic: HX711 24 bit ADC with four load cells (Read 130791 times) previous topic - next topic

garo123

Does somebody knows why  my load cell dosnt send any signal to arduino or why  my arduino dosnt print anything in the serial screen?  i have this code

#include "HX711.h"

// HX711.DOUT   - pin #A1
// HX711.PD_SCK   - pin #A0

HX711 scale(A1, A0);      // parameter "gain" is ommited; the default value 128 is used by the library

void setup() {
  Serial.begin(9600);
  Serial.println("HX711 Demo");

  Serial.println("Before setting up the scale:");
  Serial.print("read: \t\t");
  Serial.println(scale.read());         // print a raw reading from the ADC

  Serial.print("read average: \t\t");
  Serial.println(scale.read_average(20));     // print the average of 20 readings from the ADC

  Serial.print("get value: \t\t");
  Serial.println(scale.get_value(5));      // print the average of 5 readings from the ADC minus the tare weight (not set yet)

  Serial.print("get units: \t\t");
  Serial.println(scale.get_units(5), 1);   // print the average of 5 readings from the ADC minus tare weight (not set) divided
                  // by the SCALE parameter (not set yet) 

  scale.set_scale(2280.f);                      // this value is obtained by calibrating the scale with known weights; see the README for details
  scale.tare();                    // reset the scale to 0

  Serial.println("After setting up the scale:");

  Serial.print("read: \t\t");
  Serial.println(scale.read());                 // print a raw reading from the ADC

  Serial.print("read average: \t\t");
  Serial.println(scale.read_average(20));       // print the average of 20 readings from the ADC

  Serial.print("get value: \t\t");
  Serial.println(scale.get_value(5));      // print the average of 5 readings from the ADC minus the tare weight, set with tare()

  Serial.print("get units: \t\t");
  Serial.println(scale.get_units(5), 1);        // print the average of 5 readings from the ADC minus tare weight, divided
                  // by the SCALE parameter set with set_scale

  Serial.println("Readings:");
}

void loop() {
  Serial.print("one reading:\t");
  Serial.print(scale.get_units(), 1);
  Serial.print("\t| average:\t");
  Serial.println(scale.get_units(10), 1);

  scale.power_down();                 // put the ADC in sleep mode
  delay(5000);
  scale.power_up();
}



I´m using the example by arduino  :smiley-eek-blue: :smiley-eek-blue: :smiley-eek-blue: :smiley-eek-blue: :smiley-eek-blue: and it dosnt work i dont know if the load cell is broken im using the hx711 and this diagram just i change the analogic ports [/img][/img][/img][/img][/img][/img][/img][/img][/img]

Please helpppp!!!!!  =( =( =(

PaulS

Quote
Please helpppp!!!!!

You want one of us to come there and connect ground and Vcc for you?

knut_ny

If "serial window" has correct speed (9600 baud) it should print!
..unless something is defective or you have connected 'heavy loads' to digital pins 0 and/or 1
Ny

backbone

Are you using A0 and A1?
If not use them at first.
I tried other analog ports too but it did not worked.
Go back to the basic of single HX711 only on A0 and A1.

Paco
Never to old to learn and I learn every day

minanblas

Hi to everyone!

I'm working in a project with 3 load cells, with 3 HX711, connected to an Arduino UNO.
The issue is that I want to read them in parallel, in order to make the sistem faster and read the data of the 3 cells at the same time.
How can I do it? Can I use the same SCK signal for the 3 sensors?

chkien

Unfortunatelly,the conclusion of this forum is :

There is no way to read on the same loop 2 sensors connected on the same HX711 board.

There is no example of working code with a sensor connected on the channel B of the HX711 board.



randymore

I am using multiple of these HX711 boards on an UNO based project

The trick is to make sure that if you are connecting them to digital IO pins you must use a pulldown resistor on the DOUT pin of teh HX711.

I have seen a few folks get tripped up because the original sketches us A0 and A1 as digital pins, but in truth this is only because Ax pins are naturally pulled low in input mode, there is no reason you can't use any available pins.

argy

Hi all together.

I just happened to fall over this thread. I think all the discussion is not necessary: this device is designed to get out the data of a "wheatstone bridge" and this is one value. Please look at wikipedia and you will understand, why there is no chance to get out the values for the 2 inputs in a normal way. Except you adopt the lib and start a tricky programming, which always will be an application beyond the scope of the chip.

borsaci06

I implemented a similar project and used 4 load cells and hx711... connected as per Wheatstone bridge... works great, a little slow though... my problem is that the readings are not easy to calibrate... I used 2 known weights 5kg and 10kg and did the calibration with simple math but the sensor readings are not linear... Its changing logarithmic... the error increases as the weight increases... Any easy equation to correct logarithmic error? or any ideas?  thx in advance... 

backbone

#39
Jan 25, 2015, 01:38 pm Last Edit: Jan 25, 2015, 01:41 pm by backbone
So HX711 measuring on A and B channel is a no go.
With the price of 1 Euro for an HX711 board then we have to go for a single HX711 per loadcell.
All good advice but no working code how to use one HX711 per loadcell. ;-)
And if you are talking about slow, what do you mean slow?
Did you put the HX711 in 80 Hz mode mechanically?

Use 0 kg (no load at the load cell) as your first value.
It doesnt matter if there is a plate or other stuff already on the loadcell mounted.
Both values are purely to calculate the rampvalue.
Then use 10 kg as your second value.
Zero out the weigth scale.
Then weigh the 5 kg and see how off it is.
If it is not linear @ 5 kg then your loadcell is not correct.
By nature a good working shear beam loadcell is reasonbaly linear if calibrated correctly.
 
Paco
Never to old to learn and I learn every day

backbone

#40
Jan 31, 2015, 03:08 pm Last Edit: Jan 31, 2015, 03:12 pm by backbone
OK,

I looked once again in the bogde github for the HX711 and the issue that were raised.
Someone else also asked for reading A and B channel.
The answwer that was given was for me not clear so I asked it again to be more clear.
Due to a lack of time he said he could not help but he mentioned try to use scale.set_gain().
With his answer I came to the following working code to read the value of the A and B channel.
I coupled one loadcell to both A and B channel and see the ADC value changing.
The only thing is now the code is slower then reading one channel.
I think this is what more people experience reading two channels.

So here is the code to read the raw ADC values of both A and B channel of the HX711.

Code: [Select]
#include "HX711.h"

// HX711.DOUT - pin #A1
// HX711.PD_SCK - pin #A0

HX711 scale(A1, A0); // parameter "gain" is ommited; the default value 128 is used by the library

void setup()
{
  Serial.begin(9600);
}

void loop()
{
scale.set_gain(128);
Serial.print("Loadcell A > ");
Serial.print((scale.read())); // print a raw reading from the ADC channel A
scale.set_gain(32);
Serial.print("  Loadcell B > ");
Serial.println((scale.read())); // print a raw reading from the ADC channel B
}
Never to old to learn and I learn every day

backbone

For those who like to use Analog port #A0 for other data input (like a LCD buttonshield) you can choose other analog ports.
Code: [Select]
#include "HX711.h"

// HX711.DOUT - pin #A3
// HX711.PD_SCK - pin #A2

HX711 scale(A3, A2); // parameter "gain" is ommited; the default value 128 is used by the library
Never to old to learn and I learn every day

hiprofile67

Okay I'm new at Arduino code so bear with me. I plan on reading 6 load cells with 6 different HX711 boards (they're cheap). I also plan on using some Digital I/O pins for obvious reasons.

Eventually I'll have other code for other functions/features for my specific project. This code is only to test multiple HX711 boards and displaying the various sensors' readings. It all compiles correctly, so I presume this may work? I ask because I'm new & my Arduino is still in the mail.

Code: [Select]
#include "HX711.h"
// HX711.DOUT odd number pins
// HX711.PD_SCK even number pins


HX711 scale1(3, 2); // parameter "gain" is ommited; the default value 128 is used by the library
HX711 scale2(5, 4);
HX711 scale3(7, 6);
HX711 scale4(9, 8); // all DOUT pins not on ADC channels have pull-down resistor added
HX711 scale5(A1, A0);
HX711 scale6(A3, A2);

void setup() {
Serial.begin(38400);
}

void loop() {
Serial.print("one reading scale 1:\t");
Serial.print(scale1.get_units(), 1);
Serial.print("\t| average:\t");
Serial.println(scale1.get_units(10), 1);

delay(1000);

Serial.print("one reading scale 2:\t");
Serial.print(scale2.get_units(), 1);
Serial.print("\t| average:\t");
Serial.println(scale2.get_units(10), 1);

delay(1000);

Serial.print("one reading scale 3:\t");
Serial.print(scale3.get_units(), 1);
Serial.print("\t| average:\t");
Serial.println(scale3.get_units(10), 1);

delay(1000);

Serial.print("one reading scale 4:\t");
Serial.print(scale4.get_units(), 1);
Serial.print("\t| average:\t");
Serial.println(scale4.get_units(10), 1);

delay(1000);

Serial.print("one reading scale 5:\t");
Serial.print(scale5.get_units(), 1);
Serial.print("\t| average:\t");
Serial.println(scale5.get_units(10), 1);

delay(1000);

Serial.print("one reading scale 6:\t");
Serial.print(scale6.get_units(), 1);
Serial.print("\t| average:\t");
Serial.println(scale6.get_units(10), 1);

delay(1000);

}

jamesbond79

hi hx711 weight indicator project. I'didnt stabilization.There are many changes in value in the LCD display figures LCD sends you running code. I looked at all the codes on the internet

dewar

I am having a similar issue using multiple hx711's. I am trying to read 6 loadcell's through 6 hx711's, everything works great using one hx711 but as soon as I add more than one the readings become very slow. Has anyone got this to work yet, or is there a hardware limitation preventing multiple readings?

Go Up