Jump to content
I2Cdevlib Forums

dpatel20

Members
  • Posts

    1
  • Joined

  • Last visited

dpatel20's Achievements

Newbie

Newbie (1/14)

0

Reputation

  1. Hi - I am looking to use the MPU6050 on a self balancing bicycle. I am using a PIC micro so can't take the code directly from i2Cdevlib. I am only interested in the angle in one axis (I'm only interested in roll). I have some questions I was hoping someone could help with: 1. If I'm interested in only one axis and only small angles (+/- 10deg), is it OK to just grab the accelerometer and gyro data for that one axis; or should I still get all 3 and combine for some reason? I have seen posts for other IMUs suggesting that you should combine readings to get the required angle. For example, assume I am interested in only the X angle, then it suggests something like this: //Convert Accelerometer values to degrees AccXangle = (float) (atan2(*(acc_raw_y),*(acc_raw_z))+M_PI)*RAD_TO_DEG; But what is incorrect with doing: AccXangle = (float) ((acc_raw_x / 9.81) * RAD_TO_DEG); // For small angles where sin(theta) is approx equal to theta Since I am not interested in full 360deg locus but just small angles, will the second method not work? I guess I can use the first method but I was curious; and want to know if I really need the overhead of the more complex atan2 function. 2. What is the method to 'zero' the gyro? Since the gyro measures angular velocity, the ang_vel*dt will give change in angle, hence needs summing from a known point. So, do I need to put my bike into a 'zero' position and then start the gyro measurements or is there a cleverer way to do it? If I'm using a complimentary filter in the form: X_angle = 0.98 * (angle + gyroX_vel * dt) + 0.02 * accXAngle then if I set X_angle = accXangle for the first loop iteration will that be OK?
×
×
  • Create New...