Showing results for 
Search instead for 
Did you mean: 

Drift in pitch and roll angles when using MotionFX with the ISM330DHCX MEMS sensor


Hello everyone,

I'm working on implementing the Kalman Filter algorithm for sensor fusion from the MotionFX library using the ISM330DHCX MEMS sensor. My setup consists of the STM320G71RB board and the IKS02A1 expansion board. I'm trying to get the pitch and roll angles mainly, but the problem is, when the sensor is static, the pitch and roll angles exhibit drifting over time. In addition, when I look at the raw data from the gyro and accelertometer along all three axes, I don't see any drifting, only consistent fluctuations. This is what i'm currently doing using the motion_fx_cm0p.c library:



-MotionFX init

-Gyro calibration enabled

-6x fusion enabled and 9x fusion disabled

- sensor setup at 12.5 Hz data rate for both Acc and Gy, scale set to 2g and 125 dps, slope filter for Acc set to ODR/100, and LPF enabled for Acc.

- data acquisition from Acc and Gy in g and dps respectively.

- applying the MotionFX_CM0P_update() function to get rotation angles.



I also have tried compiling a generic app_mems.c file through the Device Configurator and then using the MEMS Studio GUI to see the rotation angles, but I'm still noticing the same behavior with drifting. Could it be that there is some defect with the sensor itself? The board is brand new and I had just got it a week ago.  I do have the other accelerometer (IIS2DLPC) and the magnetometer (II2SMDC) that come on the expansion board disconnected. I also don't believe this is due to temperature fluctuations because it should directly affect the raw data.


Help would be greatly appreciated.

Thank you.