gy-521/MPU-6050 wrong Z value

Hi,

I've got an GY-521 accelerometer/gyro/temp sensor (which has an MPU-6050 as sensor), when I read the accelerometers raw values the x-axis and y-axis give about right value (between -4,096 and 4,096 is what it should be) but the z-axis gives me a value between -3645 and 4699 (can be inaccurate). When i look at this it seems like there has been added about 500 to it. Does anyone know why this is and how to solve it?

Thank you in advanced TJ

PS: the µC I use is a Sparkfun Pro Micro

Datasheets: MPU-6050: https://store.invensense.com/datasheets/invensense/MPU-6050_DataSheet_V3%204.pdf GY-521 schematic: http://www.haoyuelectronics.com/Attachment/GY-521/GY-521-SCH.jpg

You may need to calibrate the accelerometer, as described in this overview.

Don't forget the Earth rotates and the MPU6050 zAxis of the Gyro and the Accelerometer will sense the rotation.

jremington: You may need to calibrate the accelerometer, as described in this overview.

Thank you, I'll get a look at it later as it is a rather long article.

Idahowalker: Don't forget the Earth rotates and the MPU6050 zAxis of the Gyro and the Accelerometer will sense the rotation.

It is impossible to measure earth rotation by any sensor of this kind, especially not this cheap, even if we ignore things like location on earth and some physics we would only have an axial rotation of 4.17m°/s. If you would like to discuss this topic with me or if you need more information about earth rotation feel free to send me a pm

TJHUNTER: It is impossible to measure earth rotation by any sensor of this kind,

MPU-6000/MPU-6050 Product Specification

7.8 Three-Axis MEMS Accelerometer with 16-bit ADCs and Signal Conditioning

The MPU-60X0’s 3-Axis accelerometer uses separate proof masses for each axis. Acceleration along a particular axis induces displacement on the corresponding proof mass, and capacitive sensors detect the displacement differentially. The MPU-60X0’s architecture reduces the accelerometers’ susceptibility to fabrication variations as well as to thermal drift. When the device is placed on a flat surface, it will measure 0g on the X- and Y-axes and +1g on the Z-axis. The accelerometers’ scale factor is calibrated at the factory and is nominally independent of supply voltage. Each sensor has a dedicated sigma-delta ADC for providing digital outputs. The full scale range of the digital output can be adjusted to ±2g, ±4g, ±8g, or ±16g.

The results I have obtained are in line with the product spec sheet.

It is impossible to measure earth rotation by any sensor of this kind

Completely agree, Idaho is confused about what is being measured.

@OP if you shy away from reading long articles that deal with a somewhat difficult problem comprehensively, here is a shorter one on a quick and dirty method.

https://learn.adafruit.com/adxl345-digital-accelerometer/programming