Jump to content
I2Cdevlib Forums

vrutangs

Members
  • Posts

    5
  • Joined

  • Last visited

  • Days Won

    20

vrutangs last won the day on November 5 2017

vrutangs had the most liked content!

Recent Profile Visitors

1,270 profile views

vrutangs's Achievements

Newbie

Newbie (1/14)

11

Reputation

  1. Hi.. The default is seeting for accelero is +/-2G and for gyro is +/-250deg/sec. So what are the changes one should make in mpu6050.cpp and mpu6050.h to change default setting? thanks in advanced.
  2. HI.. I am using MPU 6050 for accelero and gyro data. The default setting in the I2Cdevlib class is +/- 2g for the accel and +/- 250 deg/sec for the gyro. So that means i can detect maximum of 250 deg/s and it will saturate at 250 (in the plot) if my angular velocity is more than 250 deg/s. So how can we change to the +/- 2000 deg/s? Also, is it possible to change only gyro scale and retaining the accelerometer range which is +/- 2g (inbuilt)? Any help is highly appreciated. thanks.
  3. Hi... I am using I2C library for MPU 6050 to get data of accelerometer and gyros. And i think I2C library has an inbuilt +/- 250 deg/sec for angular velocity. So that means i can detect maximum of 250 deg/s and it will saturate at 250 (in the plot) if my angular velocity is more than 250 deg/s. So how can we change to the +/- 2000 deg/s? Also, is it possible to change only gyro scale and retaining the accelerometer range which is +/- 2g (inbuilt)? Any help is highly appreciated. thanks.
  4. 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.
  5. 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.
×
×
  • Create New...