lis2dtw12 Activity/Inactivity Sensitivity & Full range, etc
Using the ST Micro github drivers as reference, I have an lis2dtw12 that I want to use to detect 2 things:
- detect motion of any kind (and check the FIFO to confirm motion happened)
- detect a "drop" - eg "the consumer product was dropped and probably is broken"
For case 1, I put the device to sleep, wake on activity, and fill the FIFO with the following:
/* Set full scale */
lis2dtw12_full_scale_set(&dev_ctx, LIS2DTW12_2g);
/* Configure FIFO */
lis2dtw12_fifo_watermark_set(&dev_ctx, 10);
lis2dtw12_fifo_mode_set(&dev_ctx, LIS2DTW12_BYPASS_TO_STREAM_MODE);
/* Set Output Data Rate */
lis2dtw12_data_rate_set(&dev_ctx, LIS2DTW12_XL_ODR_200Hz);
/* Configure filtering chain (Fig7 IN DS) * Accelerometer - filter path / bandwidth */
//Output Regs get the top path in Fig7:
lis2dtw12_filter_path_set(&dev_ctx, LIS2DTW12_HIGH_PASS_ON_OUT);
/* Configure power mode */
lis2dtw12_power_mode_set(&dev_ctx, LIS2DTW12_CONT_LOW_PWR_LOW_NOISE_12bit);
/* Set wake-up duration */
lis2dtw12_wkup_dur_set(&dev_ctx, 0);
/* Set sleep duration */
lis2dtw12_act_sleep_dur_set(&dev_ctx, 0);
/* Set Activity wake-up threshold */
lis2dtw12_wkup_threshold_set(&dev_ctx, 4);
/* Config activity / inactivity or stationary / motion detection */
lis2dtw12_act_mode_set(&dev_ctx, LIS2DTW12_DETECT_ACT_INACT);If I change the lis2dtw12_wkup_threshold_set from 4 to anything lower, it seems to always get triggered, but at 4 and higher, instead of "any" motion - there needs to be pretty significant motion to trigger an event (like a shake, not just "picking up the device").
Is it possible to dial this in more to detect a not very sudden "device movement"?
Also, full scale, data rate, etc seem to really have no bearing on the ability to wake the part up, right?
<edit > Also, oddly enough - when i call `lis2dtw12_filter_path_set` with high pass, or low pass (with bw/2, or bw/4), behaviour is the exact same - seems the wake logic only cares about the threshold...
For case 2:
Do you have any suggestions on how you would detect the part being dropped on a hard floor? (And using that event to send data to the FIFO / wake INT2)?
