Iâ€™ve got a SparkFun 5DOF IMU. The idea is to use it connected to a pic16f876a to produce a measure of angle for a robot. However, Iâ€™m running into a lot of difficulty getting steady values from the gyro.
I initially measure a gyro value while the imu is stationary, which I take to be the â€˜zeroâ€™ value for the gyro (i.e. itâ€™s not turning). The idea is I then subtract this value from subsequent readings of the gyro to produce a rate of rotation. To do this I have the PIC spit out values for the gyro rate of rotation to an LCD. Strangely while the gyro is stationary I get a value of 463. Iâ€™ve got an LM317 giving me 3.3 volts to power the IMU, and this is also fed to the PICâ€™s VREF+, so I would intuitively have expected the zero point of the gyro to halfway through the ADCâ€™s range (10bit). Anyhow, the problem is if I then change the code to subtract this value from subsequent gyro readings I get a value of 1 or 2, not 0 as I would expect when the gyroâ€™s not moving. Obviously this produces huge errors if I start summing the gyro rate to give me an angle. If I try changing the zero calibration value to compensate (e.g. to 465), sometimes it seems to settle down, sometimes not.
Incidentally, I should mention that I also have some pots connected to the picâ€™s other analogue channels, and I seem to get rock solid values from these (no jittering or anything) when I output them to the LCD.
Is this all likely to be down to power supply problems? Iâ€™ve have a 5v regulator powering the pic with smoothing caps as per the datasheet, and the aforementioned lm317 powering the imu, again with the recommended caps. Or does the solution lie with the VREF from the gyro? According to the data sheet for the IDG300, â€œVREF is a temperature independent voltage reference
that can be used as a reference for an ADC. There is offset between the zero rate output and VREF.â€