Greetings - I'm puzzled by the results I'm getting from the MMA8451Q accelerometer. I've set the device up in Motion Detection mode with a threshold of approx. 1.5g's. But when the device indicates it's reached the Motion Detection Threshold and I read the acceleration values, they are often much lower than the specifiedThreshold!
Here are details of my setup -
// Set the range, -2g to 2g with High Pass Filter on, 800Hz ODR |
// Set to High Resolution mode ... and take the other defaults for CTRL_REG2 | |
// Set to detect Motion on any axis - Debounced |
// Set motion threshold to 1.5g. Leave Debounce Counter Mode in Inc/Dec
// Setup FIFO to Trigger Mode, set Watermark = 16 | |
// Setup FIFO to Trigger on Motion Detection exceeding Threshold | |
//Set FIFO interrupt only to pin INT1 | |
//Enable FIFO interrupt only in MMA8451
XYZ_DATA_CFG: 0x10
FF_MT_CFG: 0xF8 //High Pass filter on, Fullscale is -2g to +2g
FF_MT_THS: 24 // 24 x 0.0625g = 1.5g when fullscale is set to 2g
FF_MT_COUNT: 8
FIFO_SETUP: 0xD0
FIFO_TRIG_CFG: 0x4
CTRL_REG1: 0x5
CTRL_REG2: 0x2
CTRL_REG3: 0x0
CTRL_REG4: 0x40
CTRL_REG5: 0x40
This all works fine - I route the device to interrupt my KE06128Z (on a FRDM-KE06Z board) via KeyBoardInterrupt0. In the ISR I read all 192 Acceleration values in I2C burst mode (2 each for X, Y, and Z axis - 14 bit mode - times 32 buffer locations). Then later, in my main routine, I dump them all out, (see below), converted into "g's".
The data shows the device triggers far below the 1.5 g threshold! Why is that? The 16th reading, the Watermark (WM), should be at the 1.5g threshold, shouldn't it? I've also dumped the raw accelerometer value for the WM reading, so you can see that my conversion to "g's" is correct.
I've tried setting the Debounce count to 0, to insure I don't lose any readings - the results are the same: the readings are all below the Motion Detection Threshold many times.
I also tried reading the accelerometer data directly, once I got a Motion Detected interrupt. I got the same results: many times, the acceleration readings were far below the specified Motion Detection Threshold. Why is that? Thanks for your help!
Sean
FIFO 00: data: x= -0.012 y= -0.009 z= 0.045
FIFO 01: data: x= -0.005 y= -0.017 z= 0.047
FIFO 02: data: x= -0.009 y= -0.016 z= 0.043
FIFO 03: data: x= -0.010 y= -0.025 z= 0.044
FIFO 04: data: x= -0.010 y= -0.030 z= 0.049
FIFO 05: data: x= -0.016 y= -0.036 z= 0.056
FIFO 06: data: x= -0.018 y= -0.037 z= 0.064
FIFO 07: data: x= -0.020 y= -0.044 z= 0.068
FIFO 08: data: x= -0.026 y= -0.040 z= 0.077
FIFO 09: data: x= -0.024 y= -0.038 z= 0.084
FIFO 10: data: x= -0.030 y= -0.033 z= 0.090
FIFO 11: data: x= -0.030 y= -0.028 z= 0.103
FIFO 12: data: x= -0.032 y= -0.024 z= 0.107
FIFO 13: data: x= -0.034 y= -0.021 z= 0.107
FIFO 14: data: x= -0.031 y= -0.015 z= 0.114
FIFO 15: data: x= -0.027 y= -0.009 z= 0.111
Raw WM x= 0xFFFFFF82 y= 0xFFFFFFD6 z= 0x1B2
FIFO WM: data: x= -0.031 y= -0.010 z= 0.106
FIFO 17: data: x= -0.026 y= 0.000 z= 0.101
FIFO 18: data: x= -0.021 y= 0.006 z= 0.100
FIFO 19: data: x= -0.016 y= 0.006 z= 0.091
FIFO 20: data: x= -0.012 y= 0.008 z= 0.079
FIFO 21: data: x= -0.006 y= 0.006 z= 0.071
FIFO 22: data: x= -0.000 y= 0.011 z= 0.064
FIFO 23: data: x= 0.003 y= 0.009 z= 0.053
FIFO 24: data: x= 0.001 y= 0.006 z= 0.043
FIFO 25: data: x= 0.004 y= 0.007 z= 0.025
FIFO 26: data: x= 0.001 y= 0.005 z= 0.005
FIFO 27: data: x= 0.004 y= 0.004 z= -0.005
FIFO 28: data: x= 0.008 y= 0.004 z= -0.021
FIFO 29: data: x= 0.016 y= 0.003 z= -0.046
FIFO 30: data: x= 0.011 y= 0.003 z= -0.056
FIFO 31: data: x= 0.016 y= 0.003 z= -0.070
Thanks, Tomas -
Sean
Thanks, Tomas - that did it!
I'm curious as to why it works .... I would expect a high-pass filter to pass quick changes in motion/acceleration on, not block them. High values of acceleration should be "passed through" ... at least that's what I assumed. This seems to work just the opposite. Any comment? Can you direct me to where I might find more information on this feature?
Thanks again for your help!
Sean
Hi Sean,
The high-pass filter eliminates the DC tilt offset (effect of gravity) and low frequency acceleration changes, allowing only the higher frequencies to pass. The high-pass filtered data are used by the transient detection function by default (HPF_BYP bit = 0) whereas the motion detection function, which you have decided to use, uses “unfiltered” data. Have a look at our app notes AN4071 and 4070 for more information.
Regards,
Tomas
Hi Sean,
Looking at your settings, I noticed that you have the high-pass filter enabled (XYZ_DATA_CFG = 0x10). It explains why you are seeing such small values - the output data is high-pass filtered. If you disable the high-pass filter (XYZ_DATA_CFG = 0x00), you should get the expected acceleration readings.
Let me know if you have any other questions.
Regards,
Tomas
PS: If my answer helps to solve your question, please mark it as "Correct". Thank you.