Problem with LIS3DH thresholds
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Report Inappropriate Content
‎2017-09-02 4:08 AM
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?
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Report Inappropriate Content
‎2017-09-04 2:33 AM
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.
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
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Report Inappropriate Content
‎2017-09-04 11:14 PM
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.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Report Inappropriate Content
‎2017-09-05 3:11 AM
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.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Report Inappropriate Content
‎2017-09-14 12:05 PM
Hello Miroslav
Than you for your replay. Everything works fine and everything is now clear to me.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Report Inappropriate Content
‎2018-10-26 11:18 PM
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.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Report Inappropriate Content
‎2019-01-10 4:32 AM
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.
