acceleration & gyro data spikes when device at rest

By stone , 29 August 2013

Hi
I'm using the firmware source is available at: https://github.com/Harinadha/STM32_MPU9150eMPL
This is a porting of eMPL 5.1 to stm32f which is done beautifully.
This code works fine on my board too. The data packet construction on my PC client software is similar to the code in Python client. This does construction of sensor data from bytes received for accel, gyro and compass. But the acceleration & Gyro data has spikes when the device at rest & in motion too. Refer to the following graphs: accel, gyro and mag.
Image removed.

Image removed.

Image removed.

Here is the code for constructing each axis sensor data:


short Concat(byte MSB, byte LSB)
{
//return (short)((short)((short)MSB << 8) | (short)LSB);
int temp = ((short)((short)MSB << 8) | (short)LSB);
if (temp > 32767)
temp = temp - 65536;
return (short)temp;
}

Each axis data is now calculated as shown below:
float accelX = (float)Concat(MSB, LSB) / 16384.0f;
float GyroX = (float)Concat(MSB, LSB) / 16.375f;
float MagX = (float)Concat(MSB, LSB);

I wonder what could be the problem.
Thanks in advance.
phpbb Topic ID
15564