cancel
Showing results for 
Search instead for 
Did you mean: 

Configure LIS3DSH state machine to detect angle change?

Terence D
Senior

I've used the LIS3DSH state machine to set the INT1 interrupt high when a certain acceleration threshold is exceeded. However, I'd like to use the state machine to detect a change in orientation.

For example, I'd like it to set the interrupt high when the orientation of the accelerometer (when laying flat, with the Z axis pointing up) changes by a few degrees. Anyone know if this is possible?

Looking at STM Application Note AN3393, it looks like the only possibility might be to use peak detection as described in section 8 of AN3393. However, I'm concerned with such a slight angle of change (a few degrees), the noise of normal vibration might be too great to properly identify an angle change that small.

Anyone have any suggestions or thoughts?

1 REPLY 1
Eleon BORLINI
ST Employee

​Hi @Terence D​ , the AN3393 describes you also how to detect the orientation of the device in space, through 6D position recognition (p. 82). If you have to detect only one change in the angle (es. from 0 degrees to 10 degrees along Z, let's say some long term tilt application), you can set only 1 threshold along Z axis, defining it as 1g*sin(a) where "a" is the tilt angle with respect to flat surface and 1g the "flat case" sensitivity (lower FS 2g to increase the accuracy, embedded Vector filter enabled in case of long term change detection, to filter the high-frequency noise). Being the 2g sens 0.06 mg/digit (and also in case of 8-bit data cutter sens is 15.36mg), the 10 degrees tilt from the region of maximum sensitivity (i.e. 0 deg for z axis, 173mg from calculation) should be well detected. Of course, if you want to increase the accuracy of your FSM, you could set proper timings to screen spurious detection. Regards