cancel
Showing results for 
Search instead for 
Did you mean: 

IIS2DH Activity/Inactivity threshold setting

Arpan Patel
Associate II
Posted on January 20, 2018 at 05:15

Hi, I have configured accelerometer's registers as follows. So, from the activity threshold value how I know that at which raw value of X, Y, and Z axis it will be interrupted on a specific pin?

///////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////

response = LIS3DH_SetODR(LIS3DH_ODR_10Hz);

if(response==1){

print('SET_ODR_OK\r\n');

}

response = LIS3DH_SetMode(LIS3DH_LOW_POWER);

if(response==1){

print('SET_MODE_OK\r\n');

}

response = LIS3DH_SetFullScale(LIS3DH_FULLSCALE_2);

if(response==1){

print('SET_FULLSCALE_OK\r\n');

}

response = LIS3DH_SetAxis(LIS3DH_X_ENABLE | LIS3DH_Y_ENABLE | LIS3DH_Z_ENABLE);

if(response==1){

print('SET_AXIS_OK\r\n');

}

response = LIS3DH_SetFilterDataSel(MEMS_ENABLE);

if(response==1){

print('Filter Data Selection enable\r\n');

}

response = LIS3DH_SetInt2Pin(LIS3DH_INT_ACTIVITY_ENABLE|LIS3DH_INT_ACTIVE_LOW);

if(response==1){

print('ACTIVITY enable\r\n');

}

response = LIS3DH_SetInt2Configuration(LIS3DH_INT2_OR|LIS3DH_INT2_ZHIE_ENABLE|LIS3DH_INT2_ZLIE_ENABLE|LIS3DH_INT2_YLIE_ENABLE|LIS3DH_INT2_YHIE_ENABLE|LIS3DH_INT2_XLIE_ENABLE|LIS3DH_INT2_XHIE_ENABLE);

if(response==1){

print('INT2 configuration\r\n');

}

response = LIS3DH_ActThreshold(0x08);

if(response==1){

print('ACTIVITY threshold set\r\n');

}

response = LIS3DH_SetActDuration(0x0a);

if(response==1){

print('ACTIVITY duration set\r\n');

}

/////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////

I have set 0X08 into act threshold register so at which raw data on X,Y,Z axis I will get interrupt. Moreover, I have also disable two axis and tried to getting interrupt only on specific axis but the it will not working properly. So, could you help me to do this? Thanks.

6 REPLIES 6
Miroslav BATEK
ST Employee
Posted on January 24, 2018 at 11:14

First of all, this is nonsesne:

LIS3DH_SetInt2Configuration(LIS3DH_INT2_OR|LIS3DH_INT2_ZHIE_ENABLE|LIS3DH_INT2_ZLIE_ENABLE|LIS3DH_INT2_YLIE_ENABLE|LIS3DH_INT2_YHIE_ENABLE|LIS3DH_INT2_XLIE_ENABLE|LIS3DH_INT2_XHIE_ENABLE);

This condition is always true, because you enable both cases 'higher than' and 'lower than' threshold.

Which axis reach the threshold can be found in INT1_SRC or INT2_SRC registers.

Posted on January 24, 2018 at 14:00

Hi Miroslav, my requirement is to when some movement occurs accelerometer will wake up. So, that is why I have configured for both the event for threshold and in my case, I have used activity interrupt and as per data sheet, only INT2 will be used for activity threshold. How I configure accelerometer for any movement occurs it will wake up? Could you explain if 

I have set 0X08 into act threshold register so at which raw data on X, Y, Z axis I will get interrupted?

Posted on January 26, 2018 at 18:47

Here is description of the interrupt threshold, the value is related to used Full Scale.

0690X00000609SiQAI.png
Posted on January 29, 2018 at 05:54

Thank you. That means if I set the threshold to 0x08 for +-2g full scale than 16*8=128mg value is set for threshold value. Am I right or wrong? 

Posted on January 29, 2018 at 10:16

Yes, that is correct.

Posted on January 30, 2018 at 05:45

Thanks for the clarification. However, working of activity threshold setting for INT2 pin is not proper. I have set +-2g, 50Hz ODR , a low-power mode with FDS bit enable in CTRL_2 register and value for INT2_Config register only Y high event enable, act threshold value is 0x08. Whenever I have got interrupted on the pin and I have read X, Y, Z axis data:

x=0,y=1,z=1 so from this value of Y-axis how we say that threshold is the overpass. Because if we consider Y=1 means 1*16=16 mG and we set 8*16= 128 mG.