I am using ArduIMU as the sensor module for an autopilot I am building along with the wonderful open sourced DCM code. I found that when I print the ToDeg(Gyro_Vector[i]) from 0 to 3 instead of getting values from -300 to +300 as I expected I get values closer to -355 to +600???
My first question is why are these values not centered around 0? Also if this is the case, then this piece of code must be wrong?
//Detect Gyro Saturation and set flag
if((abs(Gyro_Vector[0])>=ToRad(300))||(abs(Gyro_Vector[1])>=ToRad(300))||(abs(Gyro_Vector[2])>=ToRad(300)))
{
gyro_sat=1;
}
Thanks in advance...
Will
Replies
Thankyou for the reply. I think it might be some sort of hardware issue or problem with the analog reference now. On a 10bit ADC it is my understanding that the gyro when still should return a value close to 512 (1.23V). I tested this on a spare LISY300 gyro I have and found this is true. I ran some very simple code on the arduIMU (Serial.println(analogRead(6))) and found that the gyro returns 381 when stationary. This made me wonder about the analogReference voltage as if it was still 5V this would be about right. I checked pin 20 on the micro and made sure my code was right. Pin 20 (VRef) is 3.3V as it should be. The next confusing thing is that when I turn the gyro, Stationary is 381, full back is 5 and full forward is 1018. If the VRef wasn't working then I would not see the full 10Bit range returned.
Any help you can give will be appreciated.
Will
An easy way to cross check the gyro scales is to simply integrate them and turn them 90 and see if you get pretty close. A smooth hand and a simple "that looks about right" should be enough to ball park it and see values that make sense. Let me know if you need any more specifics.
-Ryan