Search the Community
Showing results for tags 'DMP'.
-
Hi, I am new to this so please bear with me. My current project requires that i use multiple MPU6050's in order to track the motion of a person. I am aware that the MPU6050 has two addresses and that in the code supplied by jeff you can state which address on the I2C bus to read from. The problem is with the use of the DMP code and interrupts, am I able to attach the second IMU to the alternate interrupt pin on the Arduino Pro Mini that I am using? If i was to do this what would i have to do in the example code and/or the libraries in order to determine which interrupt is read etc. I have tried to interpret the libraries to see if there was a line of code that states which interrupt pin is being used but i quite frankly dont know what i am looking at or looking for. I hope that someone will be able to help me. Thanks
-
Hi, I know that there are some eamples showing how to put magnetometer data into DMP. For example this one: http://www.i2cdevlib.com/forums/topic/111-arduino-example-sketch-to-read-magnetometer-while-dmp-is-on/ but it does not make any sensor fusion. I couldn't find any library which would make magnetometer fusion inside DMP. Does such library exist? Maybe code in this file MPU6050_9Axis_MotionApps41.h make DMP+magnetometer fusion? I couldn't find any tips in the code and right now I am not able to test it. So the question is: does such library exist or the only way to do this is to make own fiters (for example complementary filter)? Maybe there is some MPU9150 library that can be used with MPU6050+magnetometer?
-
- magnetometer
- DMP
-
(and 2 more)
Tagged with:
-
Hi everybody, I've just arrived to this forum, and after looking for the answer with no results, I post this question if possible someone could answer me: Using the sketch provided by Jeff (Thanks for your contributions!! ) I noticed that axis direction z (yaw) and y (pitch) do not move according the datasheet axis scheme (pag 6), I mean, for instance, once I move the IMU in positive z, I get a negative vaue in yaw, and the same result in y axis. Could it be a matter of axis rotation regarding gravity substraction? Please, could please someone tell me something about it? Thanks!
-
Hello Forum User, First off, thank you for taking the time to read this. Second, I require some assistance in the rewriting of the InvenSence DMP lib for the TI microcontroller for use with the Arduino Uno and MPU6050. I have managed to remove most of the syntax errors that occured when switching from .c to .cpp, and removed the TI microcontroller specific code, but I am having problems with utilizing the Wire.h twi libraries for the I2C communication (specificly writing a function to call the twi libs when the i2c_write or i2c_read functions are called.) Ideally, it would use the included Wire.h library or the i2cdev library for the i2c communication. The main reason for this rewrite is to provide the ability of the users to call all of the listed functions of the DMP. In my case, this is primarally for the Pedometer functions which are not included in other libraries, but it can be used for the other functions as well. Below is a link to the dropbox file with the original library and the modified library. https://www.dropbox.com/s/4umn96yhh5hb9gu/eMPL_Rewrite.zip?dl=0 Thank you very much for your assistance in the matter. -Amatoxin-
-
- MPU6050
- Arduino Uno
-
(and 8 more)
Tagged with:
-
Hey everyone! I've got my MPU6050 hooked-up to my Arduino UNO and have the DMP sketch running just find and dandy, sometimes... At times, the code will hang at "Initializing I2C devices..."; at other times it runs as expected. I'm having a hard time recreating the error; I don't think it's a hardware thing (loose wires perhaps since I'm still breadboarding) because I've got it sitting on my desk and without touching it the error comes up & then goes away with a simple re-compile of the sketch. I've put some print statements in the initialize() function to see which sub-function might be causing the issue and I've narrowed it down to setClockSource() Has anyone else experienced this or is this just on my end? Thanks!
-
Hi all, I am a student and I am using Jeff's excellent library for my school project. I am using i2cdevlib with arduino and processing and have managed to read data from the sensor successfully using the teapot demo. The problem that I am facing is that the dmp needs some time for auto calibration, and hence the yaw drifts for about 15-20 seconds on every start up. However this does not affect me so much. My problem is that the sensor will be installed on a boat, and therefore, it will never be static due to waves, wind etc. This led to the dmp remain in auto calibration process and never stops yaw drifting. So my question is, is there a way to still use the mpu6050 with the i2cdevlib and the calibration period completes while the sensor is moving due to the waves movements? Or maybe can I eliminate this auto calibration process? Please help me since I am running out of time, and have no ideas how to solve this problem. Thanks in advance
- 1 reply
-
- auto calibration
- yaw drift
-
(and 2 more)
Tagged with:
-
The demo DMP sketch continually locks up after anywhere between 3-20 seconds into running. The demo code is unmodified in any way other than commenting out a few of the #define's to limit the output. I get no errors and no FIFO overflows, results appear on the serial monitor...but then the program just hangs. I have a clean setup here...nothing else attached to the Arduino. Suggestions??
-
Hello! I am kindly asking for help with my small question: I am writing some algorithm, which must work one time in one loop iteration. It takes him ~ 5-7 msec to proceed every loop(). I noticed, that my program hangs sometimes. Very rarely: ~ after 10 - 30 minutes of working. Than I went to DMP example, added delay(6) at the end of a loop.... And the same result: sometimes it hangs (after 10 - 30 minutes of working). I added Serial.println in the loop, where the program waits for interrupt, because it is the only one loop. Like this: while (!mpuInterrupt && fifoCount < packetSize) { Serial.println("Waiting..."); } And there is no "Waiting..." messages, when it hangs. Here is a full code of "my" MPU DMP example. It is the same as standart exampe, except two of three lines. I also added the loop period counting and printed it with YPR data. Also I tried it with two different MPU-6050... Sory for my English :-)
-
Hi, my name is Stephane, 44 yo, and I'm a software engineer. I'm working on Segway clone as a hobby.. I'm facing an issue when I make LCD updates via I2C when DMP is activated. The program run a few seconds then hangs. The same code run well in the MPU6050_RAW, that is why I'm concerned about the fact that the DMP is conflicting. I've tried with pullpups resistors, different LCD libraries, delays, without interuption etc .. and now I'm out of ideas. Here is the code, it's 99% the same as MPU6050_DMP6 + LCD parts in bold Any idea ? Thanks Stephane // 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_6Axis_MotionApps20.h" //#include "MPU6050.h" // not necessary if using MotionApps include file #include <LiquidCrystal_I2C.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 SparkFun breakout and InvenSense evaluation board) // AD0 high = 0x69 MPU6050 mpu(0x69); // <-- use for AD0 high LiquidCrystal_I2C lcd(0x27, 2, 1, 0, 4, 5, 6, 7, 3, POSITIVE); // Set the LCD I2C address #define OUTPUT_READABLE_YAWPITCHROLL long time10Hz = 0; long currentMillis; #define LED_PIN 13 // (Arduino is 13, Teensy is 11, Teensy++ is 6) bool blinkState = false; // MPU control/status vars bool dmpReady = false; // set true if DMP init was successful uint8_t mpuIntStatus; // holds actual interrupt status byte from MPU uint8_t devStatus; // return status after each device operation (0 = success, !0 = error) uint16_t packetSize; // expected DMP packet size (default is 42 bytes) uint16_t fifoCount; // count of all bytes currently in FIFO uint8_t fifoBuffer[64]; // FIFO storage buffer // orientation/motion vars Quaternion q; // [w, x, y, z] quaternion container VectorInt16 aa; // [x, y, z] accel sensor measurements VectorInt16 aaReal; // [x, y, z] gravity-free accel sensor measurements VectorInt16 aaWorld; // [x, y, z] world-frame accel sensor measurements VectorFloat gravity; // [x, y, z] gravity vector float euler[3]; // [psi, theta, phi] Euler angle container float ypr[3]; // [yaw, pitch, roll] yaw/pitch/roll container and gravity vector // ================================================================ // === INTERRUPT DETECTION ROUTINE === // ================================================================ volatile bool mpuInterrupt = false; // indicates whether MPU interrupt pin has gone high void dmpDataReady() { mpuInterrupt = true; } // ================================================================ // === INITIAL SETUP === // ================================================================ void setup() { // join I2C bus (I2Cdev library doesn't do this automatically) #if I2CDEV_IMPLEMENTATION == I2CDEV_ARDUINO_WIRE Wire.begin(); TWBR = 24; // 400kHz I2C clock (200kHz if CPU is 8MHz) #elif I2CDEV_IMPLEMENTATION == I2CDEV_BUILTIN_FASTWIRE Fastwire::setup(400, true); #endif // initialize serial communication // (115200 chosen because it is required for Teapot Demo output, but it's // really up to you depending on your project) Serial.begin(115200); while (!Serial); // wait for Leonardo enumeration, others continue immediately // NOTE: 8MHz or slower host processors, like the Teensy @ 3.3v or Ardunio // Pro Mini running at 3.3v, cannot handle this baud rate reliably due to // the baud timing being too misaligned with processor ticks. You must use // 38400 or slower in these cases, or use some kind of external separate // crystal solution for the UART timer. // initialize device Serial.println(F("Initializing I2C devices...")); mpu.initialize(); // verify connection Serial.println(F("Testing device connections...")); Serial.println(mpu.testConnection() ? F("MPU6050 connection successful") : F("MPU6050 connection failed")); // wait for ready Serial.println(F("\nSend any character to begin DMP programming and demo: ")); while (Serial.available() && Serial.read()); // empty buffer while (!Serial.available()); // wait for data while (Serial.available() && Serial.read()); // empty buffer again // load and configure the DMP Serial.println(F("Initializing DMP...")); devStatus = mpu.dmpInitialize(); // supply your own gyro offsets here, scaled for min sensitivity mpu.setXGyroOffset(220); mpu.setYGyroOffset(76); mpu.setZGyroOffset(-85); mpu.setZAccelOffset(1788); // 1688 factory default for my test chip // make sure it worked (returns 0 if so) if (devStatus == 0) { // turn on the DMP, now that it's ready Serial.println(F("Enabling DMP...")); mpu.setDMPEnabled(true); // enable Arduino interrupt detection Serial.println(F("Enabling interrupt detection (Arduino external interrupt 0)...")); attachInterrupt(0, dmpDataReady, RISING); mpuIntStatus = mpu.getIntStatus(); // set our DMP Ready flag so the main loop() function knows it's okay to use it Serial.println(F("DMP ready! Waiting for first interrupt...")); dmpReady = true; // get expected DMP packet size for later comparison packetSize = mpu.dmpGetFIFOPacketSize(); } else { // ERROR! // 1 = initial memory load failed // 2 = DMP configuration updates failed // (if it's going to break, usually the code will be 1) Serial.print(F("DMP Initialization failed (code ")); Serial.print(devStatus); Serial.println(F(")")); } lcd.begin(20, 4); // initialize the lcd lcd.backlight(); lcd.clear(); // configure LED for output pinMode(LED_PIN, OUTPUT); } // ================================================================ // === MAIN PROGRAM LOOP === // ================================================================ void loop() { // if programming failed, don't try to do anything if (!dmpReady) return; // wait for MPU interrupt or extra packet(s) available while (!mpuInterrupt && fifoCount < packetSize) { // other program behavior stuff here // . // . // . // if you are really paranoid you can frequently test in between other // stuff to see if mpuInterrupt is true, and if so, "break;" from the // while() loop to immediately process the MPU data // . // . // . } // reset interrupt flag and get INT_STATUS byte mpuInterrupt = false; mpuIntStatus = mpu.getIntStatus(); // get current FIFO count fifoCount = mpu.getFIFOCount(); // check for overflow (this should never happen unless our code is too inefficient) if ((mpuIntStatus & 0x10) || fifoCount == 1024) { // reset so we can continue cleanly mpu.resetFIFO(); Serial.println(F("FIFO overflow!")); // otherwise, check for DMP data ready interrupt (this should happen frequently) } else if (mpuIntStatus & 0x02) { // wait for correct available data length, should be a VERY short wait while (fifoCount < packetSize) { fifoCount = mpu.getFIFOCount(); } // read a packet from FIFO mpu.getFIFOBytes(fifoBuffer, packetSize); // track FIFO count here in case there is > 1 packet available // (this lets us immediately read more without waiting for an interrupt) fifoCount -= packetSize; #ifdef OUTPUT_READABLE_YAWPITCHROLL // display Euler angles in degrees mpu.dmpGetQuaternion(&q, fifoBuffer); mpu.dmpGetGravity(&gravity, &q); mpu.dmpGetYawPitchRoll(ypr, &q, &gravity); Serial.print("ypr\t"); Serial.print(ypr[0] * 180 / M_PI); Serial.print("\t"); Serial.print(ypr[1] * 180 / M_PI); Serial.print("\t"); Serial.println(ypr[2] * 180 / M_PI); #endif currentMillis = millis(); if (currentMillis - time10Hz >= 100) { loopAt10Hz(); time10Hz = currentMillis; } // blink LED to indicate activity blinkState = !blinkState; digitalWrite(LED_PIN, blinkState); } } void loopAt10Hz() { lcd.setCursor(0, 1); lcd.print(currentMillis); }
-
Hello, Thanks for the awesome work on the MPU60X0 series Mr.Jeff. I am having some trouble on using this : http://www.ebay.com/itm/NEW-MPU-6050-Module-3-Axis-Gyroscope-Accelerometer-Module-for-Arduino-MPU-6050-/170881535422 with an arduino uno. I wired up the sda, scl, vcc ,gnd and INT pins to arduino. The raw sketch in the examples works fine with relatively changing values with respect to the mpu, however when i try to run the DMP sketch from the examples (for ypr), I get random values ( all sorts from -ve to +ve extremes). Please help , what might be going wrong? Like this: ypr -87.13 44.97 1.53 ypr 1.48 -12.48 9.21 ypr -165.70 2.07 -43.67 FIFO overflow! ypr 161.94 -23.04 6.82 ypr -112.91 22.77 -66.79 ypr 63.09 67.35 20.87 ypr -0.02 0.03 -0.02 ypr 96.41 -65.82 -23.38 ypr -173.59 -11.67 55.13 ypr -179.77 -25.37 4.16 ypr 34.97 -52.92 21.85 ypr 176.46 24.11 -0.73 ypr -47.54 18.19 -69.33 ypr -40.63 8.71 -22.80 ypr 180.00 -0.25 0.13 ypr -42.68 -54.78 29.34 ypr -0.46 13.73 -10.30 ypr -165.67 2.11 -43.72 ypr 13.93 3.98 81.43 ypr -0.02 -0.03 3.53 ypr 33.11 -0.77 70.05 ypr -9.67 -21.45 -66.33 ypr 180.00 0.22 -19.05 ypr 84.95 29.47 49.47 ypr 162.55 -22.88 6.86 ypr -114.71 -21.13 68.85 ypr -43.29 -77.13 -5.42 ypr -0.02 0.03 -0.02 ypr 10.51 42.09 -34.33 ypr 20.90 2.08 64.16 ypr -179.78 -25.30 3.98 ypr -98.58 -6.70 -69.35 ypr 176.27 23.92 -0.76 ypr 43.45 86.87 -1.40
-
Hi, I'm using Arduino Uno, and GY-521 MPU6050, trying to run the example MPU6050_DMP6. I uncommented #define OUTPUT_READABLE_YAWPITCHROLL, commented the teapot define. and got data like this, really in a mess: Initializing DMP... Initializing I2C devices... Testing device connections... MPU6050 connection successful Send any character to begin DMP programming and demo: Initializing DMP... Enabling DMP... Enabling interrupt detection (Arduino external interrupt 0)... DMP ready! Waiting for first interrupt... ypr -11.65 -5.99 -0.20 ypr -117.95 -2.31 5.66 ypr 41.37 -71.00 6.51 ypr 180.00 0.00 -0.07 ypr -74.75 39.15 0.42 ypr 20.44 59.11 -29.95 ypr 179.98 -11.79 -0.56 ypr -80.68 -2.44 28.89 ypr 179.38 6.68 -3.68 ypr 66.52 52.38 36.50 ypr -37.36 -65.09 -20.80 ypr -180.00 -0.00 0.14 ypr -75.51 -47.65 15.82 ypr 1.41 1.11 -57.96 ypr -172.87 1.83 -43.98 ypr 106.46 -13.79 1.29 ypr -180.00 0.03 58.89 ypr 11.27 37.51 -51.48 ypr -30.22 39.54 34.30 ypr 180.00 0.01 5.10 ypr -1.55 -33.32 32.75 ypr -11.38 -6.58 -0.30 ypr -113.70 20.09 -58.35 ypr -5.59 -2.23 30.65 ypr 180.00 0.00 -0.07 ypr 50.86 57.03 19.18 ypr -6.88 59.55 13.49 ypr 179.98 -11.87 -0.52 ypr 36.61 25.55 5.77 ypr 179.35 7.47 -4.53 ypr 28.58 -28.44 -61.56 ypr 0.77 -23.04 62.77 PS: My chip works well with MPU6050_raw(can get stable data). Does anyone have any idea about this?why the data is so unstable?
-
I've seen a couple posts on here asking about incline. Like this one in which Jeff gives a knowing smile at the end when he says the math is beyond him: http://www.i2cdevlib.com/forums/topic/37-incline-of-the-sensor/ But then in this one says the DMP is awesome because it can do those calculations for us: http://www.i2cdevlib.com/forums/topic/29-how-to-calculate-yaw-roll-pitch-from-mpu6050/ So I'm confused as to whether or not we can already calculate pitch and roll minus any gravity affects based on the current MPU6050 library in the I2CDev package? I thought maybe OUTPUT_READABLE_YAWPITCHROLL would provide those values but they definitely seem affected by gravity when I move the sensor around. There's a note above that constant declaration that says "this also requires gravity vector calculations" but I didn't know if that meant "requires you to do them yourself" or just that a note that they are required and being performed behind the scenes. Help me Jeff, you're my only hope! Thanks for the awesome library by the way!