Jump to content
I2Cdevlib Forums

Understanding raw values of accelerometer and gyrometer


Recommended Posts

Respected Sir,
                   I got some data from accelerometer and gyrometer using MPU 6050 with arduino. But  i am not able to interpret numerical values of it. Can you help me to figure out this information?
here i am sending you some of data:

    Accelarometer            Gyrometer
Ax             Ay              Az      Gx   Gy   Gz
-6616    13880    -1380    915    -68    -49
-6624    13924    -1496    909    -41    -136
-6680    13896    -1408    917    -46    -148
-6636    13996    -1508    913    -35    -111
-6668    13896    -1616    902    -47    -47
-6716    13944    -1496    916    -43    -40
-6616    13972    -1412    879    -57    -5
-6584    13884    -1536    918    -47    -25
-6920    14192    -1584    892    -10    -164
-7792    15016    -1524    1022 -80    -68
-6928    14244    -1484    773    -112     261
-6396    13764    -1416    939    -72    112
-6636    14020    -1596    892    -43    -154
-6520    13836    -1524    946     4    -242
-6776    13916    -1552    926     8    -333
-6916    14008    -1568    891    -64    -54
-6592    13936    -1460    866    -113    216
 

Thanks.

 

Link to comment
Share on other sites

Hi @vrutangs,

 

The accelerometer and gyroscope measurements are explained in the MPU-6050 datasheet in the GYRO_CONFIG and ACCEL_CONFIG register descriptions (sections 4.4 and 4.5 on pages 14 and 15). The scale of each depends on the sensitivity settings chosen, which can be one of +/- 2, 4, 8, or 16g for the accelerometer and one of +/- 250, 500, 1000, or 2000 deg/sec for the gyroscope. The accelerometer produces data in units of acceleration (distance over time2), and the gyroscope produces data in units of rotational velocity (rotation distance over time).

 

The output scale for any setting is [-32768, +32767] for each of the six axes. The default setting in the I2Cdevlib class is +/- 2g for the accel and +/- 250 deg/sec for the gyro. If the device is perfectly level and not moving, then:

  • X/Y accel axes should read 0
  • Z accel axis should read 1g, which is +16384 at a sensitivity of 2g
  • X/Y/Z gyro axes should read 0

In reality, the accel axes won't read exactly 0 since it is difficult to be perfectly level and there is some noise/error, and the gyros will also not read exactly 0 for the same reason (noise/error).

Link to comment
Share on other sites

  • 2 months later...

Hi Jeff , sorry to reopen this post...

I am a french student in an engeneering school and I am using the crius aiop v2 on my robot. On this board there is an MPU6050 and I am communicating with it thanks to your code. I tested a lot of codes like the one on arduino playground and the one of Kristian Lauszus with the Kalman filter.

However I am still having big issues with this sensor...

Correct me if I am wrong but when I am reading the raw data for the accelerometer I am supposed to get for x, y and z : 0 , 0 and 0.98 right ?
However when I am just reading the right registers (my sensor is put still on my desk) I am getting those values instead :
  accX          accY          accZ
8324.00    4768.00   14496.00      
8208.00    4768.00   14536.00      
8216.00    4704.00   14296.00      
8288.00    4684.00   14608.00      
8356.00    4724.00   14464.00      
8372.00   4784.00   14588.00      
8280.00   4736.00   14408.00      
8332.00   4748.00   14356.00

Since I am using your code, the sensor is set on a scale range of +/-2g which means that the sensitivity of the accelerometer is of 16384 LSB/g. I know that to understand the raw datas I need to divide them with the sensitivity and get something near 0, 0, 0.98 even if there is an error.
However with the values I am having it is no where near from what it should be...
I tried the code from arduino playground and I am having the same raw datas, the same thing with the Kalman filter... There are a lot of guides but I must be missing something... I am just reading the right registers but those raw datas doesn't make any sense at all...

So I would like to know if you think those datas are strange and if you happened to find something similar, I happened to find some talk on the internet which says that there is a version of the MPU6050 that doesn't have the same scale ranges and not the same sensitvities... I don't think I have that much of bad luck...

Thank you for your help,
Ben.

Link to comment
Share on other sites

  • 2 weeks later...

