0

I am using a Parallax L3G4200D 3 axis Gyro. When a gyro is left on a flat surface with nothing interacting with it at all the outputs from it should all be “0″ correct? Mine is jumping around between numbers. For example “X_L = 0″ and “X_H = 17219″ with a “delay(500)” between refresh the X_H will jump around while X_L stays pretty much at 0 but will occasionally jump very high. Do you think this is a problem with the sensor or something code related? If I pick up the Gyro and shake it around all of the numbers start updating like its functioning correctly. Below is the output I am talking about this is when it is flat and nothing interacting with it:

Value of X is: 20
Value of Y is: 85
Value of Z is: 147168
Y_L equals: 0
Y_H equals: 9766
X_L equals: 2313
X_H equals: 0
Z_L equals: 34782
Z_H equals: 65535
The temperature is: 75


Value of X is: 22
Value of Y is: 49
Value of Z is: 147167
Y_L equals: 0
Y_H equals: 5654
X_L equals: 3855
X_H equals: 0
Z_L equals: 51143
Z_H equals: 65535
The temperature is: 75


Value of X is: 29
Value of Y is: 76
Value of Z is: 147168
Y_L equals: 0
Y_H equals: 8995
X_L equals: 65021
X_H equals: 65535
Z_L equals: 46260
Z_H equals: 65535
The temperature is: 77
  • Without and statistics about the values, it's hard to tell. Sensors are always noisy. Try to compute at least an average value over a certain time window (you can use a small sliding window to get nicely smoothed values over time). If that is still pretty much off from the values that you expect, there might be a problem with your code or the sensor. – Arne Mar 3 '13 at 15:49
1

Just a quick check to see if you are aware of this point:

Z_H equals: 65535
X_H equals: 65535

That number is 2^16 - 1, that is, the maximum range of a 16-bit unsigned integer. That kind of number will wrap around to become 0 if you add 1 to 65535 (or 65535 if you subtract 1 from 0, since unsigned numbers cannot be negative), meaning it is only an error of 1 in relation to 0.

1

First of all, I have no experience with the Parallax L3G4200D 3 axis Gyro or connecting any gyroscope to the raspberry. However I do know a few things about Inertial Reference Systems used in aircraft navigation. These systems use gyroscopes to determine the attitude of the aircraft. A correction needs to be applied for rotation of the earth.

When a gyro is left on a flat surface with nothing interacting with it at all the outputs from will not all be 0 as long as the earth is rotating. A well functioning three axis gyroscope has a fixed attitude in the space reference frame, so you will observe a rotation of about 15 degrees per hour.

Update:

I just checked the specifications of the Parallax L3G4200D. At its highest sensitivity setting it has a slope of 8.75 millidegrees per second per digit. That's equal to 31.5 degrees per hour so you will not be able to measure Earth's rotation of 15 degrees per hour. In that case the readings should all be 0 when the gyro is lying steady.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.