cancel
Showing results for 
Search instead for 
Did you mean: 

Generate Interrupt on horizontal rotation using LIS3DH

IThom.5
Associate II

Hi,

I have a jar lid which is equipped with LIS3DH accelerometer. The accelerometer is placed in the PCB such that the top layer of LIS3DH will face the sky in normal position. The jar has a groove for holding the lid and we need to put the lid in the groove and rotate it horizontally to lock it in. I want to use the LIS3DH to detect if some one is trying to open the lid. He/She will have to turn the lid horizontally in groove in the opposite direction to unlock it. Basically I need an interrupt to be triggered when the lid is rotated horizontally. Can anyone suggest the I2C register settings for detecting this?

I tried many combinations but most of them are generating interrupt when there is a tilt in vertical position. If I keep the device horizontally and keep rotating it without tilting no interrupt is getting generated.

I tired the following settings:

CTRL_Reg1 - 0x57 - 100HZ with All Axes Enabled

CTRL_Reg2 - 0

CTRL_Reg3 - 0x40 - IA1 interrupt on INT1

CTRL_Reg4 - 0

CTRL_Reg5 - 0x08 - Latch INT1 to INT1_SRC

INT1_THS - 0x10 = 250mg

INT1_DUR - 0

With these settings I tried many INT1_CFGs like 6D movement on all X and Y, 6D position on all X and Y, OR interrupt on all X and Y. None of them are helping in detecting the horizontal rotation.

Kindly let me know if you have a solution for this.

5 REPLIES 5
Eleon BORLINI
ST Employee

hi, I think that the easiest way to get an interrupt from a rotation event could be using a 6-axis module like LSM6DSO, setting a threshold on the speed of this rotation. However, if you are limited in using LIS3DH device you should enable only high event interrupt for X-axis and Y-axis into the register INT1_CFG (30h) (i.e. XHIE and YHIE, to enable interrupt generation on X and on Y. Regards

IThom.5
Associate II

Hi,

Thanks for the reply.

Unfortunately, LIS3DH is part of the hardware now and it can't be changed.

I tried enabling only XH and YH interrupts but that also did not work for me. Maybe the rotation speed was not enough to cross the threshold acceleration.

For XH and YH only, the INT1_CFG has to be set to 0x0A right?

Also, I am using the 6D movement setting so that the interrupt signal will remain only for ODR time period. I cannot have the interrupt signal on till it is cleared since the pin is muxed with other interrupts also. Am I right to say that if I do not use 6D movement setting, the signal will remain till it is cleared?

Eleon BORLINI
ST Employee

Consider that the interrupt generation depends on the reciprocal position between the sensor/board and the lid. The accelerometer detects the linear acceleration, so the module depends on the distance of the sensor from the center of the lid.

0690X000008BTkyQAG.png

When you are configuring the INT1_CFG  register, you could select the AOI bit to have an interrupt only when both axis exceed the threshold, and you could also try to tune the INT1_THS - 0x10 in a different value than 250mg.

For the future, you could also use a pressure sensor such as the LPS22HH to detect if the jar is open or not, merging the data in a sensor hub. Regards

IThom.5
Associate II

Hi Eleon,

Thanks for the reply.. I was not aware of the significance of the module position. Thank you for the input..

We are going for the next revision of the hardware. So the option of changing the module is open now.. I have shared the LSM6DSO option with the hardware team. An issue with the module is its cost. Is there a low cost solution which can be used for the same functionality?

If we go with pressure sensor, I am assuming this part will have to be part of the lid in such a way that it will be in contact with the jar when it is closed. Am I right? When the lid is opened, the contact will be lost which gives a change in pressure that we can detect. Is my understanding correct? I will check this also with the hardware and mechanical team..

Thanks and Regards

Ison Thomas

Eleon BORLINI
ST Employee

Hi Ison,

>> Is there a low cost solution which can be used for the same functionality?

Of course, I can suggest you LSM6DS3 part number, which should be a valuable trade-off between the pricing and the purpose of the application. It has also an embedded temperature sensor that could be useful to monitor or log the environmental goodness of the jar.

>> [Pressure sensor] Is my understanding correct?

I maybe misunderstood the application in a first moment: the pcb will be outside and not inside the jar, right? In this case the pressure sensor is not immediately useful. However, in case there would be the possibility to embed the pcb inside the lid, it might could be a solution for the activity recognition.

Regards