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.

ADS1232: Linearity Calibration issue

Part Number: ADS1232

Hello,

In my project using ADS1232 interface with PIC 18F4520. I am using the schematic of Figure 42 from datasheet. instead of 3v in DVDD I put 5v. Without Crystal.

Loadcell : 5Kg

Sensitivity : 2mv / V

In Zero i'm getting: 1032607

With a weight of 3891g: 4092230

With a weight of 2004g: 3137156

i'm using the formula from ADS1232Ref.

m = 3891 /  (4092230 -  1032607) 3059623
m = 0,001271725
Wzs = -0,001271725 * 1032607
Wzs = -1313,192
W = 0,001271725 * 3137156 -1313,192 
W = 2676,40 g (not 2004g)
The code is:

long ler_adc (void)
{
int i=23;
int j = 1;
long teste = 0;
char txtexp[30];


while(SDI==1)
{
}

for(i=23;i>=0;i--)
{
    SCK=1;

    if(SDI==1)
                      { valor1[i]='1'; }

else
           {valor1[i]='0';}

}


SCK=1;
delay_us(10);
SCK=0;

//Binary to Decimal

rawadc = 0;
for(j=0;j<24;j++)
{
if(valor1[j]=='1')
{
teste = 0;
teste = ldexp(1, j);
rawadc = rawadc + teste;
}
else{}
}
UART1_Write_text(" ");
LongToStr(rawadc, txtexp);
UART1_Write_Text(txtexp);

}

SCK = SCLK
SDI = DRDY/DOUT
What's I'm doing wrong?

  • Hi Caio,

    Welcome to the forum! As to the issue you are dealing with I would first take a look at the initial data results before calibration to see if it is reasonable.  Your zero value seems very high and is about 2mV which is about 1/5 of the full-scale output of your load cell.  I would make sure you are interpreting the value correctly.  The ADS1232 outputs the conversion result in binary 2's complement.  I would verify the results you see showing in your C code to data returned on a scope or logic analyzer to make sure they match.

    You should also conduct a self offset calibration by issuing 26 SCLKs before you start.  In the end you need to try to discover why the zero code is showing much higher than zero. 

    By calculation without calibration you should see results that are close to what is expected.  If not then you most likely have some error in the way you are collecting the data.  Your no load result code should be limited to the ADS1232 device offset (which can be calibrated out using the self offset calibration) and any initial offset of the load cell itself.  The offset can be either positive or negative. 

    If one code represents about 2.33nV, then you can calculate the expected code per gram.  If the scale output is a maximum of 10mV for a 5kg load, then 10mV/2.33nV/5000 should give you the number of codes/g (858 codes/g).

    3891 g should be around 3338478 and 2004 g should be around 1719432 codes.  The difference in weight is 1887 g, or about 1619046 codes.  None of the returned codes come close so I would verify my results to make sure you are getting the correct values in your C code.

    Best regards,

    Bob B

  • Hi Bob,

    Thanks for you fast reply.

    I changed the load cell.

    Now I'm having theses datas:

    Zero (wrong, I don't know why) - 16770047
    16g - 4739
    4005g - 3654655
    2004g - 1817965

    i'm almost now, but I don't know how to get the right code with zero mass.
  • Hi Caio,

    You need to properly sign the value.  Codes returned from 0xFFFFFF to 0x800000 are negative codes.  When moving a 24-bit value to 32-bit you must properly extend the sign of value. 16770047 is hex 0xFFE3FF which is actually a negative value in binary 2's complement.  There are a number of ways to properly sign-extend.  I've done it a couple ways.  One way is to check the most significant bit and if it is '1' you can OR a value of 0xFF000000 to the number.  Another method is to left shift (<< 8) and then right shift (>>8) to force the correct sign.

    Best regards,

    Bob B

  • HI bob,

    I'm still not able to messure correct

    now:

    zero = 37295
    2470g = 2160095
    1000g = 1029872
    4005g = 3738095

    Do you have any idea?
  • zero(something about 50g) = 37295 = 0v
    2470g = 2160095 = 4,7mV
    1000g = 1029872 = 1,8mV
    4005g = 3738095 = 7,7mV
  • Hi Caio,

    Your 0 reading still seems high to me.  After running self offset calibration you should be within a few hundred codes worst case of 0.  Perhaps the bridge '0' is that far off.

    I really know very little about how you have this setup.  You said you are following Figure 42 of the datasheet.  Unfortunately that figure does not show any input filtering.  You really should have some analog input filtering (RC) to prevent aliasing and for helping to filter out EMI/RFI.  You could try like 1k series resistance and 0.1uF cap across the inputs.  You should also have at least a capacitor across the reference inputs as well (0.1uF).

    Layout of your board is very important.  If you are using a prototyping board with a bunch of wires connecting the various devices it is hard to get good performance.

    To help diagnose this further please send me more information as to how you have the system connected together, precise schematic, layout, etc..  Also, it is not clear if you are taking a single measurement point, or a number of points and averaging them. It would be much more helpful to see a large number of samples for each weight (minimum of 256 up to 1024) as continuous data (conversion results from the ADC consecutively.)

    Best regards,

    Bob B

  • Hi Bob thanks for your reply.

    A 150 ohm resistor series in input solved the problem.
    My zero still high (49105). but at least is working now.

    Thank You Bob.