gy521 - temperature correction

hi guys, my code is like that:

accelZ2 = accelZ2 / 16384.00;
accelZ2 = accelZ2 - (temperature*0.0002);

where temperature is

temperature= (temperature/340.00) + 36.53;

correcly readed (like 27 degrees)

in manual, they are saying that there is +/- 0.02% for every celsius..

am I doing my temperature correction correctly? I still don't get 0.0000 but values are flying from 0.0001 up to 0.0015 when no vibration is present

am I doing my temperature correction correctly? I still don't get 0.0000 but values are flying from 0.0001 up to 0.0015 when no vibration is present

I don't believe that you have no vibration at all. In the end you probably sit in front of that device and your heart is beating (I hope), so you definitely have some vibration even if your hundreds of miles from the next street or town. If you live in civilization a vibration of about 1mg is quite a good value. And don't forget, the sensor itself has some noise, so I think the values you get are great.

yes, that's true - there must be some vibration + noise :slight_smile: but is my correction correct?

is this right:

accelZ2 = accelZ2 - (temperature*0.0002);

or this:

accelZ2 = accelZ2 - accelZ2*(temperature*0.0002);

I have no idea and in datasheet no more info is present...

+/- 0.02% for every celsius.

You can correct for "+" or "-" but not both.

I have no idea and in datasheet no more info is present...

You cannot correct a measurement error as you don't know if the result is to high or to low. So don't correct the value but take the error into account everywhere you use the result afterwards. So if you make decisions on it always compare to a range and not a fixed value and so on.

ok.. so.. I clearly don't understand datasheet or..

there is +/- 0.02% for every celsius AND chip contains temperature sensor - so there must be a reason for that..

my understanding was like that:

if I'm in + celsius (0 and more)

acceleration = measured_acceleration - temperature*0.0002;

if I'm in - celsius (under 0 degrees)

acceleration = measured_acceleration + temperature*0.0002;

am I wrong? imagine I start measuring at temperature 20C, then lets say my quadrocopter fly up and direct sun and bla bla and I will have temperature 70C.. so there must be some correction made right..?

Determine the temperature effect yourself. Make some measurements at various temperatures.

My reading of the MPU6050 data sheet is that the temperature effect on accelerometer readings can be in either direction.