Hi Ben,

 

The numbers you are seeing appear to be all multiples of 4. This is extremely unlikely in a real-world situation, and makes me think that the way you are reading registers and/or converting data for storage in your variables has a problem with (1) register read orders, (2) byte orders, or (3) bit orders. Or, possibly, you are shifting values somehow after reading them.

 

The various ACCEL_*OUT_H/L registers each contain 8 bits of the 16-bit raw sensor value. The _H register is the high byte (MSB), and the _L register is the low byte (LSB). If you read them independently and combine them, then you should store them into a signed 16-bit integer container something like this:

int16_t accel_x = (ACCEL_XOUT_H << 8) + ACCEL_XOUT_L;

Is this what you are doing, or something very close anyway?

Link to comment
Share on other sites

  • 1 month later...

Sorry that I too am opening this thread up again.

 

What exactly does the X, Y and Z components of the accelerometer represent? Am I correct in thinking that if any one of the axes are pointing directly upwards away from the earth it (without noise) it should be displaying 1g (16384 at 2g setting). If any of the axes are pointing straight down it should be reading -1g (-16384). all axis reading zero when they are pointing directly horizontal.

 

Then a value for the X-axis is its projection onto the vertical 1g reference?

 

If I am right, what would be the best way to manipulate the data to accurately measure angles at points in time. 

Link to comment
Share on other sites

Sir, I used the MPU 6050 program from Github...its strange that all my a/g values shows zero ....dont know whether its a communication program or problem with my library please  help me out as i am new to this.

 

 

the program i used is:
 
#include "Wire.h"
#include "DebugUtils.h"
 
// I2Cdev and MPU6050 must be installed as libraries, or else the .cpp/.h files
// for both classes must be in the include path of your project
#include "I2Cdev.h"
#include "MPU60X0.h"
#include <SPI.h>
 
 
// class default I2C address is 0x68
// specific I2C addresses may be passed as a parameter here
// AD0 low = 0x68 (default for InvenSense evaluation board)
// AD0 high = 0x69
MPU60X0 accelgyro;
 
int16_t ax, ay, az;
int16_t gx, gy, gz;
 
#define LED_PIN 13
bool blinkState = false;
 
 
void setup() 
{
    // join I2C bus (I2Cdev library doesn't do this automatically)
    Wire.begin();
 
    // initialize serial communication
    // (38400 chosen because it works as well at 8MHz as it does at 16MHz, but
    // it's really up to you depending on your project)
    Serial.begin(38400);
 
    // initialize device
    Serial.println("Initializing I2C devices...");
    accelgyro.initialize();
 
    // verify connection
    Serial.println("Testing device connections...");
    Serial.println(accelgyro.testConnection() ? "MPU6050 connection successful" : "MPU6050 connection failed");
 
    // configure Arduino LED for
    pinMode(LED_PIN, OUTPUT);
}
 
void loop() {
    // read raw accel/gyro measurements from device
    accelgyro.getMotion6(&ax, &ay, &az, &gx, &gy, &gz);
 
    // these methods (and a few others) are also available
    //accelgyro.getAcceleration(&ax, &ay, &az);
    //accelgyro.getRotation(&gx, &gy, &gz);
 
    // display tab-separated accel/gyro x/y/z values
    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);
 
    // blink LED to indicate activity
    blinkState = !blinkState;
    digitalWrite(LED_PIN, blinkState);
}
Link to comment
Share on other sites

  • 2 weeks later...

hola jeff!

que pena incluirme en este tema con preguntas en vez de soluciones, soy estudiante de ingeniería electromecánica, soy colombiano, de ahí el porque mi escritura.

estoy trabajando con el mpu 6050 y quisiera preguntarte si es posible controlarlo por medio de una FPGA, exactamente una Spartan 3e, he investigado en la web pero siempre me encuentro con que el sensor se controla por arduino o por micro controladores.

 

disculpa la molestia, espero me puedan colaborar, muchas gracias

Link to comment
Share on other sites

hi jeff!

Shame Include me in this topic with questions rather than answers, electromechanical engineering student I am, I am Colombian, from there the reason for my writing.

