i have the load cell of 100kg i have a ADC NAU7802. i have to calculate weight through this ADC. can anyone have idea how to convert ADC value to weight.
"dont exceed 16 "
Why put a limit at 16?
Averaging is basically a form of low-pass filter, and depending on needed time constant and sampling speed, a good solution can be to use way more than 16 samples.
Note that rolling averages means that the CPU load doesn't increase with the number of samples. It's just a trade-off on amount of RAM for the sample buffer.
Clear calculations procedure are provided to you. Follow them. Even my brother, an under-graduate diploma engineering student, would have performed the calculations (given the load cell capacity).
I see this problem. how many bits are in 100 kg?
you get 24 bit precision into the reading. and the weight is left over.
An 8-bit processor can handle a 24-bit ADC and the related calculations. The "long" data type hides the complexities of manipulating integers larger than what the processor can handle natively.
The only thing to remember that two 24-bit numbers can't just be multiplied with each other - that would produce a 48-bit result where the low 24 bits will not contain any meaningful prevision.
But availability of a 32-bit integer type is more than enough for this task.
void initialize_7802(void) { unsigned char xdata Byte=0x00,temp;
/* Send Reset command into NAU7802 */ i2c_device_write1(0x54,0x00,0x01);
delayms(1000);
/* Enable PUD to power on the chip digital logic */ i2c_device_write1(0x54,0x00,0x02);
do { temp=i2c_device_read1(0x54,0x00); }while((temp&(1<<3))==0); delayms(20);
/* Enable PUA and AVDDS to support analog power, and enable CS to start ADC conversion */ i2c_device_write1(0x54,0x00,0x96);
/* Set the LDO output to 4.5V; PGA to 128x to 1X*/ i2c_device_write1(0x54,0x01,0x00);
/* Turn off the chopper function */ i2c_device_write1(0x54,0x15,0x30);
/* Enable the Cfilter for high PGA gain (> 4) */ i2c_device_write1(0x54,0x1c,0x80);
/* Disable the Cfilter for low PGA gain */ //i2c_device_write1(0x54,0x1c,0x00);
/* External Calibration: Force the current conversion data to be around zero*/ i2c_device_write1(0x54,0x02,0x06); //optional
delayms(1000); /* i2c control registor*/ i2c_device_write1(0x54,0x11,0x30);
delayms(1000); } ///////////////////////////////////////////////////////////////////////////////// ////////////////////////////////////////////////////////////////////////////////
unsigned long int adc_data2() { unsigned char xdata buff1,buf1[15]; unsigned long int adc_data;
do { buff1=i2c_device_read1(0x54,0x00);
}while((buff1&(1<<5))==0);
adc_data=0; memset(&buf1[0],0,8); buff1=0; buff1=i2c_device_read1(0x54,0x12);
adc_data=adc_data|buff1; adc_data=(adc_data<<8);
buff1=0; buff1=i2c_device_read1(0x54,0x13);
adc_data=adc_data|buff1;
adc_data=(adc_data<<8);
buff1=0; buff1=i2c_device_read1(0x54,0x14);
return adc_data; }
now give me calculation of weight when i get adc_data
no, DARN IT!!!! you get 24 bit resolution
I am gettin fed up with these 'scale makers' that confuse resolution with precision
Erik
if you add 8 more bits you will get 32 bit precision. but will they fit into the processor? it can be too much weight.
weight = unsigned long int adc_data2() * 1478 / 29;
you will want better precision. so your number is better?
"if you add 8 more bits you will get 32 bit precision."
Why not fix a 64-bit integer variable and suddenly have 64 bits of precision?
Do you understand the meaning of precision? The quality of the measurements will not improve just because a processor with support for wider integers is used.
gain =128 excitation=4.5 v 24 bit adc so 2^24 -1=16777215;
//convert adc value into volt volt=(((float)present_adcdata*excitation)/((float)16777215*gain)); volt=present_adcdata*.000002095; // i get in mili volt 128 gain
load cell capacity is 100kg load cell sensitivity=2mv/v excitation=4.5 v
100kg -> 9mv
1:100,00 = x *9 mv
x= 9/100,000
x=0.00009 1 gram want 0.00009 mv
not convert adc volt into gram
gram=volt/0.00009;
is my calculation is right or wrong
Who is this - "Kashmar Leetal". Did you mean "Little", coz thats the amount of experience that you have on forums. Guide people (towards completion of task, not complete the task for them), dont Misguide.
i am totally confused Not listening to the expert advices and taking short-cuts in want of success, is bound to confuse you. You have wasted almost a day. That calculation is a few minute task. But you still insist to want a fairy to appear from no where, swing her magic wand, touch your head, enlightening your mind with the knowledge. wake-up from the dreams, this is practical world and you have to work it yourself. bcoz there are no Shortcuts to Success. A**H*le.
Ok, but see my calculation is right or not
Look, do some basic tests and collect some data.
Put some standard weight combinations you know on the load cell. Measure the voltage observed. Get, say a dozen, measurements across the full range of the cell. Measure them with a volt-meter or scope, measure them with your ADC configuration. Put this data in a table. Write a small test application that enumerates through the table and generates results using your calculation method.
Then ask yourself are the results credible or not.
This is your work, magic internet fairies are not available to do it for you, it shouldn't take more than an hour or two of lab time.
You should be able to test the functional correctness of a calculation or algorithm autonomously with others holding your hand. Get to it!