HI,
I have faced the issues to convert Adcvalue to the weight which is from ads1231. Kindly help me to work on this
Thanks & Regards
Navin Chakravarthy K
This thread has been locked.
If you have a related question, please click the "Ask a related question" button in the top right corner. The newly created question will be automatically linked to this question.
HI,
I have faced the issues to convert Adcvalue to the weight which is from ads1231. Kindly help me to work on this
Thanks & Regards
Navin Chakravarthy K
Hi Navin,
The ADC output code is directly related to the reference voltage and not the load cell connected. A load cell will output a very small voltage based on the sensitivity of the load cell (expressed in mV/V of excitation) to the specified maximum load cell measurement voltage.
As an example, let's say the load cell has a sensitivity of 2mV/V and a 5V excitation/reference voltage is used. If the scale outputs a maximum of 10kg at full-scale, then the maximum output voltage will be 10mV (5V*2mV/V) when 10kg is applied. 5kg weight would output 5mV, 1kg would output 1mV, etc.. This gives you the rough value of the ADC result based on the value of 1 code (LSB) as shown in the datasheet ((0.5VREF/128)(2^23 – 1)).
To make the scale more accurate you would calibrate using a 2 point-slope method relative to system used. First you would capture the code with no weight applied, and then apply the calibration weight and capture the result code with the weight applied. The formula to convert would use the following:
Best regards,
Bob B
Hi Bob,
Thank you, for the response, I had some doubts to clarify.
My load cell sensitivity is 1mv/v and excitation/Vref is 3.3v. Then my full-scale output is 12kg
1) How to take Wt tare weight?
2) for every single code its increases 1g. Why it has happened and how can I control it?
3) I can't able to get the Static value. The output value keeps on fluctuating. How can I resolve it??
4) And also If I change the placement of the load which is on the surface of the load cell. The output value varies much that also not coming constantly. I need help to correct this one also.
Thanks & Regards
Navin Chakravarthy K
Hi Navin,
So your maximum output from the load cell is 3.3mV (3.3V * 1mV/V) for a 12kg weight applied. 1g of weight is 3.3mV/12000, or 275nV but the ADS1231 has inherent noise (PGA, modulator, etc.) of 232nV of peak-to-peak noise. So it is not clear what your expectations are for resolution. I would suggest that you take a look at the Analog Engineer's Calculator under the Data Converters section and Bridge Sensor + ADC. I have shown the calculator result below.
The data entered shows that for a 12kg load cell I can potentially achieve 1g resolution. However if I try to achieve 0.5g scale resolution the ADC noise is a limiting factor:
This is only for the ADC itself. Any external noise picked up from wiring such as EMI/RFI will affect the results. So there is a difference in ADC resolution where the value of 1 code is 0.5*Vref/128(gain)/(2^23-1) which is about 1.54nV and the scale result which is best case 232nV. So to see a noise-free result you need to eliminate the noise bits from the ADC result. This can be done in a variety of ways. One way is to right shift the result by the number of noise bits. Another method uses a mask to mask the noise bits to zero.
In the end the output code needs to be adjusted or compensated for the noise for the value to be stable.
1) How to take Wt tare weight?
The tare weight is determined after the initial calibration for zero weight applied and calibrated weight applied. The tare is simply the weight added by a platter or pan that should not be considered a part of the measurement. So the tare is just a weight measurement that should be zeroed out of the total and is taken prior to the actual desired weight measurement.
2) for every single code its increases 1g. Why it has happened and how can I control it?
I'm not sure what you mean here, but this sounds like it is related to noise or settling of any analog input filtering.
3) I can't able to get the Static value. The output value keeps on fluctuating. How can I resolve it??
This is directly related to noise, and as I said previously there will be noise codes (or bits) that must be removed from the ADC result.
4) And also If I change the placement of the load which is on the surface of the load cell. The output value varies much that also not coming constantly. I need help to correct this one also.
This sounds like you have not setup the load cell properly to be fitted with a proper surface. The load cell measures a deflection of a flat surface and a bending radius. The method used to make this stable depends on the type of load cell being used and is defined by the load cell manufacturer on how to make this a consistent measurement. If you send me a picture of your setup I may be able to give more specific guidance.
Best regards,
Bob B
Hi Bob,
Thank you again, you are right my setup was wrong. Now I am worked with the new setup. There is no fluctuation problem with the new setup. I can read the weight properly.
now my setup has a 4 x 50kg load cell, full scale weight is 200kg. Sensitivity is 1mv/v.
Still, I am facing some other problems. I can able to get the proper weight for my calibrated mass
but, If I put Some other load I can't even get the related output. Kindly check the below video
In the above video, I have put some load on my setup right. that is the load which I used for calibration. that was coming correctly. that load was 20400 g. But in the next step. I have put a reduced amount of weight on the setup. But this one gives a higher value than the previous one. In real this one is lower weight than the previous load. Again I have put the 1Kg load on the setup. but the system gives the values in the minus
Here, I need to know something
After calibration( manually calculated the m & Wzs). I have applied the below equation in my code.
y = (0.00125*adcvalue)-98.48;
Once, I start the code y will become my output in grams.
Is it right??. If it is wrong. guide me in the correct way.
And another one is every time I need to calculate the value of m & Wzs or one-time calculation is enough??
Thanks & Regards
Navin Chakravarthy K
Hi Navin,
The output code for the ADS1231 is binary 2's complement. This means that ADCs codes from 0 to 0x7FFFFF are positive values and 0x7FFFFF represents positive full-scale. Codes from 0xFFFFFF to 0x800000 are negative values and 0x800000 is negative full-scale.
What I see in the video are codes that are around 16 million which means that the returned value is not being properly evaluated. As the returned code is 24-bit, you should be sign-extending the 24-bit value to a signed 32-bit value. You might find the information in the following E2E post helpful:
As far as the calibration, you should only need to do this once assuming that you have stored the calibration values (EEPROM or micro flash) so that it can be restored following a power cycle.
Best regards,
Bob B
What I see in the video are codes that are around 16 million which means that the returned value is not being properly evaluated.
Hi BOB,
I can't able find what mistake I had did. So I will share my Code here. Kindly check and let me know to correct
void readADS1231(void) { adcvalue=0; nrf_gpio_pin_set(POWERDOWN); //POWER ON while(nrf_gpio_pin_read(DATAPIN) == 1);//WAIT UNTIL DATA IS READY //24-->21 clock (); if(nrf_gpio_pin_read(DATAPIN)){adcvalue=adcvalue+0X800000;} //24 clock (); if(nrf_gpio_pin_read(DATAPIN)){adcvalue=adcvalue+0X400000;}//23 clock (); if(nrf_gpio_pin_read(DATAPIN)){adcvalue=adcvalue+0X200000;}//22 clock (); if(nrf_gpio_pin_read(DATAPIN)){adcvalue=adcvalue+0X100000;}//21 //20-->17 clock (); if(nrf_gpio_pin_read(DATAPIN)){adcvalue=adcvalue+0X80000;} //20 clock (); if(nrf_gpio_pin_read(DATAPIN)){adcvalue=adcvalue+0X40000;}// clock (); if(nrf_gpio_pin_read(DATAPIN)){adcvalue=adcvalue+0X20000;}// clock (); if(nrf_gpio_pin_read(DATAPIN)){adcvalue=adcvalue+0X10000;}//17 //16-->13 clock (); if(nrf_gpio_pin_read(DATAPIN)){adcvalue=adcvalue+0X8000;} //16 clock (); if(nrf_gpio_pin_read(DATAPIN)){adcvalue=adcvalue+0X4000;}// clock (); if(nrf_gpio_pin_read(DATAPIN)){adcvalue=adcvalue+0X2000;}// clock (); if(nrf_gpio_pin_read(DATAPIN)){adcvalue=adcvalue+0X1000;}//13 //12-->9 clock (); if(nrf_gpio_pin_read(DATAPIN)){adcvalue=adcvalue+0X800;} //12 clock (); if(nrf_gpio_pin_read(DATAPIN)){adcvalue=adcvalue+0X400;}// clock (); if(nrf_gpio_pin_read(DATAPIN)){adcvalue=adcvalue+0X200;}// clock (); if(nrf_gpio_pin_read(DATAPIN)){adcvalue=adcvalue+0X100;}//9 //8-->5 clock (); if(nrf_gpio_pin_read(DATAPIN)){adcvalue=adcvalue+0X80;} //8 clock (); if(nrf_gpio_pin_read(DATAPIN)){adcvalue=adcvalue+0X40;}// clock (); if(nrf_gpio_pin_read(DATAPIN)){adcvalue=adcvalue+0X20;}// clock (); if(nrf_gpio_pin_read(DATAPIN)){adcvalue=adcvalue+0X10;}//5 //4-->1 clock (); if(nrf_gpio_pin_read(DATAPIN)){adcvalue=adcvalue+0X8;} //4 clock (); if(nrf_gpio_pin_read(DATAPIN)){adcvalue=adcvalue+0X4;}// clock (); if(nrf_gpio_pin_read(DATAPIN)){adcvalue=adcvalue+0X2;}// clock (); if(nrf_gpio_pin_read(DATAPIN)){adcvalue=adcvalue+0X1;}//1 clock ();//TO PULL DATA READY TO HIGH STATE --PAGE No.14 ON ADS1231 DATASHEET // nrf_gpio_pin_clear(CLOCK); nrf_gpio_pin_clear(POWERDOWN); }
The above loop gives the Adcvalue from ADS1231
void displaydata(void) { readADS1231(); y = (0.00125*adcvalue)-98.48; printk("Load= %.2f\n",y); len = sprintf(out_string,"LOAD: %.2f g,adcvalue: %ld",y,adcvalue); err = bt_nus_send(NULL,&out_string, len); }
The above loop gives the output of load by using the calculation of mass formula
Thanks & Regards
Navin Chakravarthy K
Hi Navin,
I believe you have made 'adcvalue' a global variable and this variable should be defined as a signed 32-bit. When the most significant bit of the 24-bit data is high, then the value is actually negative. You should be able to adjust your code so that the code line for the 24th bit is:
if(nrf_gpio_pin_read(DATAPIN)){adcvalue=adcvalue+0XFF800000;} //24
Adding FF to the most significant byte of the 32-bit signed variable will identify the value as negative.
Best regards,
Bob B