cancel
Showing results for 
Search instead for 
Did you mean: 

Lis3dh : X Y & Z value and Threshold configuration

ASREB
Associate II

Hello,

I have two technical questions regarding the lis3dh accelerometer behavior and interrupt configuration.

1) Are the values I read from the LIS3dh  in m/s²???? 

 Exemple :::

Accel [LIS3dh] 28807220458ns (-7.300384, -1.942303, -5.712095)

2) Interrupt logic (INT1_CFG :: XLIE / YLIE / ZLIE)

When I configure an interrupt threshold, for example 5 m/s², and enable the axis event bits in INT1_CFG 

XLIE / YLIE / ZLIE

Do the Low events correspond to the following type of comparison?

X < threshold, Y < threshold, Z < threshold

Or do they correspond to:

|X| < threshold, |Y| < threshold, |Z| < threshold

For instance, if I have the following measured values and the interrupt threshold is set to 5 m/s²:

  • Would this condition trigger an interrupt or not, according to the configured AOI ,XLIE / YLIE / ZLIE  (i put 1 for this register)???

Accel [LIS3DH] 29380340576ns (-18.442175, -19.566559, -19.461311)

Thanks for your response 

 

1 ACCEPTED SOLUTION

Accepted Solutions
Federica Bossi
ST Employee

Hi @ASREB ,

1) The LIS3DH outputs acceleration data in units of "g" (gravitational acceleration), not directly in m/s². To convert the raw output to m/s², you must:

  • Read the raw data from the sensor registers.
  • Apply the sensitivity value (which depends on the selected full-scale range, e.g., ±2g, ±4g, ±8g, ±16g).
  • Multiply the result by the standard gravity (9.80665 m/s²) to obtain the value in m/s².

The conversion formula is:

Acceleration (m/s²) = Raw_Value * Sensitivity * 9.80665

Where Sensitivity is in g/LSB, as specified in the LIS3DH datasheet for the selected range.

2) The LIS3DH interrupt logic for the XLIE, YLIE, ZLIE bits in the INT1_CFG register is as follows:

  • The "Low event" (LIE) is triggered when the acceleration value on the selected axis goes below the threshold set in the INT1_THS register.
  • The comparison is performed on the signed value of the acceleration, not the absolute value.

This means:

  • The interrupt is triggered if the acceleration on the selected axis is less than the threshold (X < threshold, Y < threshold, Z < threshold), considering the sign.
  • It does NOT trigger on the absolute value (|X| < threshold).

For your example: if the measured value is (-18.442175, -19.566559, -19.461311) and the threshold is set to 5 m/s², the interrupt will NOT be triggered by the LIE bits, because the values are much less than the threshold (in the negative direction), but the logic is for the value being less than the threshold, not the absolute value.

Given your configuration (AOI = 1, XLIE/YLIE/ZLIE = 1, threshold = 5 m/s²), and the measured values (-18.442175, -19.566559, -19.461311):

  • The interrupt will be triggered if all three axes are below the threshold (since AOI = 1 means AND logic).
  • Since all values are negative and less than 5 m/s², the interrupt will be triggered.
In order to give better visibility on the answered topics, please click on 'Accept as Solution' on the reply which solved your issue or answered your question.

View solution in original post

1 REPLY 1
Federica Bossi
ST Employee

Hi @ASREB ,

1) The LIS3DH outputs acceleration data in units of "g" (gravitational acceleration), not directly in m/s². To convert the raw output to m/s², you must:

  • Read the raw data from the sensor registers.
  • Apply the sensitivity value (which depends on the selected full-scale range, e.g., ±2g, ±4g, ±8g, ±16g).
  • Multiply the result by the standard gravity (9.80665 m/s²) to obtain the value in m/s².

The conversion formula is:

Acceleration (m/s²) = Raw_Value * Sensitivity * 9.80665

Where Sensitivity is in g/LSB, as specified in the LIS3DH datasheet for the selected range.

2) The LIS3DH interrupt logic for the XLIE, YLIE, ZLIE bits in the INT1_CFG register is as follows:

  • The "Low event" (LIE) is triggered when the acceleration value on the selected axis goes below the threshold set in the INT1_THS register.
  • The comparison is performed on the signed value of the acceleration, not the absolute value.

This means:

  • The interrupt is triggered if the acceleration on the selected axis is less than the threshold (X < threshold, Y < threshold, Z < threshold), considering the sign.
  • It does NOT trigger on the absolute value (|X| < threshold).

For your example: if the measured value is (-18.442175, -19.566559, -19.461311) and the threshold is set to 5 m/s², the interrupt will NOT be triggered by the LIE bits, because the values are much less than the threshold (in the negative direction), but the logic is for the value being less than the threshold, not the absolute value.

Given your configuration (AOI = 1, XLIE/YLIE/ZLIE = 1, threshold = 5 m/s²), and the measured values (-18.442175, -19.566559, -19.461311):

  • The interrupt will be triggered if all three axes are below the threshold (since AOI = 1 means AND logic).
  • Since all values are negative and less than 5 m/s², the interrupt will be triggered.
In order to give better visibility on the answered topics, please click on 'Accept as Solution' on the reply which solved your issue or answered your question.