cancel
Showing results for 
Search instead for 
Did you mean: 

LSM9DS1 6-direction detection function for interrupt

sheit
Associate II

Hi,

I was wondering if anyone had any information on how the 6 direction detection feature that is mentioned in INT_GEN_CFG_XL works. Obviously, to detect movement one would need to detect an acceleration change that can be either positive or negative. And also set a duration so we aren't woke by vibration.

6 REPLIES 6
Eleon BORLINI
ST Employee

hi, you can find some details on the 6D feature working principle checking similar iNemo app notes, for examples the LSM6DSO one (the concept is similar)

The device provides the capability to detect the orientation of the device in space, e.g. for automatic image rotation for mobile devices. Six orientations of the device in space can be detected; the interrupt signal is asserted when the device switches from one orientation to another. The interrupt is not re-asserted as long as the position is maintained. 6D interrupt is generated when, for two consecutive samples, only one axis exceeds a selected threshold and the acceleration values measured from the other two axes are lower than the threshold: the ZH, ZL, YH, YL, XH, XL bits of the INT_GEN_CFG_XL register indicate which axis has triggered the 6D event.

  • 6D is set high when the device switches from one orientation to another.
  • ZH (YH, XH) is set high when the face perpendicular to the Z (Y, X) axis is almost flat and the acceleration measured on the Z (Y, X) axis is positive and in the absolute value bigger than the threshold.
  • ZL (YL, XL) is set high when the face perpendicular to the Z (Y, X) axis is almost flat and the acceleration measured on the Z (Y, X) axis is negative and in the absolute value bigger than the threshold.

0690X0000088rwpQAA.png

You can set all the mentioned thresholds in registers INT_GEN_THS_X_XL (07h), INT_GEN_THS_Y_XL (08h), INT_GEN_THS_Z_XL (09h), while the interrupt duration can be set from the INT_GEN_DUR_XL (0Ah) register.

Here a brief visual description of the feature:

0690X0000088s1pQAA.png

0690X0000088s24QAA.png

Regards,

Eleon

Btw I suggest you to migrate to LSM6DSO(X) to have enhanced digital features and patter recognition (especially if you don't need the magnetometer (which is your target application, if I can ask?)

sheit
Associate II

Hi Eleon,

I think I have a better idea of how this works. Our goal is to detect when we get a linear acceleration in any direction. We are going to be attached to a surface that will not see significant angular change.

If I understand things right we should:

  • put a high pass filter on the accelerometer
  • set the AOI_XL bit as an OR
  • enable XHIE_XL, YHIE_XL, ZHIE_XL, XLIE_XL,YLIE_XL,ZLIE_XL

Since XL,YL,ZL go high when less than minus the threshold, we should get an interrupt when the high-passed accelerometer vector leaves a cube with edges at the threshold.

Eleon BORLINI
ST Employee

if you want to detect if you are moving with an acceleration that exceeds the threshold value on each axis directions, your procedure is ok. I maybe didn't catch well the target app.

btw you also have to set the INT_GEN_DUR_XL (0Ah) if you don't want to be waken up by a vibration (not enough the HP filter)

sheit
Associate II

Are the [X,Y,X]-axis high and low event interrupts triggered by magnitude? While sitting on my desk, if I enable all the low interrupts the unit continuously interrupts. Where if I only have all the highs on it seems that I get the behavior I want, triggering on an acceleration change in any direction.

Also do you know what the cuttoff frequency is when CTRL_REG7_XL.HPIS1 is 1? And is it possible to view this signal? I've tried setting CTRL_REG7_XL.FDS to 1, but I've had no luck.

Eleon BORLINI
ST Employee

are you filtering the gravity acceleration? if you are flat and you sense the g acceleration and the axis interrupts are in AOI and the threshold is less than 1g you will get an interrupt due to the gravity along z. But if you select the HPF in CTRL_REG7_XL reg should be ok... the HPF should be around 1Hz. regards