Jump to content
I2Cdevlib Forums

Recommended Posts

Hi Jeff
 
First I want to say thanks for all the libraries not just the MPU-6050, been using them with a several different standalone sensors and combo boards. They all work great. 
 
Now for the question. I am using the FreeIMU code written by Fabio and as I was going through several of the comments I came across his todo list which brought me to the your's and his discussion on temperature compensation for the ITG-3200 board. One of the things that I noticed is that when I first start it takes quite a while before I can get stable readings from the MPU-6050 and the cube programs not to go nuts.
 
From what I can see from dumping the 6050 temp the readings don't really stabilize until about 22degC.  It also appears that the temp affects the accel readings and the gyro readings (raw) to different degrees depending on the axis (gyro or accel). I have only looked at 19-23degC region and not tried to heat it up yet . I can attach the graphs if you are interested.
 
Was wondering if you had any experience with this and point me in the right direction to correct it in the code, also based on the data is it worth it to put in the correction or just put a test in let it warm up first until a set limit.
 
Thanks for any advice - Mike
 
 
UPDATE:
Reran the experiment using a 1 second delay with similar results which I am uploading as a PDF images along with the Temperature profile. Out of curiosity I also ran just ran the MPU from startup for about 1 hour which I am also attaching which I am also uploading for your reference.

 

 

post-355-0-21399200-1379780845_thumb.png

post-355-0-03561800-1379780846_thumb.png

post-355-0-66012500-1379780846_thumb.png

post-355-0-60080300-1379780848_thumb.png

post-355-0-72772000-1379780850_thumb.png

post-355-0-93109900-1379780852_thumb.png

Temp Profile.pdf

Accel-Temp22-25.pdf

Gyro-Temp22-25.pdf

Accel-Temp Default.pdf

Share this post


Link to post
Share on other sites

UPDATE:

 

Just by way of a update I incorporated a temperature calibration routine into the freeIMU code and was able to drastically minimize the yaw drift. So basically, if you are not using DMP you should incorporate a temperature compensation routine if you have not already done so. PS for those of you that are using Fabio's code I made several other changes and was able to get the yaw drift almost all the way to 0.

 

Merlin.

Share this post


Link to post
Share on other sites

Not an answer, but my experience:

 

If you use MPU6050's DMP, you dont have to care for temperature calibration. I have been checking MPU6050 vs a Microstrain 3DM-GX2, and it seems so.

 

