Hello guys,
I am trying to use MPU6050 but after all code i did for all the parts, i learned that DMP is not good for rocketry. They say it is maxed out.. I dont know why. Please explain what that means.
Also i saw a simple coding it gives me good values. But some poeple talk about setting gyro offsets and etc.. Could you please explain me why i have to set offsets and what does these mean?
In my code When i get AcX, AcY and AcZ. these doesnt make sense. Isn't it the accelerometer values? Shouldn't those be close to 0 because it is just sitting on the desk?
I am sorry for my stupid questions but everyone is talking middle of the book. Terms are flying around. I dont think it is that hard. But people overcomplicate things a lot for a small sensor.
I am trying to use MPU6050 but after all code i did for all the parts, i learned that DMP is not good for rocketry. They say it is maxed out.. I dont know why. Please explain what that means.
Also i saw a simple coding it gives me good values. But some poeple talk about setting gyro offsets and etc.. Could you please explain me why i have to set offsets and what does these mean?
In my code When i get AcX, AcY and AcZ. these doesnt make sense. Isn't it the accelerometer values? Shouldn't those be close to 0 because it is just sitting on the desk?
I am sorry for my stupid questions but everyone is talking middle of the book. Terms are flying around. I dont think it is that hard. But people overcomplicate things a lot for a small sensor.
C:
#include<Wire.h>
const int MPU_addr=0x68;
int16_t AcX,AcY,AcZ,Tmp,GyX,GyY,GyZ;
int minVal=265;
int maxVal=402;
double x;
double y;
double z;
void setup(){
Wire.begin();
Wire.beginTransmission(MPU_addr);
Wire.write(0x6B);
Wire.write(0);
Wire.endTransmission(true);
Serial.begin(9600);
}
void loop(){
Wire.beginTransmission(MPU_addr);
Wire.write(0x3B);
Wire.endTransmission(false);
Wire.requestFrom(MPU_addr,14,true);
AcX=Wire.read()<<8|Wire.read();
AcY=Wire.read()<<8|Wire.read();
AcZ=Wire.read()<<8|Wire.read();
int xAng = map(AcX,minVal,maxVal,-90,90);
int yAng = map(AcY,minVal,maxVal,-90,90);
int zAng = map(AcZ,minVal,maxVal,-90,90);
x= RAD_TO_DEG * (atan2(-yAng, -zAng)+PI);
y= RAD_TO_DEG * (atan2(-xAng, -zAng)+PI);
z= RAD_TO_DEG * (atan2(-yAng, -xAng)+PI);
Serial.print("AngleX= ");
Serial.println(x);
Serial.print("AngleY= ");
Serial.println(y);
Serial.print("AngleZ= ");
Serial.println(z);
Serial.println("-----------------------------------------");
delay(400);
}