Results 1 to 4 of 4

Thread: L3G4200D Gyroscope _ Measuring Angle!?

  1. L3G4200D Gyroscope _ Measuring Angle!?

    Hello All,

    I am making an IMU for 6DOF which has L3G4200D 3-Axis Digital Gyroscope.

    I've checked so many Blogs, Forums, Application notes and have programmed accordingly to get the proper reading/information from my gyro.

    Though I am very near to solve it - a single problem has made me mad since last two nights!
    I've 16 bit digit - 1 signed bit + 15 bit value

    Suppose I want to measure an angle with respect to X-axis at 2000 dps, for that I am doing the following:

    X = X*70/1000; // X is of type int & having the 16bit value in it
    Print(X); // to print X on UART

    I am getting some values most probably <800 when I move gyro in counter clock direction with respect to X-axis and getting >4000 for the opposite direction!!

    I want to have positive angle values while rotating it on counter clockwise direction and negative angle values for the clock wise direction... For that what I should add on my calculations?? [Angles should be in degrees 1 to 180 & (-1) to (-180)]

    // in code 0.007 is in mdps which is the value of each LSB of gyro's data

    What I should add in could and why I am having >4000 & <800 values right now?

    Could anyone please help me with this?

    Thank you so much for your valuable time.

  2. Re: L3G4200D Gyroscope _ Measuring Angle!?

    I've observed(on internet) that everyone is getting +/- readings while I am not getting it.
    so I've tried it with different data type...
    and now I am getting +/- readings at both the side of the axis..

    but still my main question is unsloved!

    Can you tell me what should I do to getting the angles now???
    should I take x1 at time t1 and x2 at time t2 and then :
    X_angle = (x2-x1)/(t2-t1)

    Am I right???

  3. #3

    Re: L3G4200D Gyroscope _ Measuring Angle!?

    You are probably treating the 16-bit value as an unsigned short, instead of a signed short.
    Are you sure the value is sign bit plus mantissa? More normal would be two's complement, where the hex value 0xffff means "-1" and 0xfffe means "-2" and so on.

  4. #4

    Re: L3G4200D Gyroscope _ Measuring Angle!?

    Agree on the signed/unsigned thing.

    Also, what's the reading of the gyro when it's sitting perfectly still? The bias, that is. In my rover project, I did this to read L3G4200D values and convert to heading rate (on mbed, but it's just C/C++)

    void Sensors::Read_Gyro()
    {
    _gyro.read(g); // this just does the I2C stuff to get the int16_t (short) values back
    gTemp = (int) _gyro.readTemp();

    gyro[_z_] = (g_sign[_z_] * (g[_z_] - g_offset[_z_])) / g_scale[_z_];


    return;
    }

    Hope this helps.

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Similar Threads

  1. Question(s) L3G4200D Gyro Integration on Arduino
    By ROBOTMAN in forum Sensors
    Replies: 19
    Last Post: 03-22-2013, 10:30 AM
  2. Measuring Motor Transfer Function Quick & Dirty
    By liam.tr in forum Robotics General Discussion
    Replies: 0
    Last Post: 11-24-2010, 01:59 PM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •