Hi,

I am currently testing MMA8452Q accelerometer in my application and during test I found totally strange values coming out. While normally all axis should be between 0 - 1 g from very beginning of measurements I have x axis value around 15g. This value is constant no matter if sensor is laying or I am moving it in any direction - all the time it is around 15g. Can someone give me advice what might be wrong? Is it something wrong with IC, or should I look somewhere else? For reference I am enclosing my readings.

Thank you in advance.

**Original Attachment has been moved to: acc.csv.zip**

Hi Sebastian,

It looks like an incorrect interpretation of negative acceleration values. How are you converting the raw data from accelerometer registers 0x01 – 0x06 to signed 12-bit values and then real values in g’s?

You might find useful my example code where I illustrate this conversion:

// Signed 12-bit accelerometer data

Xout_12_bit = ((

short) (AccelData[0]<<8 | AccelData[1])) >> 4; // Compute 12-bit X-axis acceleration output valueYout_12_bit = ((

short) (AccelData[2]<<8 | AccelData[3])) >> 4; // Compute 12-bit Y-axis acceleration output valueZout_12_bit = ((

short) (AccelData[4]<<8 | AccelData[5])) >> 4; // Compute 12-bit Z-axis acceleration output value// Accelerometer data converted to real values in g's

Xout_g = ((

float) Xout_12_bit) / SENSITIVITY_2G; // Compute X-axis output value in g'sYout_g = ((

float) Yout_12_bit) / SENSITIVITY_2G; // Compute Y-axis output value in g'sZout_g = ((

float) Zout_12_bit) / SENSITIVITY_2G; // Compute Z-axis output value in g'sLet me know whether or not this helps, or if you have any other questions.

Regards,

Tomas

PS:If my answer helps to solve your question, please mark it as "Correct" or “Helpful”. Thank you.