As shown in the picture, this is my configuration. I set the gain to 128, but -8388608 appears. What is the problem and how can I convert this value into a strain variable?
The number -8388608 Is -2^23.
The system is pegged against the lower limit at -FullScale. So the Wheatstone bridge output voltage between your green and brown wires is more than 20mv (40mv?).
Maybe the resistors do not match the strain gauge with enough precision. Maybe there is a open connection or short somewhere. Maybe the gauge is actually overloaded.
Look at the sample sketches to learn how to program it. I never touched the gain, just scale and offset.
@camshaft
Post the data sheet for your strain gauge
119.6 ohms in a wheatstone bridge with the red-red-brown-gold 220 ohm+/-5% resistors shown in your diagram could give a voltage difference more than the HX711 could handle: 5*(119.4/(119.4 +220) - 220/(220+220))= -0.74V
Compare the 740mv to the specs in the HX711 datasheet.
The resistor values in the picture are wrong, they should all be 120 ohms.
Can you please measure them all to 1/10 ohm?
5*(119.4/(119.4+120)-120/(120+120))=-0.131
... which is still out of +/-20mV
Can you measure the voltage between the HX711's inputs? If it is outside than +/-20mV, it is a circuit problem. If it is smaller than that, then your code should be giving you numbers like 8388608*deltaV_mV/20=??
You are right, it may be a problem with the resistance or strain gauge accuracy.
You could try a smaller gain.
You might also be able to shuffle the resistors you have around a bit to balance the wheatstone bridge better.
Gain 32
Will it be sensitive enough at the lower gain?
Those don't seem like 1/4th of the x128 gain numbers.
Is the system now responsive to straining the gauge? If so, now you just have to do calibration, or do you want to do the Wheatstone Bridge math to turn the values into a deltaR/R and use the gauge factor to get strain with (deltaR/R)/GF=strain
?
Well.... You have to be careful about all the units and conversions, but it is essentially working backwards through from the 24bit (+/-23bit) ADC counts, the x128 amplifier, the excitation voltage, into the wheatstone output voltage, then into the change in resistance, then through the gage factor into strain. I'd have to look at an old book in the office, but maybe this will help:
I worked part of it out in the other direction in this completely un-warranteed code:
void calcScale() {
// report on the expected calibration
const float SensorFullScale = 5.000; // kg at full scale
const float Amps[] = {32, 64, 128};
const float MaxVo[] = {0.080, 0.040, 0.020}; // +/-Voltage at INx+/INx-
const int AmpChoice = 2;
// the amplifications and limits make for about a +/-2.56V range
const float VCC = 5.0; // supply volts
const float ExcitationVoltage = VCC - 0.2 ; // Ve HX711 board transistor drop
//const float SensorOutput = 0.001; // Vo/Ve rated output at FS
const float SensorOutput = 0.001; // Vo/Ve rated output at FS
const float Amplification = Amps[AmpChoice] ; // 32, 64, or 128 from HX711
const float Vo_FS = ExcitationVoltage * SensorOutput; //
const float Vo_FSa = Vo_FS * Amplification; // ADC input voltage
const float OutputScaleV = ExcitationVoltage * SensorOutput / SensorFullScale * Amplification; // V/OutUnit
const long MaxADC = 1L << 23 - 1; // + side of 24 bit ADC
const long MinADC = -(1L << 23); // - side of 24 bit ADC
const float ADCCountPerV = MaxADC / (ExcitationVoltage/2);
const float ADCScale = ADCCountPerV * OutputScaleV;
Serial.print("###################\nCalculation of scale:\n");
Serial.print("Ve:");
Serial.print(ExcitationVoltage);
Serial.print("V, Vo_FS:");
Serial.print(Vo_FS, 6);
Serial.print("V @");
Serial.print(SensorFullScale);
Serial.print("OutputUnits, versus");
Serial.print(MaxVo[AmpChoice], 6);
Serial.print("Vo maximum at Amplification x");
Serial.print(Amps[AmpChoice]);
Serial.print("Effective \namped(x");
Serial.print(Amplification);
Serial.print("):");
Serial.print(Vo_FSa, 6);
Serial.print("Vo_(amped) into ADC, \nscale:");
Serial.print(OutputScaleV, 6);
Serial.print("V/outUnit into ADC, \nscale:");
Serial.print(ADCScale);
Serial.print(" AdcCounts/outputUnit");
Serial.println("\n#####################");
}
Or since it is just a multiplier between ADC counts and strain, you could do what most folks do with an HX711 a load cell and an arduino: ignore all the numbers and just load it and calculate the scaling factor between ADC count and the measurement.
I have a question. My system configuration can run normally when connected to my laptop via USB, but when I connect it to an external power source, my Arduino lights up but cannot trigger the system to operate. What is the reason?
What is this power source and where is it connected?
How do you know it's not operating?
Using a 5V/2A external battery (pack), I think there is enough current to drive my sensor. I can judge whether it is working by flashing the LED. When I use an external battery, the SD card does not generate data.
It's connected to the USB port?
Do you have any wait for serial instructions in your code?
Maybe time to post your code here