# How to calculate running speed using accelerometer sensor ?

Hi guys,

I am working with accelerometer sensor. I would like to turn speed value that you got. what should I do ? can you help me

Me code;

 #include<Wire.h>
int16_t AcX,AcY,AcZ,Tmp,GyX,GyY,GyZ;

void setup(){
Wire.begin();
Wire.write(0x6B);  // PWR_MGMT_1 register
Wire.write(0);     // set to zero (wakes up the MPU-6050)
Wire.endTransmission(true);
Serial.begin(57600);
}
void loop(){
Wire.write(0x3B);  // starting with register 0x3B (ACCEL_XOUT_H)
Wire.endTransmission(false);
Wire.requestFrom(MPU_addr,14,true);  // request a total of 14 registers
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);

Serial.print("HIZ:");Serial.println(sqrt( AcX^2 + AcY^2 + AcZ^2));

delay(333);
}


And me values Arduino com;

AcX = 0 | AcY = 0 | AcZ = 0 | Tmp = 36.53 | GyX = 0 | GyY = 0 | GyZ = 0
HIZ:1.41
AcX = 1112 | AcY = 15716 | AcZ = -3776 | Tmp = 26.27 | GyX = -624 | GyY = 2157 | GyZ = -1428
HIZ:nan
AcX = 976 | AcY = 15700 | AcZ = -4280 | Tmp = 26.46 | GyX = -493 | GyY = 266 | GyZ = -177
HIZ:nan
AcX = 900 | AcY = 15660 | AcZ = -4176 | Tmp = 26.46 | GyX = -522 | GyY = 287 | GyZ = -157
HIZ:nan

edit retag close merge delete