If not using DMP you have to compensate temperature, it is critical if you are using it in something like a quadrotor or airplane, etc. What I did is to leave the MPU6050 still reading values and temperature changing, then I obtain a linear (or cuadratic, don't remember) offset depending on temperature, and every time I read the sensor I also check temperature and compensate it.

 

Without changing temperature or air movement, I noticed it takes like 10 or 15 minutes to stabilize.

Share this post


Link to post
Share on other sites

Thanks for the response. I agree, using DMP would get the temp out of the equation, but I am a gluton for punish, especially since I really don't know the internals on DMP.  Eventually I will get around to DMP but for now still learning the process of sensor integration.

 

Implemented the same approach in the FreeIMU code since I am using that as the base. Will have to check if I leave it running for 10 - 15 minutes to check to see if it stabilizes.

 

Thanks for the confirmation and sharing the approach.

Share this post


Link to post
Share on other sites


#define MPU6050_ADDRESS         ((int) 0x68)//0x69 or 0x68 depending on your setup.

#define TEMP_OUT      0x41

float temp_MPU = 0;

int16_t rtemp_MPU;

void read_temp_MPU(){

int i = 0;

byte buff[6];

Wire.beginTransmission(MPU6050_ADDRESS);

WIRE_SEND(TEMP_OUT); // Send address to read from

Wire.endTransmission();

Wire.beginTransmission(MPU6050_ADDRESS);

Wire.requestFrom(MPU6050_ADDRESS, 2); // Request 2 bytes

while(Wire.available())

{

buff = WIRE_RECEIVE(); // Read one byte

i++;

}

Wire.endTransmission();

if (i == 2) // All bytes received?

{

rtemp_MPU = (((int16_t) buff[0]) << 8) | buff[1];

temp_MPU=float(rtemp_MPU)/340+36.53;

}

else

{

// Serial.println("!ERR: reading temperature");

}

}

Share this post


Link to post
Share on other sites
Hi Michiel

 

Here's another way to access the temp using Jeff's library. This was modified from Jeff's MPU6050_raw.ino example:

 

// Arduino Wire library is required if I2Cdev I2CDEV_ARDUINO_WIRE implementation

// is used in I2Cdev.h

#include "Wire.h"

#include "SPI.h"

 

// I2Cdev and MPU6050 must be installed as libraries, or else the .cpp/.h files

// for both classes must be in the include path of your project

#include "I2Cdev.h"

#include "MPU60X0.h"

 

// class default I2C address is 0x68

// specific I2C addresses may be passed as a parameter here

// AD0 low = 0x68 (default for InvenSense evaluation board)

// AD0 high = 0x69

MPU60X0 accelgyro;

 

int16_t rawTemp;

float temp;

 

#define LED_PIN 13

bool blinkState = false;

 

void setup() {

    // join I2C bus (I2Cdev library doesn't do this automatically)

    Wire.begin();

 

    // initialize serial communication

    // (38400 chosen because it works as well at 8MHz as it does at 16MHz, but

    // it's really up to you depending on your project)

    Serial.begin(38400);

 

    // verify connection

    Serial.println("Testing device connections...");

    Serial.println(accelgyro.testConnection() ? "MPU6050 connection successful" : "MPU6050 connection failed");

 

    // configure Arduino LED for

    pinMode(LED_PIN, OUTPUT);

}

 

void loop() {

 

    /** Get current internal temperature.

    * @return Temperature reading in 16-bit 2's complement format

    * @see MPU60X0_RA_TEMP_OUT_H

    */

    //Serial.println("Getting Die Temperature");

    rawTemp = accelgyro.getTemperature();

    temp=(rawTemp/340.)+36.53;

 

    Serial.println();

    Serial.print("temp deg C:  "); Serial.println(temp);

 

    delay(250);

 

    // blink LED to indicate activity

    blinkState = !blinkState;

    digitalWrite(LED_PIN, blinkState);

}

 

Have fun

Mike

Share this post


Link to post
Share on other sites

attachicon.gifAccel-Temp Default.pdfattachicon.gifAccel-Temp Default.pdfattachicon.gifTemp Profile.pdfattachicon.gifAccel-Temp22-25.pdfattachicon.gifGyro-Temp22-25.pdfHi Jeff

 

First I want to say thanks for all the libraries not just the MPU-6050, been using them with a several different standalone sensors and combo boards. They all work great. 

 

Now for the question. I am using the FreeIMU code written by Fabio and as I was going through several of the comments I came across his todo list which brought me to the your's and his discussion on temperature compensation for the ITG-3200 board. One of the things that I noticed is that when I first start it takes quite a while before I can get stable readings from the MPU-6050 and the cube programs not to go nuts.

 

From what I can see from dumping the 6050 temp the readings don't really stabilize until about 22degC.  It also appears that the temp affects the accel readings and the gyro readings (raw) to different degrees depending on the axis (gyro or accel). I have only looked at 19-23degC region and not tried to heat it up yet . I can attach the graphs if you are interested.

 

Was wondering if you had any experience with this and point me in the right direction to correct it in the code, also based on the data is it worth it to put in the correction or just put a test in let it warm up first until a set limit.

 

Thanks for any advice - Mike

 

 

UPDATE:

Reran the experiment using a 1 second delay with similar results which I am uploading as a PDF images along with the Temperature profile. Out of curiosity I also ran just ran the MPU from startup for about 1 hour which I am also attaching which I am also uploading for your reference.

What software you used to plot the readings?

Share this post


Link to post
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Loading...

×
×
  • Create New...