# Breakout IDG500 Dual axis 500deg/sec

I need some help with figuring out the angle that the gyro setup is at. I do not have the slightest clue what is wrong with my code:

#include "math.h"

float angv=0.00;
float degree=0.00;
float time=100.00;
float test=0.005;
float angvms=0.00;

void setup()
{

Serial.begin(19200);

}

void loop()
{

if ((angv==0.00)||(angv==1.00)||(angv==-1.00))
{
Serial.println(degree);
Serial.println("Stable");
}
else
{
degree=(angv*(time/1000.00))+degree;
Serial.println(degree);
Serial.println("Moving");
}

delay(time);

}

Pretty much i start of at an agle of zero. However, when i rotate the gyro a little bit on the axis and then return it back to its starting position i get some nonzero number( even though it is at an angle of 0). This is the link to the gyro

there is some weired equation about gyro rate output-zero rate output/sensitivity im not sure if i have to use that or not considering that the only number that is chaning is zero output?? Thanks a lot for the help.

ok.
I have the same problem now but also no ideas.
Did you solve your problem yet?

I think I answered this in another thread. It is because you are not taking readings fast enough. Remove the delay(time) and see if it improves.

Hey, the delay time does improve things a little bit but does not completerly solve the problem. The problem is with something known as drift which is in all gyros. The problem is such a nuisance that there are thesis papers written by proffessors trying to figure out some way to get rid of this. Its really insane math. And they still havent managed to get rid of it succefully. The best bet would be to go with an accelerometer/gyro system. The accelerometer can detect tilt and can determine when the system is motionless and thus keep reseting the gyro so drift doesnt accumulate in teh angle reading. When the system moves or accelerates the accelerometer tells teh gyro to take the reading. then the system restabilizes adn the process repeats again. After spending several hours and days I determined it was next to impossible to get an exact reading. It seems to be more of an estimate that gets worst as time increases.