ArduIMU bug?

Hi guys,

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

You need to be a member of diydrones to add comments!

Join diydrones

Email me when people reply –

Replies

  • Sorry, should have done the calculations first, 3.3V/1023 = 0.003226, I am getting 381 so 381*0.003226 = around 1.23V. So it seems correct. Can I ask why the Gyro is not centered. It seem like it is more sensitive when rotating clockwise than anti-clockwise? Sorry, my understanding here is obviously flawed.
  • Hi Ryan,

    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
  • Developer
    A couple of things could be going on here. The first thing to check is that there is no zero rate bias and that your gyro gains are fairly close. Print out the raw analog voltages from the gyros and see what they are giving your. Back them through your equations and you will see what is most likely the problem. If there is an offset problem it will show up as an un even non zero split as you described.

    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
This reply was deleted.

Activity