DivyaKrishnappa
Newbie level 6
- Joined
- Apr 23, 2014
- Messages
- 14
- Helped
- 0
- Reputation
- 0
- Reaction score
- 0
- Trophy points
- 1
- Activity points
- 103
Hi Klaus,
Does the value ADCv vary for different weights..? should I measure it by putting the load on sensor or should I calculate it..?
"put no load on your sensor and read out the value (ADCv),this is your offset"
gain = 1000g / (ADCv - offset)
offset-offset will become zero.. Please tell me How I could measure this ADCv..?
Regards,
Divya
Anybody helps me or give an idea "How to display float values e.g. my converted ADC value i.e, weight in terms of float on Graphic LCD"
is an absolute error of 0.0025% ... hard to achieve.1 gram accuracy
i don´t know what this means..I got result like 30,60,90 and 120
#include <LiquidCrystal.h>
#define HX711_SCK A0
#define HX711_DT A1
LiquidCrystal lcd(8, 9, 10, 11, 12, 13);
extern void Init_Hx711();
extern unsigned long HX711_Read(void);
extern unsigned int Get_Weight();
extern void Get_OFFSET();
long HX711_Buffer = 0;
long Weight_OFFSET = 0,Weight_Real = 0;
int Weight = 0;
unsigned long M_Weight=0,ADC_Value=0;
void setup()
{
Init_Hx711(); //IO setting initialization module connected HX711
lcd.begin(16, 2);
analogReference(INTERNAL);
Serial.begin(9600);
Serial.print("40 Kg Loadcell reading!\n");
delay(2000);
Get_OFFSET(); //Get fur
}
void loop()
{
ADC_Value=HX711_Read();
M_Weight=(ADC_Value-8409088)*0.00793457031;
Weight = Get_Weight(); //Calculated on the weight of the weight sensor
Serial.print(M_Weight); //Serial Display Weight
Serial.print(" g\n"); //Display Units
Serial.print("\n"); //Display Units
delay(1000); //Delay 1s
lcd.setCursor(0, 0);
lcd.print(M_Weight, 1);
lcd.print(" g");
lcd.print(" ");
delay(200);
}
//****************************************************
//Initialization of HX711
//****************************************************
void Init_Hx711()
{
pinMode(HX711_SCK, OUTPUT);
pinMode(HX711_DT, INPUT);
}
//****************************************************
//Get Weight No load
//****************************************************
void Get_OFFSET()
{
HX711_Buffer = HX711_Read();
Weight_OFFSET = HX711_Buffer;
}
//****************************************************
//Get Weight at Actual load
//****************************************************
unsigned int Get_Weight()
{
HX711_Buffer = HX711_Read();
HX711_Buffer = HX711_Buffer;
Weight_Real = HX711_Buffer;
Weight_Real = Weight_Real - Weight_OFFSET; //Get AD sampling value in kind .
Weight_Real = (unsigned int)((float)Weight_Real/7.35+0.05);
// Calculate the actual physical weight
// Because different sensor characteristic curve is not the same, so that each sensor and to correct the divisor 4.30 here
// When they find out of the test weight is too large, increase the value.
// If the test out of the weight is too small, decrease the value change .
// This value is generally about 7.16 . Because different sensors may be.
// +0.05 Percentile to rounding
return Weight_Real;
}
//****************************************************
//Function for HX711 reading
//****************************************************
unsigned long HX711_Read(void) //Gain 128
{
unsigned long count;
unsigned char i;
bool Flag = 0;
digitalWrite(HX711_DT, HIGH);
delayMicroseconds(1);
digitalWrite(HX711_SCK, LOW);
delayMicroseconds(1);
count=0;
while(digitalRead(HX711_DT));
for(i=0;i<24;i++)
{
digitalWrite(HX711_SCK, HIGH);
delayMicroseconds(1);
count=count<<1;
digitalWrite(HX711_SCK, LOW);
delayMicroseconds(1);
if(digitalRead(HX711_DT))
count++;
}
digitalWrite(HX711_SCK, HIGH);
count ^= 0x800000;
delayMicroseconds(1);
digitalWrite(HX711_SCK, LOW);
delayMicroseconds(1);
return(count);
}
M_Weight=(ADC_Value-8409088)*0.00793457031;
Code:M_Weight=(ADC_Value-8409088)*0.00793457031;
where did you get those values? please try Serial.print(ADC_Value) or even better Serial.print(ADC_Value>>8) and check the changes on the terminal...
the >>8 value should be enough filtering but maybe use >>7 or >>6 and post your results here...
ok, just remember, your HX711 gives you a 24 bit answer, but in my experience, from those 24 bits, only 16 or less are really useful, hence, the >>8 is to discard those noisy 8 lower bits...
even then with 16 bits you should attain a granularity of about 1 gram with a good 40kg load cell with a 2mV/V output, powered with 5V (and your HX711 also powered with 5V) are you sure you have a good load cell? are you sure you are using the Chanel A from the HX711 and not the chan.B?
We use cookies and similar technologies for the following purposes:
Do you accept cookies and these technologies?
We use cookies and similar technologies for the following purposes:
Do you accept cookies and these technologies?