cancel
Showing results for 
Search instead for 
Did you mean: 

LIS3DH Motion detection and interrupt

FCent.1
Associate

Hi,

I'm developing a wearable smart device with nrf52832 and LIS3DH. In order to shutdown the MCU when the device is not worn I want to use the motion detection feature of the LIS3DH with an interrupt, so if the sensor doesn't fire an interrupt event for n minutes the MCU turns off (enters very low power mode).

The users can set the interrupt threshold and the full-scale as configuration options.

Here my current configuration

CTRL_REG1 = 0x2F //10Hz, low power mode, ZXY enable

CTRL_REG2 = 0x0 // No HP filter

CTRL_REG3 = 0x40 //IA1 enable

CTRL_REG4 = 0x00 //2g default value, configurable by user

CTRL_REG5 = 0x00

CTRL_REG6 = 0x0

INT1_THS   = 0x3A // 58 * 16mg = 928 mg

INT1_DURATION = 0x02

INT1_CFG  = 0x2A

The first question is: In order to update the sensor's configuration according to user preferences, can the MCU write the INT1_THS and CTRL_REG4 registers, after the initial configuration, without physically rebooting the LIS3DH? Should I have to clean them before?

The problem: With the configuration above and with full-scale at +/-2G and threshold = 58, the sensor fires interrupt also for very small motions (I can see an interrupt also when the smart device is laying on the table), but if I set the threshold at 22 I have to shake wildly the device to generate an interrupt. According to datasheet with threshold at 22 I should have an interrupt for all motions greater than 16 * 22 = 352 mg that is less than 928 mg so I should detect very small motions. Where am I wrong?

Thank you

Fabio

1 ACCEPTED SOLUTION

Accepted Solutions
Eleon BORLINI
ST Employee

Hi Fabio @FCent.1​ ,

To answer you first question: if you are interest in only change the INT1_THS and CTRL_REG4 registers' content, yes, you can just change their value without rebooting the device.

About your second question, the problem could be related to the INT1_CFG (30h) value, in the sense that you are enabling the ZHIE interrupt on Z high event bit, and -for example in the case the device is planar on a surface- the device currently detects about 1000 mg along the Earth gravity axis. This could cause the 928 mg threshold to be overcome by small movements about the sensed 1g (and you'll see this since you are in OR configuration of the interrupts, AOI and 6D bit of INT1_CFG (30h) register): this is not the case of the 352mg threshold, since it is distant from bot 0g and 1g.

A possible solution could be disable the Z axis interrupt detection, using only the X and Y axis, or the axis that is usually not pointing towards the center of the Earth. Another solution could be using the HP filter as described in the application note AN3308 p.25.

If this answer effectively helped you with your issue, please select it as "best".

-Eleon

View solution in original post

2 REPLIES 2
Eleon BORLINI
ST Employee

Hi Fabio @FCent.1​ ,

To answer you first question: if you are interest in only change the INT1_THS and CTRL_REG4 registers' content, yes, you can just change their value without rebooting the device.

About your second question, the problem could be related to the INT1_CFG (30h) value, in the sense that you are enabling the ZHIE interrupt on Z high event bit, and -for example in the case the device is planar on a surface- the device currently detects about 1000 mg along the Earth gravity axis. This could cause the 928 mg threshold to be overcome by small movements about the sensed 1g (and you'll see this since you are in OR configuration of the interrupts, AOI and 6D bit of INT1_CFG (30h) register): this is not the case of the 352mg threshold, since it is distant from bot 0g and 1g.

A possible solution could be disable the Z axis interrupt detection, using only the X and Y axis, or the axis that is usually not pointing towards the center of the Earth. Another solution could be using the HP filter as described in the application note AN3308 p.25.

If this answer effectively helped you with your issue, please select it as "best".

-Eleon

FCent.1
Associate

Hi,

thank you. Sorry for my late reply, I had been working on another project and I put the hands on this topic only the last week.

At the end I used the HP filter to detect the motions because I can't disable the Z-Axis, thank you again!