Accelerometer MPU-6050 conversion of raw data

2

I'm using an MPU6050 with the arduino UNO, however the values that this sensor displays are the raw values. I need the acceleration values for distance calculation, but I'm not getting the actual acceleration value.

Here are some answers that the sensor displays:

AcX = -13428 | AcY = 5280 | AcZ = -8384 | Tmp = 27.12 | GyX = -998 | GyY = -310 | GyZ = -86
AcX = -13120 | AcY = 5580 | AcZ = -7488 | Tmp = 27.07 | GyX = -269 | GyY = -203 | GyZ = -2
AcX = -13212 | AcY = 5444 | AcZ = -8396 | Tmp = 27.12 | GyX = -367 | GyY = -264 | GyZ = 135

Based on the sensor datasheet I divided the acceleration values by 16384 to test and the values become Ax = 0.00 Ay = 0.00 and Az = -1 I believe I did not do it correctly.

Would anyone know how to convert the raw acceleration values to actual values? Sensor Datasheet: link

    //Carrega a biblioteca Wire
    #include<Wire.h>

    //Endereco I2C do MPU6050
    const int MPU=0x68;  
    //Variaveis para armazenar valores dos sensores
    int AcX=0,AcY=0,AcZ=0,Tmp=0,GyX=0,GyY=0,GyZ=0;

    void setup()
    {
      Serial.begin(9600);
      Wire.begin();
      Wire.beginTransmission(MPU);
      Wire.write(0x6B); 
      //Inicializa o MPU-6050
      Wire.write(0); 
      Wire.endTransmission(true); 
    }
    void loop()
    {
      Wire.beginTransmission(MPU);
      Wire.write(0x3B);  // starting with register 0x3B (ACCEL_XOUT_H)
      Wire.endTransmission(false);
      //Solicita os dados do sensor
      Wire.requestFrom(MPU,14,true);
      //Armazena o valor dos sensores nas variaveis correspondentes
      AcX=Wire.read()<<8|Wire.read();  //0x3B (ACCEL_XOUT_H) & 0x3C (ACCEL_XOUT_L)     
      AcY=Wire.read()<<8|Wire.read();  //0x3D (ACCEL_YOUT_H) & 0x3E (ACCEL_YOUT_L)
      AcZ=Wire.read()<<8|Wire.read();  //0x3F (ACCEL_ZOUT_H) & 0x40 (ACCEL_ZOUT_L)
      Tmp=Wire.read()<<8|Wire.read();  //0x41 (TEMP_OUT_H) & 0x42 (TEMP_OUT_L)
      GyX=Wire.read()<<8|Wire.read();  //0x43 (GYRO_XOUT_H) & 0x44 (GYRO_XOUT_L)
      GyY=Wire.read()<<8|Wire.read();  //0x45 (GYRO_YOUT_H) & 0x46 (GYRO_YOUT_L)
      GyZ=Wire.read()<<8|Wire.read();  //0x47 (GYRO_ZOUT_H) & 0x48 (GYRO_ZOUT_L)

      //imprimindo os valores da aceleração lido pelo sensor antes do calculo.
      Serial.println("\n");
      Serial.print("AcX = "); Serial.print(AcX);
      //Envia valor Y do acelerometro para a serial
      Serial.print(" | AcY = "); Serial.print(AcY);
      //Envia valor Z do acelerometro para a serial
      Serial.print(" | AcZ = "); Serial.println(AcZ);
      Serial.println("\n");

      //calculo para converter o valor bruto do acelerometro
      float Ax=AcX/16384;
      float Ay=AcY/16384;
      float Az=AcZ/16384;

     //valor da aceleração após o cálculo.
      Serial.print("AcX = "); Serial.print(Ax);
      Serial.print(" | AcY = "); Serial.print(Ay);
      Serial.print(" | AcZ = "); Serial.print(Az);

      //Envia valor da temperatura para a serial 
      //Calcula a temperatura em graus Celsius
      Serial.print(" | Tmp = "); Serial.print(Tmp/340.00+36.53);
      //Envia valor X do giroscopio para a serial 
      Serial.print(" | GyX = "); Serial.print(GyX);
      //Envia valor Y do giroscopio para a serial 
      Serial.print(" | GyY = "); Serial.print(GyY);
      //Envia valor Z do giroscopio para a serial
      Serial.print(" | GyZ = "); Serial.println(GyZ);

      //Aguarda 300 ms e reinicia o processo
      delay(400);
    }
    
asked by anonymous 29.05.2018 / 01:55

0 answers