Skip to main content
Visitor II
May 27, 2020
Question

LIS2DH12 Direction Recognition Interrupt

  • May 27, 2020
  • 1 reply
  • 1392 views

In the datasheet, for the INT1_CFG register, it says:

AOI-6D = ‘11’ is direction recognition. An interrupt is generated when the orientation is

inside a known zone. The interrupt signal remains while the orientation is inside the zone.

I want to be able to generate an interrupt on INT1 pin when the sensor is on a flat surface for more than 3 seconds. The data sheet has little information on how to set this up. Other than setting the AOI and 6D bit to 11 in the INT1_CFG register, what other bits and register do I need to set to detect the flat position?

Can someone advise?

    This topic has been closed for replies.

    1 reply

    ST Employee
    May 29, 2020

    Hi @KYeo.1​ , the AN5005 (at p.28) is a little more detailed than the datasheet. Supposing you want to detect the e) or f) position of Figure 14, you have to set the INT1_SRC register according to the following table. If you then want to make the interrupt last about 3 seconds, you can set the INT1_DURATION (33h) register to N/ODR time, to get the appropriate timing (the value depends on the chosen ODR)

    0693W000001pgwDQAQ.png

    Regards

    KYeo.1Author
    Visitor II
    May 29, 2020

    Hi Eleon,

    Thank you for the reply. I want to detect position E in Figure 14. I don't understand when you say I have to set the INT1_SRC register because this is a read only register. Do you mean setting the INT_CFG instead?

    I want the interrupt to be generated after the sensor is stable for 3 seconds the (e) position. I tried to the following settings:

    INT1_CFG: 0b11100000

    INT1_THS: 0b00001000

    INT1_DUR: 0b01001011 // I am using ODR 25Hz , so 75/25 = 3 seconds

    When the sensor is flat for 3 seconds, no interrupt is generated.

    I lower the INT1_DUR to a very small value eg 0b00000010 and still there is no interrupt generated.

    But what I noticed is with this same settings, when the sensor is in the (b) position, and when I try to tilt it forward and backwards by a few degrees, an interrupt will be generated.

    What should be the correct setting?

    ST Employee
    May 29, 2020

    Yes, I was referring to INT_CFG register, sorry... so you want to generate an interrupt after the device is in flat position at least from 3 seconds, and not for a 3 second interval just after the device is in flat position... it si not so simple, I'm afraid... you could maybe latch the interrupt for 3 seconds (LIR_INT1 bit of CTRL_REG5 (24h), and setting the INT1_DURATION (33h) as before), and enable INT_POLARITY of CTRL_REG6 (25h) to have a transition from low to high when the event occurs... this procedure could however be affected by false positive events (for example changing the device position during the 3 seconds), but you should check if this is the case... Regards