Skip to main content
Visitor II
September 2, 2017
Question

Problem with LIS3DH thresholds

  • September 2, 2017
  • 3 replies
  • 1900 views
Posted on September 02, 2017 at 13:08

Hello all

I have a problem with setting LIS3DH module to detect movement.

To be more precise, I want the device to set the INT1 pin down when the it experiences 32mg acceleration change for 0.5 second. 

Here are my settings:

CTRL_REG1 = 0x20 //10Hz, normal power mode, ZXY enable

CTRL_REG2 = 0x00 //no HP filters

CTRL_REG3 = 0x40 //IA1 enable

CTRL_REG4 = 0x10 //scale 4g

CTRL_REG5 = 0x08 //interrupt 1 pin latched

INT1_THS = 0x01 //32mg threshold

INT1_DURATION = 0x05 // 0.5s to activate interrupt

INT1_CFG = 0x7F  //6D direction mode enabled, all directions enabled

Now, when I read  INT1_SRC register it always shows 0x00 and INT1 pin never goes down...

Funny thing is that when I set 

INT1_THS to at least 0x0A it works but it is too much for me!

Could soemone help me with this case?

    This topic has been closed for replies.

    3 replies

    ST Employee
    September 4, 2017
    Posted on September 04, 2017 at 11:33

    First of all to enable all three axis the value of  CTRL_REG1 must be 0x27.

    Than you configuration of 

    INT1_CFG = 0x7F is not correct, basically you set the interrupt to be triggered if the acceleration is below or higher than threshold in any axis so this is always true.

    0690X000006083OQAQ.png

    So you should configure to enable interrupt only if the acceleration is higher than threshold, please be aware absolute value is evaluated, so it doesn't matter if the value is positive or negative. 

    You should also enable the high pass filter, because there will be always 1g of gravitation which would trigger the interrupt. The high pass filter will also omit any offset.

    CTRL_REG1 = 0x27 //10Hz, normal power mode, ZXY enable

    CTRL_REG2 = 0x01 // HP filter for INT1

    CTRL_REG3 = 0x40 //IA1 enable

    CTRL_REG4 = 0x10 //scale 4g

    CTRL_REG5 = 0x08 //interrupt 1 pin latched

    CTRL_REG6 = 0x02 // change interrupt polarity, active low as requested

    INT1_THS = 0x02 //64mg threshold, 0x01 can be close to noise so the interrupt would be triggered by the noise

    INT1_DURATION = 0x05 // 0.5s to activate interrupt

    INT1_CFG = 0x2A  //OR, X,Y,Z higher than threshold

    Visitor II
    September 5, 2017
    Posted on September 05, 2017 at 06:14

    Hi, Miroslav, My requirement is to detect movement of the door open/close for IIS2DH sensor and I have tried with above configuration but when I have getting interrupted and read x,y and z axis values and it is zero. So, what is wrong with this and could you please help me to detect door open/close. Thanks for your time.

    ST Employee
    September 5, 2017
    Posted on September 05, 2017 at 10:11

    Hello Arpan, no I can not solve your problem with the open/close door detection. It is complex task and I'm not able to solve it for you remotely. I already give you my best advice, this is all what I can do. If you project means relevant business for ST please contact your regional support and discuss it with them.

    Visitor II
    October 27, 2018

    Hi @Miroslav, please let me know the changes you have done in your code. If possible can you post the configurations here?

    I am facing the same prob.

    Visitor II
    January 10, 2019

    I had similar problem. I had to turn down power supply to allow lis3dh restart after programming uC. There is a bit in register 5 to run boot mode if you want to do it in software.