AM Working with the MPU 6050 and I want to ask if possible control by an FPGA, a Spartan 3e exactly, I researched on the web but I always find that when using this sensor with arduino, or through microcontrollers, I have able to find information (FPGA + MPU6050)

 

Sorry for the inconvenience, I hope I can collaborate,

thank you very much.
Link to comment
Share on other sites

  • 6 months later...

Hi guys, i have some issues with mpu6050 understanding the raw values. My gyro is set at 250dps and  accelerometer at 2g.

 

For example the unsigned interger value 16bit gyro x axis divided by 131LSBs  if i display on a lcd it flickers between 0 and 500, gues there is +/- 1dps noise.

 

My main concern is how to obtain angle from these raw values? I have the three xyz raw values, divided by the 131 scale factor used for 250dps according to the datasheet , and as far for now i understand that these give me the angular speed or velocity, but a static angle?

 

I never worked with gyros before thats why i ask.

 

Thanks

Link to comment
Share on other sites

  • 3 months later...

Hi guys, i have some issues with mpu6050 understanding the raw values. My gyro is set at 250dps and  accelerometer at 2g.

 

For example the unsigned interger value 16bit gyro x axis divided by 131LSBs  if i display on a lcd it flickers between 0 and 500, gues there is +/- 1dps noise.

 

My main concern is how to obtain angle from these raw values? I have the three xyz raw values, divided by the 131 scale factor used for 250dps according to the datasheet , and as far for now i understand that these give me the angular speed or velocity, but a static angle?

 

I never worked with gyros before thats why i ask.

 

Thanks

 

I am not sure I am correct or not but Integration of angular velocity should give you static angle right?

Link to comment
Share on other sites

  • 3 months later...
  • 3 weeks later...

Hi sir,

I am also using MPU6050 accelerometer and gyrometer with arduino UNO. I followed the wiring,

VCC to 5v of arduino

GND to GND of arduino

SDA pin to A4 pin of arduino

SCL pin to A5 pin of arduino

AD0 to GND of arduino

INT to Pin 2 of arduino

And I ran I2C scanner code which is given here :

But it is not detecting the address. Which is 0x68 default, given in the manual.
 
And when I dump other code to detect the X Y X axes of accelerometer and gyrometer, it is giving only -1 value.
Please help me out.
Link to comment
Share on other sites

  • 1 month later...

