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.

CC2541: issue with Accelerometer

Other Parts Discussed in Thread: SENSORTAG-SW

I've already updated the firmware of my Ti SensorTag but now, the values of accelerometer on x, y, z axis are different then before. It may seems that the calculations are wrong. Could you confirm me that or could you tell me the correct way to calculate the values from accelerometer?

At this moment these are the methods that I use to calculate them:

+(float) calcXValue:(NSData *)data {

    char scratchVal[data.length];

    [data getBytes:&scratchVal length:3];

    return ((scratchVal[0] * 1.0) / (256 / KXTJ9_RANGE)) * -1;;

}

+(float) calcZValue:(NSData *)data {

    char scratchVal[data.length];

    [data getBytes:&scratchVal length:3];

    return ((scratchVal[1] * 1.0) / (256 / KXTJ9_RANGE));

}

+(float) calcYValue:(NSData *)data {

    char scratchVal[data.length];

    [data getBytes:&scratchVal length:3];

    return ((scratchVal[2] * 1.0) / (256 / KXTJ9_RANGE)) * -1;

}

+(float) getRange {

    return KXTJ9_RANGE;

}

Where KXTJ9_RANGE= 4.0

Thanks

 

  • Roberto,

    I cannot really help with your problem, but I think your question lacks some details. What exactly do you mean when you say you updated the firmware? Did you patch up a sample application, create your own from scratch or really just update to a newer stock TI firmware?

    What were the values like before the update, what do they look like now? Do the new values differ, or are they constant, independent of orientation? I'm asking that because I'm having a seemingly similar problem at http://e2e.ti.com/support/low_power_rf/f/538/p/311948/1097759.aspx : I have flashed the newest original TI firmware .hex-file, and now I get a constant string returned when I ask for humidity data. Maybe we have the same problem?

    cheers,

    ben

  • I upgraded the firmware of my Ti SensorTag using the official application named SensorTag available on the appStore (I have an iPhone). Through the application, after you connected your sensorTag you can update the firmware. To test the values of the accelerometer, I use the sample project available on this link: http://www.ti.com/tool/sensortag-sw

    Before the update, the values of accelerometer of my SensorTag was correct (I mean for example that the value of g on the vertical axes was 1 G), after the update the values was wrong (I mean for example that on the vertical axes the value is 0.2 G).

    In the sample code these are the methods to convert digital signal in values of G for the accelerometer:

    @implementation sensorKXTJ9

    +(float) calcXValue:(NSData *)data {

        char scratchVal[data.length];

        [data getBytes:&scratchVal length:3];

        return ((scratchVal[0] * 1.0) / (256 / KXTJ9_RANGE));

    }

    +(float) calcYValue:(NSData *)data {

        //Orientation of sensor on board means we need to swap Y (multiplying with -1)

        char scratchVal[data.length];

        [data getBytes:&scratchVal length:3];

        return ((scratchVal[1] * 1.0) / (256 / KXTJ9_RANGE)) * -1;

    }

    +(float) calcZValue:(NSData *)data {

        char scratchVal[data.length];

        [data getBytes:&scratchVal length:3];

        return ((scratchVal[2] * 1.0) / (256 / KXTJ9_RANGE));

    }

    +(float) getRange {

        return KXTJ9_RANGE;

    }

    Could anyone help me to understand how to fix my problem, please?

     

  • If you go to https://www.google.de/search?q=sensortag+accelerometer+0.2 the first link is http://e2e.ti.com/support/low_power_rf/f/538/t/317175.aspx


    Sounds like this is the same problem.

  • Seems like KXTJ9_RANGE value is wrong, try to change it to 16 and test again. You can test the SensorTag first using the latest ios app (the range should be 8G). Hope it can help:)

    Chunmeng

  • your suggestion solved my problem. I changed the range to 16 and the values are correct now. Thanks!!!