cancel
Showing results for 
Search instead for 
Did you mean: 

LIS3DH - Cannot have position detection running properly

SChab.1
Associate II

My LIS3DH is embedded on a PCB with gravity on Zh (upside down).

It is configured with:

  • ODR 10Hz, Z axis enabled
  • No filter
  • FS @2Hz
  • IA1 on INT1
  • Interrupt active HIGH
  • AOI and 6D pos (for position detection)
  • INT1 threshold set to 0x39 (around 0.916g)

This configuration is meant to have interrupt HIGH on nominal position, and LOW with the sensor is not vertical (angle of around 30°).

But using this kind of configuration (inverted INT usage) does not allow me to use the INT1_DURATION register.

I did try to use other axis to be in INT "normal" behaviour (active LOW when not in nominal vertical position), but I did not manage to find the proper configuration.

Has anyone already encounter this kind of situation?

Can anyone provide me with help?

Regards,

Sebastian

6 REPLIES 6
SChab.1
Associate II

To add some details, in my current use of the accelerometer, any shock is triggered, what I would like to avoid using the INT1_DURATION register value (low pass filter).

If trying to use other axis (Zl, X[h/l], Y[h/l]) and an adapted threshold, interruption is triggered ONLY outside a spherical pattern of threshold radius (if threshold above 0.5g) or 1g-threshold (if threshold below 0.5g), which I do not understand...

As an illustration (considering X/Y/Z for data):

  • using threshold = 0.6g, resting position is (0.1/-0.1/1.0): a position like (+0.3/-0.45/0.7) does not trigger interruption, but (0.61/-0.2/0.6) triggers it => that's OK
  • using threshold = 0.25g, resting position is (0.1/-0.1/1.0): a position like (+0.3/-0.45/0.7) does not trigger interruption, but (0.76/-0.2/0.5) triggers it => that's NOT ok
Eleon BORLINI
ST Employee

Hi @SChab.1​ ,

I'm not sure I have well understood... you want to get an interrupt when the Z axis is vertical (nominal position), while this interrupt has to be released when the device rotates for more than 30 degrees with respect to the ground floor, right?

If you want to switch the polarity, you can use the INT_POLARITY bit of the CTRL_REG6 (25h) register (see LIS3DH datasheet).

About the interrupt duration, please consider the application note AN3308, p.28 and p.29:

There are two possible configurations for the 6D direction function:

• 6D movement recognition: In this configuration the interrupt is generated when the device moves from a direction (known or unknown) to a different known direction. The interrupt is active only for 1/ODR.

• 6D position recognition: In this configuration the interrupt is generated when the device is stable in a known direction. The interrupt is active as long as position is maintained. 

For this reason, basically the INT1_DURATION register has no influence on 6D or 4D position recognition interrupt.

-Eleon

SChab.1
Associate II

Hi @Eleon BORLINI​ ,

Thanks for the reply: I have already read Datasheet and AN3308 lots of time to check if I did not miss something in them..

You understood what I do (and have explained).

What I do want to do is the contrary, but I did not find any way to perform it correctly.

I want to detect ANY position outside an angle of around 30° from resting position (vertical, Z toward ground, so 1g on Zh).

If I set interrupt on threshold on Zh, it is interrupting at resting position (globally what I have already done). But any tilt/shock is detected and triggers the end of the interrupt temporarily, which I cannot afford regarding my setup (interrupt triggers the power on a secondary device, without any software in between, nor logic inverter).

If I set interrupt on threshold on the other axis (which I thought would work properly), there is the strange behaviour I did describe in my second post.

Hi @SChab.1​ ,

maybe it is a not so clever suggestion, but you could try to use the simple Interrupt event generated by the overcoming of a threshold, and not the 6D position/orientation interrupt.

You could for example calculate the tilt at 30 degrees setting the threshold in the INT1_THS (32h) register (refer for example to this app note) and enable the direction of tilt in the INT1_SRC (31h) register. See the datasheet, p.42 and 43.

-Eleon

SChab.1
Associate II

Thanks for the suggestion @Eleon BORLINI​ , I will try this out and keep you in touch!

SChab.1
Associate II

Hi @Eleon BORLINI​ ,

Sorry not to have work on the subject earlier, but had a lot of work to do lately...

I tried to change the LIS3DH programing with the following:

  • simple interrupt with ZLIE activated
  • threshold set to 0x35

The situation is:

  • good interruption if device stays in "normal" orientation
  • no interruption if upside-down

The latter should not occur.... So i did try to activate interruption on SH and SL, but then it interrupts all the time...

I am completely lost about the use of this chip :/...

I am starting to think that I have to handle "position" internally to emulate an error... (if that's possible in my arch)