Vinesh Saini,

   You are commiting a BIG mistake! You CANNOT connect directly the MPU6050 to the Arduino. If you read the datasheet you will see that the highest Vcc is 3.46v!!!! (http://www.invensense.com/mems/gyro/documents/PS-MPU-6000A-00v3.4.pdf). So you will need a level shifter to connect  the MPU6050 to the arduino and 3.3V suplied by the arduino. Finally you should have a look on the Arduino website http://playground.arduino.cc/Main/MPU-6050.

Regards,

Link to comment
Share on other sites

  • 2 weeks later...

Hello..

I have the small query. 

The code for reading accelerometer and gyro data from MPU 6050 is written by Jeff is as follow:

 

// I2C device class (I2Cdev) demonstration Arduino sketch for MPU6050 class
// 10/7/2011 by Jeff Rowberg <jeff@rowberg.net>
// Updates should (hopefully) always be available at https://github.com/jrowberg/i2cdevlib
//
// Changelog:
//      2013-05-08 - added multiple output formats
//                 - added seamless Fastwire support
//      2011-10-07 - initial release
 
/* ============================================
I2Cdev device library code is placed under the MIT license
Copyright © 2011 Jeff Rowberg
 
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:
 
The above copyright notice and this permission notice shall be included in
all copies or substantial portions of the Software.
 
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
THE SOFTWARE.
===============================================
*/
 
// I2Cdev and MPU6050 must be installed as libraries, or else the .cpp/.h files
// for both classes must be in the include path of your project
#include "I2Cdev.h"
#include "MPU6050.h"
 
// Arduino Wire library is required if I2Cdev I2CDEV_ARDUINO_WIRE implementation
// is used in I2Cdev.h
#if I2CDEV_IMPLEMENTATION == I2CDEV_ARDUINO_WIRE
    #include "Wire.h"
#endif
 
// class default I2C address is 0x68
// specific I2C addresses may be passed as a parameter here
// AD0 low = 0x68 (default for InvenSense evaluation board)
// AD0 high = 0x69
MPU6050 accelgyro;
//MPU6050 accelgyro(0x69); // <-- use for AD0 high
 
int16_t ax, ay, az;
int16_t gx, gy, gz;
 
 
 
// uncomment "OUTPUT_READABLE_ACCELGYRO" if you want to see a tab-separated
// list of the accel X/Y/Z and then gyro X/Y/Z values in decimal. Easy to read,
// not so easy to parse, and slow(er) over UART.
#define OUTPUT_READABLE_ACCELGYRO
 
// uncomment "OUTPUT_BINARY_ACCELGYRO" to send all 6 axes of data as 16-bit
// binary, one right after the other. This is very fast (as fast as possible
// without compression or data loss), and easy to parse, but impossible to read
// for a human.
//#define OUTPUT_BINARY_ACCELGYRO
 
 
#define LED_PIN 13
bool blinkState = false;
 
void setup() {
    // join I2C bus (I2Cdev library doesn't do this automatically)
    #if I2CDEV_IMPLEMENTATION == I2CDEV_ARDUINO_WIRE
        Wire.begin();
    #elif I2CDEV_IMPLEMENTATION == I2CDEV_BUILTIN_FASTWIRE
        Fastwire::setup(400, true);
    #endif
 
    // initialize serial communication
    // (38400 chosen because it works as well at 8MHz as it does at 16MHz, but
    // it's really up to you depending on your project)
    Serial.begin(38400);
 
    // initialize device
    //Serial.println("Initializing I2C devices...");
    accelgyro.initialize();
 
    // verify connection
    //Serial.println("Testing device connections...");
   // Serial.println(accelgyro.testConnection() ? "MPU6050 connection successful" : "MPU6050 connection failed");
 
    // use the code below to change accel/gyro offset values
    /*
    Serial.println("Updating internal sensor offsets...");
    // -76 -2359 1688 0 0 0
    Serial.print(accelgyro.getXAccelOffset()); Serial.print("\t"); // -76
    Serial.print(accelgyro.getYAccelOffset()); Serial.print("\t"); // -2359
    Serial.print(accelgyro.getZAccelOffset()); Serial.print("\t"); // 1688
    Serial.print(accelgyro.getXGyroOffset()); Serial.print("\t"); // 0
    Serial.print(accelgyro.getYGyroOffset()); Serial.print("\t"); // 0
    Serial.print(accelgyro.getZGyroOffset()); Serial.print("\t"); // 0
    Serial.print("\n");
    accelgyro.setXGyroOffset(220);
    accelgyro.setYGyroOffset(76);
    accelgyro.setZGyroOffset(-85);
    Serial.print(accelgyro.getXAccelOffset()); Serial.print("\t"); // -76
    Serial.print(accelgyro.getYAccelOffset()); Serial.print("\t"); // -2359
    Serial.print(accelgyro.getZAccelOffset()); Serial.print("\t"); // 1688
    Serial.print(accelgyro.getXGyroOffset()); Serial.print("\t"); // 0
    Serial.print(accelgyro.getYGyroOffset()); Serial.print("\t"); // 0
    Serial.print(accelgyro.getZGyroOffset()); Serial.print("\t"); // 0
    Serial.print("\n");
    */
 
    // configure Arduino LED for
    pinMode(LED_PIN, OUTPUT);
}
 
void loop() {
    // read raw accel/gyro measurements from device
    accelgyro.getMotion6(&ax, &ay, &az, &gx, &gy, &gz);
 
    // these methods (and a few others) are also available
    //accelgyro.getAcceleration(&ax, &ay, &az);
    //accelgyro.getRotation(&gx, &gy, &gz);
 
    #ifdef OUTPUT_READABLE_ACCELGYRO
        // display tab-separated accel/gyro x/y/z values
       // Serial.print("a/g:\t");
        int start=millis();Serial.print(start);Serial.print("\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_PIN, blinkState);
}
 
I just delete the thing which i don't know and made a small code as follow:
 
 
#include "I2Cdev.h"
#include "MPU6050.h"
#include "Wire.h"
MPU6050 accelgyro;
int16_t ax, ay, az;
int16_t gx, gy, gz;
#define OUTPUT_READABLE_ACCELGYRO
#define LED_PIN 13
bool blinkState = false;
 
void setup() {
  
        Wire.begin();
    Serial.begin(38400);
    accelgyro.initialize();
    pinMode(LED_PIN, OUTPUT);
}
 
void loop() {
 
    accelgyro.getMotion6(&ax, &ay, &az, &gx, &gy, &gz);
          int start=millis();Serial.print(start);Serial.print("\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);
 
    blinkState = !blinkState;
    digitalWrite(LED_PIN, blinkState);
}
 
 
 
 
Now i am not sure about the importance of the if and elseif statement (for an example) :
 
#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
 
 
Can anyone help me to understand the importance of the if and elseif condition that has been used in the Jeff's code?
Thanks.
Link to comment
Share on other sites

  • 1 month later...

Hello friends,

I am trying to make a self balancing robot, so I found some tutorials regarding Complementary filters. In that tutorial there is a equation for take acceleration and gyro value, these are the equation,

 

x_acc = (x_acc_ADC - x_acc_offset) * x_acc_scale;

 

gyro = (gyro_ADC - gyro_offset) * gyro_scale;

 

form that I obtained following values,

 

ax= 0            gy= -159        x_acc= 148.00        gyro= 11000.00
ax= -116       gy= -184        x_acc= -84.00         gyro= -1500.00
ax= -40         gy= -175        x_acc= 68.00         gyro= 3000.00
ax= -48         gy= -177        x_acc= 52.00         gyro= 2000.00
ax= 4            gy= -183        x_acc= 156.00        gyro= -1000.00
ax= -60         gy= -190        x_acc= 28.00         gyro= -4500.00
ax= -84         gy= -192        x_acc= -20.00        gyro= -5500.00
ax= -92         gy= -184        x_acc= -36.00        gyro= -1500.00
ax= -88         gy= -164        x_acc= -28.00        gyro= 8500.00

 

 

Here is my code,

#include <Wire.h>
#include <I2Cdev.h>
#include <MPU6050.h>

MPU6050 mpu;

int16_t ax, ay, az;
int16_t gx, gy, gz;
float x_acc, gyro;

void setup() {
  // put your setup code here, to run once:
Serial.begin(1200);
Serial.println("Initialize MPU");
mpu.initialize();
}

void loop(){
mpu.getMotion6(&ax, &ay, &az, &gx, &gy, &gz);
  Serial.print("ax= "); 
  Serial.print(ax); 
  Serial.print("\t\t");
  Serial.print("gy= "); 
  Serial.print(gy); 
  Serial.print("\t\t");
  
  x_acc= (ax - (-74))*(2);
  Serial.print("x_acc= "); Serial.print(x_acc);
  Serial.print("\t\t");
  
  gyro= (gy - (-181))*(500);
  Serial.print("gyro= "); 
  Serial.print(gyro);
  Serial.print("\n");
}

Please let me know whether that values are correct or not, if it is not please help me to correct it..

 

Thank you!

 

Link to comment
Share on other sites

  • 5 months later...
  • 2 months later...

Danviero Yuzwan,

 

you can change the AFS_SEL and FS_SEL by using: 

 mpu.setFullScaleGyroRange(0); //0 = +/- 250 degrees/sec | 1 = +/- 500 degrees/sec | 2 = +/- 1000 degrees/sec | 3 =  +/- 2000 degrees/sec
  mpu.setFullScaleAccelRange(0);  //0 = +/- 2g | 1 = +/- 4g | 2 = +/- 8g | 3 =  +/- 16g 

mpu is the name of the sensor in my code.

 

greetings Willem 

Link to comment
Share on other sites

  • 3 months later...

HI Jeff...

I'm Mochammad Habib Bachtiar as student of trunojoyo university in Indonesia. 
In this semester I have project about motion capture use a MPU6050 & Arduino Uno. but my focus is gyroscope with horizontal motion at upper arm, lower arm, and hand. so each segmen one sensor. 

I want ask you about that. how to modified some source code at arduino until this raw value become to angular rate.
Please explain source code base from x, y & z axis.... 

Thank's Jeff ....

Link to comment
Share on other sites

  • 3 weeks later...

Hello,

I have a waveshare 10 DOF MPU which uses MPU9255 chip, I know this topic is for MPU6050.

InvenSense told me that MPU9255 is completely the same as MPU6050 in gyroscope and acceleration measurements, so I come here for asking help.

 

After following calibration steps that people frequently remind, my MPU9255's Gyro X always output value 65xxx.

Is this output correct ? Or where am I wrong and how to fix ?

(especially on Gyro X output)

Thank you.

 

Below is my program's output:

 

    Rxx is the output value from registers, ex: RGX, RAY
    (AX, AY, AZ) = (RAX, RAY, RAZ) / 16384
    (GX, GY, GZ) = (RGX, RGY, RGZ) / 131.0
 
Output ==============================================
Temperature: 29.60 C
Pressure   : 1003.65 hPa
Altitude   : 00.17 m
CPU Temperature   :  53.7
CPU Core Voltage  :  1.2625
Who Am I=115
getAccelCfgFsSel=0, sensitivity=16384
getGyroCfgFsSel=0, sensitivity=131.0
 
   RGX   RGY   RGZ ,     GX      GY      GZ  |   RAX   RAY   RAZ ,   AX    AY    AZ 
 65469   105     6 , 499.763   0.802   0.046 |   616  1296 17688 , 0.038 0.079 1.080
 65497    99    41 , 499.977   0.756   0.313 |   632  1304 17620 , 0.039 0.080 1.075
 65481   102    62 , 499.855   0.779   0.473 |   652  1356 17464 , 0.040 0.083 1.066
 65512    73    30 , 500.092   0.557   0.229 |   604  1328 17560 , 0.037 0.081 1.072
 65521    87    32 , 500.160   0.664   0.244 |   588  1236 17636 , 0.036 0.075 1.076
 65471   101    52 , 499.779   0.771   0.397 |   596  1308 17576 , 0.036 0.080 1.073
 65516    89    59 , 500.122   0.679   0.450 |   564  1212 17488 , 0.034 0.074 1.067
 65479    91    74 , 499.840   0.695   0.565 |   616  1252 17524 , 0.038 0.076 1.070
 65533    85    64 , 500.252   0.649   0.489 |   600  1276 17528 , 0.037 0.078 1.070
 65479    52    67 , 499.840   0.397   0.511 |   664  1324 17480 , 0.041 0.081 1.075
Link to comment
Share on other sites

  • 8 months later...
  • 1 month later...
  • 2 months later...
On 12/28/2016 at 8:26 AM, Nithish said:

The output of gyro goes to a max of 32,768. If its fine what is the sensitivity factor I must be using?

setFullScaleGyroRange is also set to 250 dps. Not even sure if the output should be in this range

And the Z axis gyro values are erratic. Could someone help me with that too! !!

Untitled.jpg

Looks like your Z axis is in SelfTest mode, Check that bit5 in registers 0x1B and 0x1C is set to '0'

Link to comment
Share on other sites

  • 3 months later...

Hi everyone

I have a question: I am trying to detect position from the accelerometer and gyroscope in a golf swing.

It looks like my system maxes out at 16384 for acceleration at 1g, is there any way I can expand this range as the golf club is quicker than this?

 

Link to comment
Share on other sites

Hi again,

I have another more complicated question on accel and gyro: is there a set of transformation equations available that can translate accel and gyro to position.

I see it is quite complicated as it is not only a matter of translating acceleration to velocity to position but also we need to take into account the direction the device is pointed (accel is in the direction the device is pointed). I am tracking the position of a golfers hands through the golf swing so there is rotation as well as spatial movement of the hands.

 

I am sure someone smarter than me has already figured this out....

Link to comment
Share on other sites

  • 1 month later...

Hi everyone

This is my first attempt to sensor programming, so please describe everything from basics on thanks.

I want to use the the given methods of I2c. 

As an example the getAccelXSelfTest(). To use it I tried this (here simplificated) code:

 

import smbus

bus = smbus.SMBus(1)

address  = 0x68

print(bus.getAccelXSelfTest())

 

What is wrong with it. How do I have to call These methods?

Thanks a lot for your answers.

 

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Loading...
×
×
  • Create New...