Go Down

Topic: How to measure angle and rate with L3G4200D gyro ? (Read 46 times) previous topic - next topic

UnforgivenN

Hi,
I have been working on L3G4200D gyroscope for months.There are tons of topics about L3G4200D on forums,so I get confused.
I have found several working-codes.But all of them are use L3G4200D library.I have over it several times ,don't understand it. I don't want to use that library.I want to learn how to do that myself.
I would like to learn the main idea of the gyro. One thing that I want to learn how to  measure angle and rate. I will share my code and ask some questions.

[Here is control register 1 and control register 4 configuration]

Code: [Select]
void setup()
{
 Wire.beginTransmission(105);                     
  Wire.write(0x20);                                 
  Wire.write(0x0F);                                 
  Wire.endTransmission();                           
  Wire.beginTransmission(105);                       
  Wire.write(0x23);                               
  Wire.write(0xB0); //BDU is active and 2000 dps                                 
  Wire.endTransmission();

   for(int i=0; i<2000; i++)
  {
     gyro_signalen();                                     
    zero_level +=gyro_yaw;
   }
   delay(5);
}

void get_gyro()   // only z axis reading
 {
  Wire.beginTransmission(105);                     
  Wire.write(168);                                   
  Wire.endTransmission();                           
  Wire.requestFrom(105, 6);                         
  while(Wire.available() < 6);                     
  lowByte = Wire.read();                             
  highByte = Wire.read();                           
  gyro_yaw = ((highByte<<8)|lowByte);
 gyro_yaw=gyro_yaw*0.07;  // sensevitiy of 2000 dps is 70.

 }

I understand above all things except calibration. .Here are my questions :

1) my integer ,gyro_yaw is dps,isn't it ?  I know that: datasheet says that  
  Sensivity FS=2000 dps --70 mdps/digit.

     z [digits] * 70 [mdeg/s/digit] * (1/1000) [deg/mdeg] => [deg/s]

2) The gyro keeps outputing values when it is not moved.Rotational Velocity must be zero,but it is not.
 to solve  it ,I get 2000 values from the gyro and get zero level value,as you see above. so the question is How can I calibrate the gyro ? What can I do with zero_level value ?
 

3)According to configuration of  Control register 1 ,gyro produces value every 10 milisecond, is it right?
  my control register 1 is 00001111 ,as you see above.
 

4) How can I measure angle ?

Go Up
 


Please enter a valid email to subscribe

Confirm your email address

We need to confirm your email address.
To complete the subscription, please click the link in the email we just sent you.

Thank you for subscribing!

Arduino
via Egeo 16
Torino, 10131
Italy