Hello,
I am using MMA841 Accelerometer.
I stable condition i am getting higher value data on X,Y,Z axis.
I want to calibrate my accelerometer so that in stable condition it should read X,Y,Z axis data as zero.
For that i am referring application note AN-4069. I followed steps as in AN-4069.
For calibration i used following steps and Accel_offset_X,Accel_offset_Y, Accel_offset_Z are calculated as in given in AN-4069
MMA8451_WriteReg(MMA8451_CTRL_REG_1, 0x018);
MMA8451_WriteReg(0x2F, Accel_offset_X);
MMA8451_WriteReg(0x30, Accel_offset_Y);
MMA8451_WriteReg(0x31, Accel_offset_Z);
MMA8451_WriteReg(0x2A, CTRL_REG1_Data);//Set active mode
With this my calibration process is working.
But when i disable above steps and reprogram the device it is showing the original data as before calibration.
Please help me if i am going in wrong direction.
-Amreen
已解决! 转到解答。
Amreen,
What you seeing is correct as the offset registers (0x2F - 0x31) do not retain the value written into them when power is removed from the part. Power-cycling the MMA8451Q returns the offset registers to their default value of 0x00.
So it is advised to store the calibration values in the MCU flash memory or an external non-volatile memory and write them to the offset registers at a startup sequence.
Regards,
Tomas
Amreen,
What you seeing is correct as the offset registers (0x2F - 0x31) do not retain the value written into them when power is removed from the part. Power-cycling the MMA8451Q returns the offset registers to their default value of 0x00.
So it is advised to store the calibration values in the MCU flash memory or an external non-volatile memory and write them to the offset registers at a startup sequence.
Regards,
Tomas
Hello Thomas,
Thanks for earlier reply.
I have two questions related to the calibration.
1) If we calibrate Z axis it get set above/near to 1G. If we have to monitor (X,Y,)Z axis for the motion do we have to set threshold above 1G as Z axis base value is 1G.
2) We have observed if we keep threshold below 1G and enable motion detection on X,Y axis, motion is detected but no motion is detected if Z axis is also enable along with X,Y though movement is above threshold. Is the expected behavior?
Amreen,
1. The embedded motion detection function does not use the high-pass filtered data like the transient detection function, so you need to take into consideration static acceleration due to gravity when setting the threshold value for motion detection.
2. Are you sure that no motion is detected? If you enable also the Z-axis for motion detection and set the threshold value to e.g. 0.5g, the device is always detecting motion on the Z-axis with the device horizontal and motionless as the Z-axis is at +1g or -1g depending on the orientation of the device.
Regards,
Tomas