2019-05-02 11:37 PM
this library uses accelerometer data and pressure data for detecting fall, but i wanna know the algorithm of this library for using these data????please answer me, thanks:smiling_face_with_smiling_eyes:
2019-05-03 07:00 AM
Hi, the MotionFD Library of e.g. x-cube-mems1 refers to LSM6DSO and the algorithm for the free fall detection works as described in p. 41 of the app note AN5192. I suggest you to check the working principle directly in the iks01a3_motion_sensors_ex.c and the lsm6dso.c file.
1. Write 60h to CTRL1_XL // Turn on the accelerometer
// ODR_XL = 417 Hz, FS_XL = ±2 g
2. Write 41h to TAP_CFG0 // Enable latch mode with reset on read
3. Write 80h to TAP_CFG2 // Enable interrupt function
4. Write 00h to WAKE_UP_DUR // Set event duration (FF_DUR5 bit)
5. Write 33h to FREE_FALL // Set FF threshold (FF_THS[2:0] = 011b)
// Set six samples event duration (FF_DUR[5:0] = 000110b)
6. Write 10h to MD1_CFG // FF interrupt driven to INT1 pin
You can also implement the free fall detection through finite state machine as described at this link.
Regards