cancel
Showing results for 
Search instead for 
Did you mean: 

LSM6DSM vs LSM303 threshold

SWenn.1
Senior III

I want to set a certain threshold on an accelerometer and have it generate an IRQ.

Do both of these accelerometers allow me to do this?

Is one better than the other for this application and if so why?

Thank you

1 ACCEPTED SOLUTION

Accepted Solutions
Eleon BORLINI
ST Employee

Hi @SWenn.1​ ,

the threshold can be set on both the mentioned devices.

For the LSM303AGR device, you can simply enable the axis and the direction for the threshold crossing, by configuring the INT1_CFG_A (30h) and the INT1_SRC_A (31h), and setting the desired threshold value in the INT1_THS_A (32h) register (see the datasheet from p.53).

For the LSM6DSM, it is a bit more complicated, since the configurable threshold depends upon the specific application you want to implement: you have a threshold for the wake up (WAKE_UP_THS (5Bh) register), one for the orientation/tap (TAP_THS_6D (59h) register), one for the free fall application, one for the tilt detection, etc. See the datasheet from p.96.

You might refer also to the C driver examples on Github for the configuration of the --> lsm6dsm_activity.c.

So, coming back to your first question, if you are just interested in detecting the crossing of a threshold, the LSM303AGR might be more suitable, otherwise if you already know the specific application, you should be oriented on the LSM6DSM device.

If my reply answered your question, please click on Select as Best at the bottom of this post. This will help other users with the same issue to find the answer faster.

-Eleon

View solution in original post

1 REPLY 1
Eleon BORLINI
ST Employee

Hi @SWenn.1​ ,

the threshold can be set on both the mentioned devices.

For the LSM303AGR device, you can simply enable the axis and the direction for the threshold crossing, by configuring the INT1_CFG_A (30h) and the INT1_SRC_A (31h), and setting the desired threshold value in the INT1_THS_A (32h) register (see the datasheet from p.53).

For the LSM6DSM, it is a bit more complicated, since the configurable threshold depends upon the specific application you want to implement: you have a threshold for the wake up (WAKE_UP_THS (5Bh) register), one for the orientation/tap (TAP_THS_6D (59h) register), one for the free fall application, one for the tilt detection, etc. See the datasheet from p.96.

You might refer also to the C driver examples on Github for the configuration of the --> lsm6dsm_activity.c.

So, coming back to your first question, if you are just interested in detecting the crossing of a threshold, the LSM303AGR might be more suitable, otherwise if you already know the specific application, you should be oriented on the LSM6DSM device.

If my reply answered your question, please click on Select as Best at the bottom of this post. This will help other users with the same issue to find the answer faster.

-Eleon