Skip to main content
Visitor II
August 31, 2020
Solved

I'm using a LIS2DE12 for sensing the opening and closing of doors. 1) The chip is resetting randomly when I communicate with over I2C. 2) I need to trigger an interupt a deceleration (negative acceleration), but can't put in a negative thredshold.

  • August 31, 2020
  • 5 replies
  • 2913 views

The chip is powered by an 3v3 LDO. I have measured the output, and there are no fall-outs. I suspect my I2C adapter to be doing it. On-board the I2C is pulled up to 3v3 by 2k2 resistors. But on the adapter the I2C gets pulled up to 5V also by 2k2 resistors. Could this be an issue?

    This topic has been closed for replies.
    Best answer by HClau.1

    Hi,

    I have been testing for while now.

    First, removing the pull-up resistors from the adaptor did the magic regarding the stability of the sensor.

    Second, I have gotten interupts from negative accelerations now thank you. I did what you said and enabled 6D.

    The application is for sensing the closing of a door. The implementation I have come up with for now is to look for a positive acceleration, say along the y-axis, and after a while for a negative acceleration.

    I have enabled the high-pass filter to eliminate the offset from the measurements.

    The interrupts are set to a low threshold but a duration for 0,3 seconds.

    Just from the top of your head, could you comment on this approach?

    5 replies

    ST Employee
    September 1, 2020

    Hi @HClau.1​ ,

    regarding the negative threshold, you should select which axis has to trigger the interrupt with register INT1_SRC (31h) (or the one for INT2), where you can decide if you want to use positive or negative values for the threshold.

    While, for the I2C random reset it can indeed be caused by the adapter, if the voltage goes up to 5V. the maximum voltage the sensor can withstand is 3.6V, so you should not give it more than that.

    Can I ask what adapter are you using?

    HClau.1Author
    Visitor II
    September 2, 2020

    Hi,

    I've looked through an app note for the negative thresholds. Seems like I have to enable 6d, is that correct?

    Regarding the adapter. It's home-made. But I believe you're correct, because I stripped the adapter for pull-ups, and it have been running longer than ever. But I'm still testing that part

    Regards

    ST Employee
    September 2, 2020

    Hi @HClau.1​ ,

    you are not forced to enable the 6D pin, that is for movement or position recognition (see page 40 of the datasheet https://www.st.com/resource/en/datasheet/lis2de12.pdf ).

    For your application I would suggest to use the OR combination of interrupt events, so AOI = 0 and 6D = 0.

    This way, the interrupt is triggered whenever the acceleration value is above the threshold.

    regarding the adapter, just make sure that the voltage of the sensor does not go above 3.6V, so if you have other nodes on the circuit that are at 5V but do not converge to the sensor it is ok.

    Regards.

    HClau.1Author
    Visitor II
    September 3, 2020

    Hi again.

    I'm trying to trigger on a negativ acceleration. It seems like I can't enter a negativ threshold ?

    ST Employee
    September 3, 2020

    Hi @HClau.1​ ,

    I am really sorry, but I made a mistake: you indeed have to enable 6D position recognition (AOI and 6D bits both set to 1 in register INT1_CFG (30h) ) to enable the z_low and z_high (positive and negative) threshold.

    I thought that it was not necessary, but I just confirmed it is.

    does it work now?

    HClau.1Author
    Visitor II
    September 4, 2020

    We're getting there :)

    Is it necessary to enable AOI also?

    ST Employee
    September 4, 2020

    Hi @HClau.1​ ,

    with 6D enabled, if you enable AOI the interrupt will remain high until the acceleration values return under the threshold, while, with AOI disabled, the interrupt rises one time when the threshold is exceeded.

    I think that this is ultimately your choice, but if you disable AOI you are sure that 2 consecutive interrupts are 2 separate events but the interrupt stays high only for a duration ODR, while with AOI enabled the interrupt remains high while the acceleration is over the threshold. (page 42 of datasheet https://www.st.com/resource/en/datasheet/lis2de12.pdf )

    what do you think is better for you?

    HClau.1AuthorAnswer
    Visitor II
    September 7, 2020

    Hi,

    I have been testing for while now.

    First, removing the pull-up resistors from the adaptor did the magic regarding the stability of the sensor.

    Second, I have gotten interupts from negative accelerations now thank you. I did what you said and enabled 6D.

    The application is for sensing the closing of a door. The implementation I have come up with for now is to look for a positive acceleration, say along the y-axis, and after a while for a negative acceleration.

    I have enabled the high-pass filter to eliminate the offset from the measurements.

    The interrupts are set to a low threshold but a duration for 0,3 seconds.

    Just from the top of your head, could you comment on this approach?

    ST Employee
    September 7, 2020

    Hi @HClau.1​ ,

    First of all, the HP filter is a great idea, so that you don't need to worry about setting the sensor perfectly.

    The duration of the interrupt should be important only if you have strict timing issues in reading them, but it's not wrong to set it like that.

    Overall I think this is a good approach, you probably just have to trim the threshold to avoid false positives and false negatives when detecting the opening/closing.

    Keep up the good work!