Hi,
I am on a project for the strain gauges to measure strains of metal core. I have connected the circuit as needed to find the strain but the result on the serial monitoring is fluctuated ( going up then down without real effect on the sampled strain gauges. I could not figure out the reason behind this fluctuating. it goes from zero till 5 then fluctuated around 5 without any load on the strain gauge.
this is my code
#include "HX711.h"
// HX711 circuit wiring
const int LOADCELL_DOUT_PIN = 7;
const int LOADCELL_SCK_PIN = 8;
HX711 scale;
void setup() {
Serial.begin(1200);
Serial.println("HX711 Demo");
Serial.println("Initializing the scale");
// Initialize library with data output pin, clock input pin and gain factor.
// Channel selection is made by passing the appropriate gain:
// - With a gain factor of 64 or 128, channel A is selected
// - With a gain factor of 32, channel B is selected
// By omitting the gain factor parameter, the library
// default "128" (Channel A) is used here.
scale.begin(LOADCELL_DOUT_PIN, LOADCELL_SCK_PIN);
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;
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(10)); // 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(500);
//scale.power_up();
}
I found this code in full library of HX711.h
In the Serial.begin I have tried all the values and no differences shown.
I have connected circuit between the wheatstone bridge of two 120 ohm resistors with two strain gauges , see the type of the strain gauges HBM XY31 at attachments.
Sorry I used TinkerCAD i could not find strain gauge so instead I put a LED, instead of the HX711 lcd
from connected up to down
E+ E- A+ A- GND 5V D7(for DT of HX711) D8(sck) it is in the HX711 should
be 5V d7 d8 then GND
aa_ra18:
I used TinkerCAD i could not find strain gauge so instead I put a LED, instead of the HX711 lcd
Because of the components you could not find, the diagram (which is not a schematic, by the way) you posted is useless, sorry.
Can I suggest you use pen and paper and post a picture/scan of that. It is a perfectly acceptable way to make a schematic. You don't have to show all pins of the Arduino, only the ones you are using. But please mark the pin names on each component.
Looking at the reference circuit in the HX711 Data Sheet, there are various resistors, caps, and a transistor that are not in your schematic. I'm no expert in HX711, but I would be concerned that the fluctuations you are seeing could be because of those missing components.
Looking at the reference circuit in the HX711 Data Sheet, there are various resistors, caps, and a transistor that are not in your schematic. I'm no expert in HX711, but I would be concerned that the fluctuations you are seeing could be because of those missing components.
Yeah I am using this module. What kind of components you mean? I have seen multiple of experiments of this module and none of them included something other what I connected. Could you please help me with it. I am newbie to this module. Thank you in advance
If you are using the module described, then the extra components I mentioned are presumably already on the module. If so, that can't be the reason for the fluctuations.
aa_ra18:
Could you please help me with it. I am newbie to this module.
A: Functional Test of HX711 Module (be sure the Modiule works fine) 1. Build the following circuit.
Figure-1: Test circuit for functional check of HX711 Module
2. Upload the following sketch.
/* This program takes 10 samples from LC + HX711 at
1-sec interval and then computes the average.
*/
unsigned long x = 0, y = 0;
unsigned long dataArray[10];
int j = 0;
void setup()
{
Serial.begin(9600);
pinMode(A1, INPUT); //data line
pinMode(A0, OUTPUT); //SCK line
}
void loop()
{
for (int j = 0; j < 10; j++)
{
digitalWrite(A0, LOW);//SCK is made LL
while (digitalRead(A1) != LOW) //wait until Data Line goes LOW
;
{
for (int i = 0; i < 24; i++) //read 24-bit data from HX711
{
clk(); //generate CLK pulse to get MSB-it at A1-pin
bitWrite(x, 0, digitalRead(A1));
x = x << 1;
}
clk(); //25th pulse
Serial.println(x, HEX);
y = x;
x = 0;
delay(1000);
}
dataArray[j] = y;
}
Serial.println("===averaging process=========");
unsigned long sum = 0;
for (j = 0; j < 10; j++)
{
sum += dataArray[j];
}
Serial.print("Average Count = ");
sum = sum / 10;
Serial.println(sum, HEX);
}
void clk()
{
digitalWrite(A0, HIGH);
digitalWrite(A0, LOW);
}
3. Check that the Serial Monitor shows absolutely stable counts at 1-sec interval, and record it as N1.
4. Change R2 to 200 ohm. Check that SM shows approx. a count of 2*N1.
5. Now, place your load cell (the strain gauge) in place of R2 (as a test purpose) and observe the counts. Is there any count at all? Is it fluctuating? How much is the voltage across your load cell?
6 If the reading of Step-5 is stable, apply strain on your load cell. Does the reading change?
I have reconstruct the circuit again, I am using the same code above in the first post. It has a stable output but strange number. I have checked all the resistances of the circuit individually and it is 120 ohms. but the strange thing is that when no power source and using digital multimeter, it gives me 90 ohms equivalence resistance (when open circuit). I dont know how that is possible. I think the problem is about the module I will try Mr Golam way to test it again.
GolamMostafa: A: Functional Test of HX711 Module (be sure the Modiule works fine) 1. Build the following circuit.
Figure-1: Test circuit for functional check of HX711 Module
2. Upload the following sketch.
/* This program takes 10 samples from LC + HX711 at
1-sec interval and then computes the average.
*/
unsigned long x = 0, y = 0;
unsigned long dataArray[10];
int j = 0;
void setup()
{
Serial.begin(9600);
pinMode(A1, INPUT); //data line
pinMode(A0, OUTPUT); //SCK line
}
void loop()
{
for (int j = 0; j < 10; j++)
{
digitalWrite(A0, LOW);//SCK is made LL
while (digitalRead(A1) != LOW) //wait until Data Line goes LOW
;
{
for (int i = 0; i < 24; i++) //read 24-bit data from HX711
{
clk(); //generate CLK pulse to get MSB-it at A1-pin
bitWrite(x, 0, digitalRead(A1));
x = x << 1;
}
clk(); //25th pulse
Serial.println(x, HEX);
y = x;
x = 0;
delay(1000);
}
dataArray[j] = y;
}
Serial.println("===averaging process=========");
unsigned long sum = 0;
for (j = 0; j < 10; j++)
{
sum += dataArray[j];
}
Serial.print("Average Count = ");
sum = sum / 10;
Serial.println(sum, HEX);
}
**3.** Check that the Serial Monitor shows absolutely stable counts at 1-sec interval, and record it as N1.
**4.** Change R2 to 200 ohm. Check that SM shows approx. a count of 2*N1.
**5.** Now, place your load cell (the strain gauge) in place of R2 (as a test purpose) and observe the counts. Is there any count at all? Is it fluctuating? How much is the voltage across your load cell?
**6** If the reading of Step-5 is stable, apply strain on your load cell. Does the reading change?
**7.** Please, report the results.
Ok I have tried it with another resistors,10k instead of 100k, 220 and 330 with 1.5 ratio. this is what I have of resistors. It showed me the same result for both. what means it is not functional I will buy another one.
aa_ra18:
this is the raw data of the HX711 it only shows the output of the module
Have connected test circuit at the input of the module and then got the count of: 8388607?
Without doing further investigations, you can't declare that the current HX711 Module is bad! This is good that you are getting another Module -- you have redundancy for your works.
Do you have this type of load cell? You can connect it to your HX711 Module and check if there is any count and the count changes when you change load on the load cell.
GolamMostafa:
Have connected test circuit at the input of the module and then got the count of: 8388607?
Without doing further investigations, you can't declare that the current HX711 Module is bad! This is good that you are getting another Module -- you have redundancy for your works.
Do you have this type of load cell? You can connect it to your HX711 Module and check if there is any count and the count changes when you change load on the load cell.
This 8388607 is the output when strain gauge is connected, the whole wheatstone is connected and there is a load of 1000 psi is on the sample but it does not change.
No I dont have any load cell. I directly construct the wheatstone bridge of 2 strain gauges of 120 ohm and two resistor of 120 ohm. and it doesn't change
aa_ra18:
Yeah I am using this module. What kind of components you mean? I have seen multiple of experiments of this module and none of them included something other what I connected. Could you please help me with it. I am newbie to this module. Thank you in advance
I want to mention that the places of E+ E- is in place of A+ A- respectively.
I think that you have the two strain gauges in the wrong arms of the Wheatstone bridge.
You need to have them arranged so that they are in diagonally opposite arms of the bridge, so that when one output increases in voltage, the other decreases.
With your arrangement both outputs move in the same direction - giving no output, even when amplified.
I've found something strange about the compobents I have, it gives me 120 ohms when i test them separated. When i connect the circuit it gives me 90. I could not figure out why.
About the arrangement. I have mentioned that A+ and E+ is not placed correctly at the diagram also the same with the negative ones.