Data acquisition speed

I have a problem with the accelerometer GY-521, I am not able to reach the speed of data acquisition from the manufacturer, which in Standard mode is 100kHz.

What is the setting that I must do to reach this speed?

I’m only managing to 2kHz

#include<Wire.h>
const int MPU=0x68; // I2C address of the MPU-6050
int16_t AcX, AcX2,AcY,AcZ,Tmp,GyX,GyY,GyZ,cont = 0;
int16_t aux[500];
int32_t x = 0, tempo, tempoInicio, tempoFim;

void setup(){
Wire.begin();
Wire.beginTransmission(MPU);
Wire.write(0x6B); // PWR_MGMT_1 register
Wire.write(0); // set to zero (wakes up the MPU-6050)
Wire.endTransmission(true);
Serial.begin(115200);
}
void loop(){

if(cont == 0)
tempoInicio = millis();

Wire.beginTransmission(MPU);
Wire.write(0x3B); // starting with register 0x3B (ACCEL_XOUT_H)
Wire.endTransmission(false);
Wire.requestFrom(MPU,1,true); // request a total of 14 registers
AcX=Wire.read(); // 0x3B (ACCEL_XOUT_H) & 0x3C (ACCEL_XOUT_L)
// AcX2=Wire.read();

// 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)
//Serial.print("AcX = “); Serial.print(AcX);
//Serial.print(” | AcY = “); Serial.print(AcY);
//Serial.print(” | AcZ = “); Serial.print(AcZ);
//Serial.print(” | Tmp = “); Serial.print(Tmp/340.00+36.53); //equation for temperature in degrees C from datasheet
//Serial.print(” | GyX = “); Serial.print(GyX);
//Serial.print(” | GyY = “); Serial.print(GyY);
//Serial.print(” | GyZ = "); Serial.println(GyZ);
//delay(333);

x = x + AcX/2;
cont++;

if(cont == 110)
{
cont = 0;
tempoFim = millis();
tempo = tempoFim - tempoInicio;
Serial.print(tempo);
Serial.print(" ");
x = x/110;
Serial.println (x);
x=0;

//delay(2000);

//Serial.println(" incio ");

}

}

The 100kHz is the clock/data speed on the I2C bus. It can often be set to 400kHz. At 100kHz perhaps 8kbyte per second can be transferred. For 3 axis accelerometer and 3 axis gyro, that is perhaps 500 samples per second. There is also overhead in the software.

Your 2kHz is the number of samples per second. With that code, you read the lower 8 bits of the x-axis of the accelerometer. That data is not very useful. You have to read more data.

There is a MPU-6050 with the faster SPI bus, the MPU-6000. But the MPU-6000/MPU-6050 internal MEMS sensor are not ment for high samples rates. When you want to measure impact events, or measure vibration harmonics of an engine, you better look for an accelerometer that is ment to measure that.

Have you read this:- http://playground.arduino.cc/Main/MPU-6050

Hello every body

i actually didnt understand the question

is there any one who can make me understood

i want some one to explain me about this subject

mfzavareh@hotmail.com

It is about the MPU-6050 accelerometer + gyro. I don't understand the question either, because the 100kHz I2C bus and the 2kHz sample rate are two different things.

Thanks, appreciate the help.