Shop OBEX P1 Docs P2 Docs Learn Events
Gyroscope L3G4200D and problems with thermometer — Parallax Forums

Gyroscope L3G4200D and problems with thermometer

MorpheusMorpheus Posts: 1
edited 2013-01-06 11:28 in Accessories
Good time of the day!

I bought Parallax Gyroscope Module 3-Axis L3G4200D. Everything works beautifully! However, there is one 'but'. I need the temperature data from the temperature sensor embedded in the gyroscope. I have the code for Arduino and I even obtain the data (t = readI2C(0x26);). But the data itself is not adequate. Namely, the temperature data decreases at heating and increases at cooling.

Which changes do I have to make for the temperature data to be correct?

Comments

  • stetebsteteb Posts: 1
    edited 2012-02-20 12:51
    Hi,

    I am using the same gyroscope and I am trying to get temperature data from it too

    I have noticed the same as you and I was thinking that probably it is correct because in the datasheet, in the table 6, there is the following:

    Temperature sensor output change vs. temperature -> -1 °C/digit

    I don't know exactly but it may mean that temperature data decreases at heating and increases at cooling (?)

    My doubt is instead what temperature data represents. Is it already the temperature celsius value ?

    I need temperature data because I am noticing a zero rate level drift that seems caused by temperature change and I want to try to compensate it

    do you face a similar drift problem ? do you know by chance the best way to correct it ? I have only the gyroscope on my board, no other device such as accelerometer or magnetometer

    thanks

    bye

    Ste
  • GordonMcCombGordonMcComb Posts: 3,366
    edited 2012-02-20 13:38
    Another thread discusses this:

    http://forums.parallax.com/showthread.php?137934-Sample-code-for-temperature-from-Gyroscope-Module-3-Axis-L3G4200D-(-27911)

    See post #14.

    On the Arduino make sure you store to a char or int type. If 't' is a byte you'll get screwy numbers but that only stores an unsigned byte.

    In any case, the temperature reading from this shouldn't be used as a general ambient temperate measurement. That's not what it's for, if that is your intended application. An LM35, as an example, is easier and more accurate (10 bits rather than 8), and directly interfaces to an Arduino analog pin.

    -- Gordon
  • Paul RishelPaul Rishel Posts: 1
    edited 2012-06-07 14:25
    This is still kind of random, but it looks like if I subtract the value in the temp register from 50, the result is close to the ambient temperature. I also want to compensate for temperature-induced drift, but I think I may just use the raw values or some variant thereof to do it.
  • edawsonedawson Posts: 3
    edited 2013-01-06 11:27
    Morpheus wrote: »
    Good time of the day!

    I bought Parallax Gyroscope Module 3-Axis L3G4200D. Everything works beautifully! However, there is one 'but'. I need the temperature data from the temperature sensor embedded in the gyroscope. I have the code for Arduino and I even obtain the data (t = readI2C(0x26);). But the data itself is not adequate. Namely, the temperature data decreases at heating and increases at cooling.

    Which changes do I have to make for the temperature data to be correct?
  • edawsonedawson Posts: 3
    edited 2013-01-06 11:28
    Sensor Output is 25 at 25 Deg C and the output changes -1 for each Deg change in Temp
    The 25 is not the Temperature it is a Reference number
    To Get the Temperature you have to
    Subtract the Value in OUT_TEMP(26h) Register From 25
    then Add that to 25 Then use it as Deg C or Convert it to Deg F =(Deg C*9/5+32)
    Note The Temp is not ambient Temp it is the Sensor Temperature of the chip
    which changes negative for positive temp changes because that the direction the Measurements are affected
    They increase as temp Decreases so an negative correction is needed.
    To Measure Approx Ambient Temp one could add an offset Correction Number to get closer.
    Comment the temperature measurement is Sensor Temp not ambient. The following can be used to create something somewhat useful

    VAR

    Byte STemp, ESTemp

    PUB ReadTemp
    STemp := Read_1B(OUT_TEMP)
    ESTemp := 25 - STemp
    ESTemp := ESTemp + 25 - 4 'Deg C the -4 is my correction yours may be different
    ESTemp := ESTemp * 9 / 5 +32 'Deg

    Not Great but works
Sign In or Register to comment.