hi everyone,
because I need an overview of various values I decided to abandon the 3-axis sensor and buying a mpu9250..
I searched the internet and there are many libraries each with different steps in the calibration and show the values from the sensors.
I would just get the acceleration values and the rotation along the z-axis, ie its orientation in the environment (using gyroscope and magnetometer).
many speak of calibration and filters kalman or meg. I recommend you know how to proceed?
Thanks so much
Unless you disclose what you want to accomplish, no one can recommend a certain filter or other processing that you might need or not with the sensor.
i worked over it…
but i have problems with magnetometer…i am using this library, and it works very well…
i see that he doesn’t implement the read of magnet Z…
this is his code for gyro and magn:
void getMagData(int numLeituras)
{
//GETS FIELD INTENSITY FROM COMPASS
int xl, xh, yl,yh;
int i = 0;
float mediaMagX = 0;
float mediaMagY = 0;
float mediaMagZ = 0;
for(i=0;i<numLeituras;i++)
{
Wire.beginTransmission(0X0C);
Wire.write(0x03);
Wire.endTransmission();
Wire.requestFrom(0x0C, 4);
xl = Wire.read();
xh = Wire.read();
yl = Wire.read();
yh = Wire.read();
mediaMagX += (xh<<8|xl) - 30;
mediaMagY += (yh<<8|yl) - 45;
Wire.beginTransmission(0x0C);
Wire.write(0x0A);
Wire.write(0x01);
Wire.endTransmission();
}
magX = mediaMagX/numLeituras;
magY = mediaMagY/numLeituras;
}
void getGyroData(int numLeituras)
{
//GETS ANGULAR SPEED VALUES
int i = 0;
float mediaGyroX = 0;
float mediaGyroY = 0;
float mediaGyroZ = 0;
for(i=0;i<numLeituras;i++)
{
Wire.beginTransmission(MPU); //transmite
Wire.write(0x43); // Endereço registrador do Gyro
Wire.endTransmission(false); //Finaliza transmissão
Wire.requestFrom(MPU,6,true); //requisita 6 bytes
mediaGyroX += Wire.read()<<8|Wire.read(); //GYRO EIXO X
mediaGyroY += Wire.read()<<8|Wire.read(); //GYRO EIXO Y
mediaGyroZ += Wire.read()<<8|Wire.read(); //GYRO EIXO Z
}
gyroX = mediaGyroX/numLeituras;
gyroY = mediaGyroY/numLeituras;
gyroZ = mediaGyroZ/numLeituras;
}
i 'm thinking to modify :
Wire.requestFrom(0x0C, 4); with 6 instead of 4, for asking the three values…
but i don’t undestand this 30, and 45…
mediaMagX += (xh<<8|xl) - 30;
mediaMagY += (yh<<8|yl) - 45;
mediaMagZ+= (zh<<8|zl) - ???;
You can either try a more complete library,
or with this library should not be very hard to identify in the 9250 the codes needed for magnetic z value and complete the library. I don't know why it substracts 30 from x and 45 from y.