Post Go back to editing

ADXL367 Upper and lower threshold values conversion

Category: Software

Hi,

How can you convert a decimal value to mg or mg to decimal value to set Activity and Inactivity threshold in the THRESH_ACT_H and THRESH_ACT_L registers. 

In the Start-Up Routine for Autonomous Motion Switch in datasheet I am unable to understand how the calculated these values. 

It will be very helpful if you can elaborate how these values are converted mathematically. 

Thank you

  • Is it possible to get a reply on this forum at all?

  • Hi  , 

    the activity and inactivity threshold are set by combining 2 registers, upper and lower byte, and the word size is 13-bit unsigned. Below are the registers for activity threshold.  

      

    The example for autonomous motion switch configuration that you quoted from the datasheet, assumes the full-scale range is set to 2g, but it looks like the values for the upper and lower register are not correct. 

    To set the Activity threshold to 0.25mg in step 1, the right values should be 0x00 for the upper register and 0x04 for the lower register. In code this would look like: 

    (((upper_byte<<8) | lower_byte)>>2)/scale factor, which is equal to (((0x00 <<8)|0x04)>>2)/4000 = 0.0025g 

    For the step 2, the upper inactivity threshold should be set to 0x7F and the lower to 0xFC, which is equal to 2g. 

    For step 7, the upper byte should be set to 0x03 and the lower byte to 0x0F. 

    I hope this helps, 

    Pablo. 

  • Thank you for the reply and correct values. 

    For step 7, I think you meant upper 0x03 and Lower byte 0xF0.

    Same problem with the temperature conversion. I am not getting the correct value when I convert the raw value to Celsius. I am getting 11 but the temperature is around 23. Can you kindly tell the correct conversion for temperature as well. I think that the values like temperature sensitivity and Bias are wrong in the Datasheet.  

  • Hi  , 

    The equation to convert the sensor data to temperature would be:

    T [C] = (y[LSB] – y_RT [LSB])/54[LSB/C] + RT [C]

    T is the measured temperature, y the value read from the sensor in LSB, the sensitivity is 54 LSB/C and y_RT is the sensor initial bias at room temperature (RT).

    Notice that the bias standard deviation is very wide, hence needs to be calibrated. 

    I hope this helps. 

    Pablo.