|13:02:29.350 -> a/g:|32767|10104|-32768|-7442|-68|27106|
|---|---|---|---|---|---|---|
|13:02:29.350 -> a/g:|32767|10028|-32768|-7489|-91|27067|
|13:02:29.400 -> a/g:|32767|9892|-32768|-7525|-100|27129|
|13:02:29.400 -> a/g:|32767|10000|-32768|-7668|-83|27172|
|13:02:29.400 -> a/g:|32767|9996|-32768|-7467|-71|27011|
|13:02:29.400 -> a/g:|32767|9856|-32768|-7498|-69|27054|
|13:02:29.400 -> a/g:|32767|10012|-32768|-7336|-105|27185|
|13:02:29.444 -> a/g:|32767|10064|-32768|-7659|-76|27054|
|13:02:29.444 -> a/g:|32767|9960|-32768|-7325|-82|27121|
|13:02:29.444 -> a/g:|32767|9904|-32768|-7152|-89|27127|
|13:02:29.444 -> a/g:|32767|9888|-32768|-7676|-99|27143|
|13:02:29.491 -> a/g:|32767|9988|-32768|-7582|-88|27130|
|13:02:29.491 -> a/g:|32767|9924|-32768|-7367|-100|27138|
|13:02:29.491 -> a/g:|32767|10092|-32768|-7458|-80|27112|
|13:02:29.491 -> a/g:|32767|10112|-32768|-7524|-75|27007|
|13:02:29.491 -> a/g:|32767|10016|-32768|-7683|-64|27123|
These are Accel-X, Accel-Y, Accel-Z and Gyro-X, Gyro-Y, Gyro-Z readings with that code:
/*
MPU6050 Raw
A code for obtaining raw data from the MPU6050 module with the option to
modify the data output format.
Find the full MPU6050 library documentation here:
https://github.com/ElectronicCats/mpu6050/wiki
*/
#include "I2Cdev.h"
#include "MPU6050.h"
/* MPU6050 default I2C address is 0x68*/
MPU6050 mpu;
//MPU6050 mpu(0x69); //Use for AD0 high
//MPU6050 mpu(0x68, &Wire1); //Use for AD0 low, but 2nd Wire (TWI/I2C) object.
/* OUTPUT FORMAT DEFINITION----------------------------------------------------------------------------------
- Use "OUTPUT_READABLE_ACCELGYRO" if you want to see a tab-separated list of the accel
X/Y/Z and gyro X/Y/Z values in decimal. Easy to read, but not so easy to parse, and slower over UART.
- Use "OUTPUT_BINARY_ACCELGYRO" to send all 6 axes of data as 16-bit binary, one right after the other.
As fast as possible without compression or data loss, easy to parse, but impossible to read for a human.
This output format is used as an output.
--------------------------------------------------------------------------------------------------------------*/
#define OUTPUT_READABLE_ACCELGYRO
//#define OUTPUT_BINARY_ACCELGYRO
int16_t ax, ay, az;
int16_t gx, gy, gz;
bool blinkState;
void setup() {
/*--Start I2C interface--*/
#if I2CDEV_IMPLEMENTATION == I2CDEV_ARDUINO_WIRE
Wire.begin();
#elif I2CDEV_IMPLEMENTATION == I2CDEV_BUILTIN_FASTWIRE
Fastwire::setup(400, true);
#endif
Serial.begin(38400); //Initializate Serial wo work well at 8MHz/16MHz
/*Initialize device and check connection*/
Serial.println("Initializing MPU...");
mpu.initialize();
Serial.println("Testing MPU6050 connection...");
if(mpu.testConnection() == false){
Serial.println("MPU6050 connection failed");
while(true);
}
else{
Serial.println("MPU6050 connection successful");
}
/* Use the code below to change accel/gyro offset values. Use MPU6050_Zero to obtain the recommended offsets */
Serial.println("Updating internal sensor offsets...\n");
mpu.setXAccelOffset(0); //Set your accelerometer offset for axis X
mpu.setYAccelOffset(0); //Set your accelerometer offset for axis Y
mpu.setZAccelOffset(0); //Set your accelerometer offset for axis Z
mpu.setXGyroOffset(0); //Set your gyro offset for axis X
mpu.setYGyroOffset(0); //Set your gyro offset for axis Y
mpu.setZGyroOffset(0); //Set your gyro offset for axis Z
/*Print the defined offsets*/
Serial.print("\t");
Serial.print(mpu.getXAccelOffset());
Serial.print("\t");
Serial.print(mpu.getYAccelOffset());
Serial.print("\t");
Serial.print(mpu.getZAccelOffset());
Serial.print("\t");
Serial.print(mpu.getXGyroOffset());
Serial.print("\t");
Serial.print(mpu.getYGyroOffset());
Serial.print("\t");
Serial.print(mpu.getZGyroOffset());
Serial.print("\n");
/*Configure board LED pin for output*/
pinMode(LED_BUILTIN, OUTPUT);
}
void loop() {
/* Read raw accel/gyro data from the module. Other methods commented*/
mpu.getMotion6(&ax, &ay, &az, &gx, &gy, &gz);
//mpu.getAcceleration(&ax, &ay, &az);
//mpu.getRotation(&gx, &gy, &gz);
/*Print the obtained data on the defined format*/
#ifdef OUTPUT_READABLE_ACCELGYRO
Serial.print("a/g:\t");
Serial.print(ax); Serial.print("\t");
Serial.print(ay); Serial.print("\t");
Serial.print(az); Serial.print("\t");
Serial.print(gx); Serial.print("\t");
Serial.print(gy); Serial.print("\t");
Serial.println(gz);
#endif
#ifdef OUTPUT_BINARY_ACCELGYRO
Serial.write((uint8_t)(ax >> 8)); Serial.write((uint8_t)(ax & 0xFF));
Serial.write((uint8_t)(ay >> 8)); Serial.write((uint8_t)(ay & 0xFF));
Serial.write((uint8_t)(az >> 8)); Serial.write((uint8_t)(az & 0xFF));
Serial.write((uint8_t)(gx >> 8)); Serial.write((uint8_t)(gx & 0xFF));
Serial.write((uint8_t)(gy >> 8)); Serial.write((uint8_t)(gy & 0xFF));
Serial.write((uint8_t)(gz >> 8)); Serial.write((uint8_t)(gz & 0xFF));
#endif
/*Blink LED to indicate activity*/
blinkState = !blinkState;
digitalWrite(LED_BUILTIN, blinkState);
}
Sensor was on flat table and never moved while taking those measurements. While i was trying to move on every axis respectively, X and Y acceleration datas never changed. Could it be damaged?
In fact at some point i had been succesfully converting those datas to angles with complementary filter but after 1-2 days suddenly it left working correctly.