Jump to content
I2Cdevlib Forums

Search the Community

Showing results for tags 'arduino'.



More search options

  • Search By Tags

    Type tags separated by commas.
  • Search By Author

Content Type


Forums

  • I2Cdevlib Web Tools
    • I2C Protocol Analyzer
    • I2C Device Entry Interface
    • I2C Device Library API
  • I2Cdev Platform Discussion
    • Arduino (ATmega)
    • Arduino Due (ARM Cortex M3)
    • MSP430
    • Other Platforms
  • I2C Device Discussion
    • AD7746 capacitance-to-digital converter (Analog Devices)
    • ADS1115 16-bit A/D converter (Texas Instruments)
    • ADXL345 3-axis accelerometer (Analog Devices)
    • AK8975 3-axis magnetometer (AKM Semiconductor)
    • BMA150 3-axis accelerometer (Bosch Sensortec)
    • BMP085 pressure sensor (Bosch Sensortec)
    • DS1307 real-time clock (Maxim)
    • HMC5843 3-axis magnetometer (Honeywell)
    • HMC5883L 3-axis magnetometer (Honeywell)
    • iAQ-2000 indoor air quality sensor (AppliedSensor)
    • IQS156 ProxSense capacitive touch sensor (Azoteq)
    • ITG-3200 3-axis gyroscope (InvenSense)
    • L3G4200D 3-axis accelerometer (STMicroelectronics)
    • MPL3115A2 Xtrinsic Smart Pressure Sensor (Freescale)
    • MPR121 12-bit capacitive touch sensor (Freescale)
    • MPU-6050 6-axis accelerometer/gyroscope (InvenSense)
    • MPU-9150 9-axis accelerometer/gyroscope/magnetometer (InvenSense)
    • PanelPilot multi-screen digital meter (Lascar Electronics)
    • SSD1308 128x64 OLED/PLED driver (Solomon Systech)
    • TCA6424A 24-bit I/O expander (Texas Instruments)

Find results in...

Find results that contain...


Date Created

  • Start

    End


Last Updated

  • Start

    End


Filter by number of...

Joined

  • Start

    End


Group


AIM


MSN


Website URL


ICQ


Yahoo


Jabber


Skype


Location


Interests

Found 36 results

  1. Hi there, I am attempting to use an SSD1306 and a MPU6050 together. I am using the U8G2 and I2CDevlib libraries but the devices seem to be mixing each other up. The devices each work seperatly but not together and have different addresses. Does anyone know why this is happening?
  2. Hi there, I am trying to use this library with my MPU6050 and Arduino to count steps and it is working great but it is taking up too much flash. Is there anyway to reduce the amount flash this library takes up? Daniel
  3. Hello, I am attaching an Arduino example sketch to show how to read a magnetometer (HMC5883L) while MPU's DMP is active. This is only useful if you have your magnetometer attached to MPU's I2C internal aux lines, like many 10DOF boards do, and you want to use DMP. If you can, I believe it is always best to connect your magnetometer to your main I2C lines directly and you won't need this sketch. This sketch does NOT fuse DMP + magnetometer. You will have to do it by yourself in your host processor. I would only try to fuse magnetometer if it is going to be used outdoors, as electromagnetic interferences caused by electronics indoor make it quite difficult. Besides, the DMP's yaw measure is very good if you don't need much precision or long running times, in these cases you should fuse magnetometer + DMP. Please read sketch comments, as many things are explained there. Remember to put your MPU's address (0x68 or 0x69) and to set your interruption pin. Please give feedback, wheter it works or you have trouble with it. If people find it useful maybe Jeff can add it to the library once it is bugfree. Thank you MPU6050_DMP_mag.zip
  4. Hello, I have been trying to find a solution for this issue for a while now. Any info/suggestion/pointing in the right direction would be of great help. I am working on a project where I extract quaternions to deduce orientation using MPU6050 (DMP). I use the Arduino and libraries by Jeff Rowberg for calibration and reading from sensor. I have had a prototype working with MPU6050 mounted the standard way(gravity along Z) and it works fine. I then built a custom PCB with MPU6050 chip, which is then assembled to my project. The difference being, PCB is assembled such that the gravity is not along Z, it is along X. It doesn't work as I expected (like the initial prototype). When I turn on the device, I do some initial calculations to reference it (world to body coordinates conversion). This doesn't behave as I expect. My questions are, 1. Does the DMP or library assume that the gravity is always aligned along Z by default? 2. What steps should I follow to tell the DMP/Sensor that the gravity is aligned along X and not Z? I am not an electronics guy and haven't worked extensively with sensors. So, if what I ask is stupid, please forgive me. Please do share your thoughts. Many Thanks. Kind Regards, Kailash
  5. I am building a head tracker for FPV using the MPU-6050. I need to add a button so that a user can tap it to say essentially 'this is the new center'. I imagine this should be done using the set____Offset functions but for the life of me I can't figure it out. Are the set___Offset functions accepting raw acceleration/gyro values, gravity free accelerations, etc? Sorry if this is a duplicate question, I've tried searching the forums but I'm not even sure I'm using the correct terminology. Thanks!
  6. I am building a head tracker for FPV using the MPU-6050. I need to add a button so that a user can tap it to say essentially 'this is the new center'. I imagine this should be done using the set____Offset functions but for the life of me I can't figure it out. Are the set___Offset functions accepting raw acceleration/gyro values, gravity free accelerations, etc? Sorry if this is a duplicate question, I've tried searching the forums but I'm not even sure I'm using the correct terminology. Thanks!
  7. Chimpansai

    MPU 6050 only reads zeros

    Hi. I tryed to do my first experience with an MPU 6050 (breakoutboard) but i get only zeros as value. Google brought me here so now i know that the sensor is in sleep mode. But ive got no idea how to change that. I followed just an tutorial and used the libaries from Jeff Rowberg (really impressiv btw.) so im pretty sure the the Sketch and the wireing is noct an issue. Ive saw many videos wre it lokks pretty eays to work with this divise. So how can i bring my sensor to work? And maybe is there any explanation why may board seems different from others? Thanks for your help!
  8. I'm trying to calibrate my MPU6050, i tried to follow the guide here: http://www.i2cdevlib.com/forums/topic/91-how-to-decide-gyro-and-accelerometer-offsett/ But the values my sensor gives me were all around: a/g: 3980 1512 3892 -6 70 -9 a/g: 4056 1452 3884 28 51 -19 a/g: 4088 1304 3712 17 49 -14 a/g: 4068 1340 3820 7 66 14 a/g: 4044 1332 3628 40 104 -16 a/g: 4072 1336 3896 2 47 16 a/g: 4088 1332 3760 19 62 -14 a/g: 4004 1448 3728 16 48 -4 a/g: 3980 1444 3740 18 29 -1 a/g: 4112 1432 3828 7 56 14 a/g: 4092 1376 3736 8 55 -4 a/g: 3936 1528 3560 -26 122 -13 When i tried to add this values to my offset, the offset simple gets BIGGER. I tried than using the sketch calibration by Luis Ródenas (i put on pastebin here) It says at the end: Sensor readings with offsets: 7 -4 16382 0 0 0 Your offsets: -426 -165 1525 -3 -14 0 Data is printed as: acelX acelY acelZ giroX giroY giroZ Check that your sensor readings are close to 0 0 16384 0 0 0 If calibration was succesful write down your offsets so you can set them in your projects using something similar to mpu.setXAccelOffset(youroffset) When i add these values to my sensor it gets: a/g: -44 60 16252 -19 -6 -10 a/g: 68 12 16444 14 -14 6 a/g: -132 -44 16340 -3 4 -2 a/g: -68 80 16248 18 10 12 a/g: -28 108 16068 -18 -7 2 a/g: 16 -80 16368 -26 14 -15 a/g: 32 76 16324 -16 4 4 a/g: -8 60 16092 -5 2 7 a/g: 32 -40 16288 2 11 1 a/g: -16 44 16384 14 -14 -3 a/g: -92 32 16608 3 -18 -7 a/g: -80 -88 16384 20 1 -9 The wide range betwen positive and negative numbers here make me worries about my sensor has any problems. Yes it's wired corect. I'm using the raw values to get these values, no i cant use DMP because it uses interuption and my interuption port are being used by my encoders. So i'm being that stupid that can see the problems or theres something here?
  9. I have tried the below program to interface mpu6050 with esp8266-12e and arduino uno both show fifo overflow issue when additional program is used. And it's giving this issue only when I include some delay in program like 1sec delay removing that delay it will work fine with no problems (now I have added delay just for test purpose that is:I will actually be throwing the data in firebase which will have more than 5 seconds delay when throwing angular data that time also it's going to give me overflow which happened) how do I sort this issue? Here is my code: #include "I2Cdev.h" #include "MPU6050_6Axis_MotionApps20.h" //#include "MPU6050.h" // not necessary if using MotionApps include file // 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 MPU6050 mpu; #define OUTPUT_READABLE_EULER //#define OUTPUT_READABLE_YAWPITCHROLL //#define OUTPUT_READABLE_REALACCEL //#define OUTPUT_READABLE_WORLDACCEL //#define OUTPUT_TEAPOT #define INTERRUPT_PIN 2 // use pin 2 on Arduino Uno & most boards //#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 // packet structure for InvenSense teapot demo uint8_t teapotPacket[14] = { '$', 0x02, 0,0, 0,0, 0,0, 0,0, 0x00, 0x00, '\r', '\n' }; // ================================================================ // === INTERRUPT DETECTION ROUTINE === // ================================================================ volatile bool mpuInterrupt = true; // indicates whether MPU interrupt pin has gone high void dmpDataReady() { mpuInterrupt = true; } // ================================================================ // === INITIAL SETUP === // ================================================================ void setup() { Serial.begin(9600); // join I2C bus (I2Cdev library doesn't do this automatically) #if I2CDEV_IMPLEMENTATION == I2CDEV_ARDUINO_WIRE //Wire.begin(4,5); Wire.begin(); //Wire.setClock(400000); // 400kHz I2C clock. Comment this line if having compilation difficulties #elif I2CDEV_IMPLEMENTATION == I2CDEV_BUILTIN_FASTWIRE Fastwire::setup(400, true); #endif while (!Serial); // wait for Leonardo enumeration, others continue immediately Serial.println(F("Initializing I2C devices...")); mpu.initialize(); pinMode(INTERRUPT_PIN, INPUT); // 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(-4); mpu.setYGyroOffset(7); mpu.setZGyroOffset(65); mpu.setZAccelOffset(1318); // 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(digitalPinToInterrupt(INTERRUPT_PIN), dmpDataReady, RISING); //mpuInterrupt = true; 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(")")); } // configure LED for output // pinMode(LED_PIN, OUTPUT); } // ================================================================ // === MAIN PROGRAM LOOP === // ================================================================ void loop() { // if programming failed, don't try to do anything mpu_data(); delay(1000); } void mpu_data(void) { 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 // . // . // . //} fifoCount = mpu.getFIFOCount(); // check for overflow (this should never happen unless our code is too inefficient) if(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 { // 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); mpu.resetFIFO(); // track FIFO count here in case there is > 1 packet available // (this lets us immediately read more without waiting for an interrupt) fifoCount -= packetSize; Serial.println(fifoCount); if (fifoCount > 2) { ////// clear fifo buffer mpu.resetFIFO(); } #ifdef OUTPUT_READABLE_QUATERNION // display quaternion values in easy matrix form: w x y z mpu.dmpGetQuaternion(&q, fifoBuffer); Serial.print("quat\t"); Serial.print(q.w); Serial.print("\t"); Serial.print(q.x); Serial.print("\t"); Serial.print(q.y); Serial.print("\t"); Serial.println(q.z); #endif #ifdef OUTPUT_READABLE_EULER // display Euler angles in degrees mpu.dmpGetQuaternion(&q, fifoBuffer); mpu.dmpGetEuler(euler, &q); Serial.print("euler\t"); Serial.print(euler[0] * 180/M_PI); Serial.print("\t"); Serial.print(euler[1] * 180/M_PI); Serial.print("\t"); Serial.println(euler[2] * 180/M_PI); #endif #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 #ifdef OUTPUT_READABLE_REALACCEL // display real acceleration, adjusted to remove gravity mpu.dmpGetQuaternion(&q, fifoBuffer); mpu.dmpGetAccel(&aa, fifoBuffer); mpu.dmpGetGravity(&gravity, &q); mpu.dmpGetLinearAccel(&aaReal, &aa, &gravity); Serial.print("areal\t"); Serial.print(aaReal.x); Serial.print("\t"); Serial.print(aaReal.y); Serial.print("\t"); Serial.println(aaReal.z); #endif #ifdef OUTPUT_READABLE_WORLDACCEL // display initial world-frame acceleration, adjusted to remove gravity // and rotated based on known orientation from quaternion mpu.dmpGetQuaternion(&q, fifoBuffer); mpu.dmpGetAccel(&aa, fifoBuffer); mpu.dmpGetGravity(&gravity, &q); mpu.dmpGetLinearAccel(&aaReal, &aa, &gravity); mpu.dmpGetLinearAccelInWorld(&aaWorld, &aaReal, &q); Serial.print("aworld\t"); Serial.print(aaWorld.x); Serial.print("\t"); Serial.print(aaWorld.y); Serial.print("\t"); Serial.println(aaWorld.z); #endif #ifdef OUTPUT_TEAPOT // display quaternion values in InvenSense Teapot demo format: teapotPacket[2] = fifoBuffer[0]; teapotPacket[3] = fifoBuffer[1]; teapotPacket[4] = fifoBuffer[4]; teapotPacket[5] = fifoBuffer[5]; teapotPacket[6] = fifoBuffer[8]; teapotPacket[7] = fifoBuffer[9]; teapotPacket[8] = fifoBuffer[12]; teapotPacket[9] = fifoBuffer[13]; Serial.write(teapotPacket, 14); teapotPacket[11]++; // packetCount, loops at 0xFF on purpose #endif } } I saw this link :http://arduino.stackexchange.com/questions/10308/how-to-clear-fifo-buffer-on-mpu6050 and made changes but, no effect (note: I get proper data if I remove 1s delay in main void() loop if not it will give this fifo problem)
  10. I have tried the below program to interface mpu6050 with esp8266-12e and arduino uno both show fifo overflow issue when additional program is used. And it's giving this issue only when I include some delay in program like 1sec delay removing that delay it will work fine with no problems (now I have added delay just for test purpose that is:I will actually be throwing the data in firebase which will have more than 5 seconds delay when throwing angular data that time also it's going to give me overflow which happened) how do I sort this issue? Here is my code: #include "I2Cdev.h" #include "MPU6050_6Axis_MotionApps20.h" //#include "MPU6050.h" // not necessary if using MotionApps include file // 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 MPU6050 mpu; #define OUTPUT_READABLE_EULER //#define OUTPUT_READABLE_YAWPITCHROLL //#define OUTPUT_READABLE_REALACCEL //#define OUTPUT_READABLE_WORLDACCEL //#define OUTPUT_TEAPOT #define INTERRUPT_PIN 2 // use pin 2 on Arduino Uno & most boards //#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 // packet structure for InvenSense teapot demo uint8_t teapotPacket[14] = { '$', 0x02, 0,0, 0,0, 0,0, 0,0, 0x00, 0x00, '\r', '\n' }; // ================================================================ // === INTERRUPT DETECTION ROUTINE === // ================================================================ volatile bool mpuInterrupt = true; // indicates whether MPU interrupt pin has gone high void dmpDataReady() { mpuInterrupt = true; } // ================================================================ // === INITIAL SETUP === // ================================================================ void setup() { Serial.begin(9600); // join I2C bus (I2Cdev library doesn't do this automatically) #if I2CDEV_IMPLEMENTATION == I2CDEV_ARDUINO_WIRE //Wire.begin(4,5); Wire.begin(); //Wire.setClock(400000); // 400kHz I2C clock. Comment this line if having compilation difficulties #elif I2CDEV_IMPLEMENTATION == I2CDEV_BUILTIN_FASTWIRE Fastwire::setup(400, true); #endif while (!Serial); // wait for Leonardo enumeration, others continue immediately Serial.println(F("Initializing I2C devices...")); mpu.initialize(); pinMode(INTERRUPT_PIN, INPUT); // 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(-4); mpu.setYGyroOffset(7); mpu.setZGyroOffset(65); mpu.setZAccelOffset(1318); // 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(digitalPinToInterrupt(INTERRUPT_PIN), dmpDataReady, RISING); //mpuInterrupt = true; 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(")")); } // configure LED for output // pinMode(LED_PIN, OUTPUT); } // ================================================================ // === MAIN PROGRAM LOOP === // ================================================================ void loop() { // if programming failed, don't try to do anything mpu_data(); delay(1000); } void mpu_data(void) { 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 // . // . // . //} fifoCount = mpu.getFIFOCount(); // check for overflow (this should never happen unless our code is too inefficient) if(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 { // 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); mpu.resetFIFO(); // track FIFO count here in case there is > 1 packet available // (this lets us immediately read more without waiting for an interrupt) fifoCount -= packetSize; Serial.println(fifoCount); if (fifoCount > 2) { ////// clear fifo buffer mpu.resetFIFO(); } #ifdef OUTPUT_READABLE_QUATERNION // display quaternion values in easy matrix form: w x y z mpu.dmpGetQuaternion(&q, fifoBuffer); Serial.print("quat\t"); Serial.print(q.w); Serial.print("\t"); Serial.print(q.x); Serial.print("\t"); Serial.print(q.y); Serial.print("\t"); Serial.println(q.z); #endif #ifdef OUTPUT_READABLE_EULER // display Euler angles in degrees mpu.dmpGetQuaternion(&q, fifoBuffer); mpu.dmpGetEuler(euler, &q); Serial.print("euler\t"); Serial.print(euler[0] * 180/M_PI); Serial.print("\t"); Serial.print(euler[1] * 180/M_PI); Serial.print("\t"); Serial.println(euler[2] * 180/M_PI); #endif #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 #ifdef OUTPUT_READABLE_REALACCEL // display real acceleration, adjusted to remove gravity mpu.dmpGetQuaternion(&q, fifoBuffer); mpu.dmpGetAccel(&aa, fifoBuffer); mpu.dmpGetGravity(&gravity, &q); mpu.dmpGetLinearAccel(&aaReal, &aa, &gravity); Serial.print("areal\t"); Serial.print(aaReal.x); Serial.print("\t"); Serial.print(aaReal.y); Serial.print("\t"); Serial.println(aaReal.z); #endif #ifdef OUTPUT_READABLE_WORLDACCEL // display initial world-frame acceleration, adjusted to remove gravity // and rotated based on known orientation from quaternion mpu.dmpGetQuaternion(&q, fifoBuffer); mpu.dmpGetAccel(&aa, fifoBuffer); mpu.dmpGetGravity(&gravity, &q); mpu.dmpGetLinearAccel(&aaReal, &aa, &gravity); mpu.dmpGetLinearAccelInWorld(&aaWorld, &aaReal, &q); Serial.print("aworld\t"); Serial.print(aaWorld.x); Serial.print("\t"); Serial.print(aaWorld.y); Serial.print("\t"); Serial.println(aaWorld.z); #endif #ifdef OUTPUT_TEAPOT // display quaternion values in InvenSense Teapot demo format: teapotPacket[2] = fifoBuffer[0]; teapotPacket[3] = fifoBuffer[1]; teapotPacket[4] = fifoBuffer[4]; teapotPacket[5] = fifoBuffer[5]; teapotPacket[6] = fifoBuffer[8]; teapotPacket[7] = fifoBuffer[9]; teapotPacket[8] = fifoBuffer[12]; teapotPacket[9] = fifoBuffer[13]; Serial.write(teapotPacket, 14); teapotPacket[11]++; // packetCount, loops at 0xFF on purpose #endif } } I saw this link :http://arduino.stackexchange.com/questions/10308/how-to-clear-fifo-buffer-on-mpu6050 and made changes but, no effect (note: I get proper data if I remove 1s delay in main void() loop if not it will give this fifo problem)
  11. Hi everyone, I'm working on a project with an Arduino Teensy 3.2 and the MPU-6050. My method to sample the IMU is based on the "MPU6050_DMP6.ino" example in the library. I modified the program and made it into a function that returns three or four values (angles/accelerations or quaternion), instead of printing them to the serial port. Not much of a change. Anyway - the program works well for a minute or two (sometimes even five). It prints out the angles to the serial monitor and they all seem to make sense. But, after said minute or two (or five) - it all goes to... crap. Instead of "roll 29 pitch 0.1 yaw 1.4" (just an example) I'm suddenly seeing "roll -150 pitch nan yaw 300". Then the outputs go crazy and change values frantically for another minute or so - after which they seem to stop at a certain set of angles (roll -180, pitch 0, yaw -180). And by "stop", I mean they don't change even when I move the MPU around. EDIT: I just noticed that it goes back to normal after a long while. Like after ten minutes, the values would be normal again for one to two minutes. Then it goes mental once more. Does anyone have an idea what the problem might be? I thought it might be FIFO overflow but I don't see any messages in my log. Any help would be greatly appreciated, as always.
  12. Hello so im trying to use the code for the AD7746 chip, however it includes a file called I2Cdev.h that i don't know where to find it? could anyone help me find the file
  13. Hi all, I'm using MPU 9150 9-axis sensor with arduino mega board, i want to run a task in DMP itself in background continuously to reduce the power consumption,is it possible to run our code with DMP, if possible how can i achieve that,Please help me..Thanks in advance..
  14. My question is simple. Is it possible to use the DMP output without using the interruptions method? My goal is also simple. I'm trying to read 3D acceleration without gravity by taking advantage of the actual dedicated processor for that task. I took the example that comes with the Jeff's library and got it complied and executed just perfectly. The thing is I don't want the interruption system because half I don't completely understand the code, half I need to take samples at a fixed rate. I'm pretty sure the DMP is way faster than my sampling rate, and even though it isn't, skipping a couple of random samples is not an issue in my project. So it would be awesome if I could do just something like this (my imagination coming out now) void loop() { mpu.dmpGetQuaternion(&q, fifoBuffer); mpu.dmpGetAccel(&aa, fifoBuffer); mpu.dmpGetGravity(&gravity, &q); mpu.dmpGetLinearAccel(&aaReal, &aa, &gravity); Serial.print(aaReal.x); // awfully printed just to make my point Serial.print(aaReal.y); Serial.println(aaReal.z); delay(100); } to get acceleration without gravity using only a few functions. Note: I already did the corresponding calibration to get my offsets.
  15. Hello, I am new to this forum and have started experimenting with the MPU-6050 a few weeks ago. I am using it for a Design Technology project in hopes of measuring acceleration in any specific direction. After much research it was concluded this cheap, but useful chip was the go-to piece and so after more searching around on youtube I stumbled upon Jeff Rowberg's code. It took me a lot of time to get the processing teapot screen running but it was so worth it. Anyways now that I accomplished that, I moved on to the main task at hand and found out that by uncommented "OUTPUT_READABLE_REALACCEL" . This gave a significant amount of values and raw data in the serial monitor itself but the problem I have is that I do not understand the values or know how to convert them into acceleration that I can then use to perform other functions. I have only started coding last year and I am currently 16 in Year 11. If anyone could give some input or understandable references on the following values I would appreciate that a lot. 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... areal -293 49 -1190 areal -153 22 66 areal -50 10 868 areal 4 -14 1370 areal 23 -39 1676 areal 59 -54 1878 areal 86 -68 2013 areal 107 -77 2119 areal 119 -83 2175 areal 112 -89 2187 areal 99 -10 72182 areal 116 -118 2198 areal 144 -120 2222 So here is the following data I have received: Also many thanks to Jeff Rowberg for producing such valuable and useful code. I will make sure to include you in my project credits and when I master Arduino I will definitely try to share and teach this to others. Thank you
  16. Hello everyone! I am pretty inexperienced when it comes to computer programming, but I am using the program Jeff posted to use the yaw, pitch, and roll values (I really only need the yaw, though) in a feedback system for a UAV. I am using an Arduino Uno to run the gyroscope, and the program works fine by itself. My issue results from me putting the program on a timer so that it only reads the value every, say, 100 ms. Then FIFO overflow then gets triggered (which makes sense because the values are going in faster than they go out.) Is there any way to bypass this? I noticed one of the past iterations of the program read the values directly instead of from the FIFO buffer, but I didn't understand that version of the program, and I also don't think it had a "ypr" option. Is there an easy way to change the programming, or perhaps a better way to do it? Thanks for any help you can give!
  17. Hello everybody, First of all, thanks a lot for the Library, this saved me a lot of precious time! I'm here to ask for a little help : I'm using an Arduino Due (using arduino 1.5.5-r2 software) to read the data from my MPU6050, using the DMP. I read the angles using the same code as in the example code for the DMP and I tried a lot of different configurations, without any change. I noticed that reading the values takes my approximately 6ms. This is a little bit long for me, but the interesting thing is that the sketch spends 5ms of the 6 in the call of this function: // read a packet from FIFO mpu.getFIFOBytes(fifoBuffer, packetSize); I don't understand how this can be so long. This is just reading registers and the packetSize is only 42... So here are my questions. Is this normal with an MPU6050 or is there effectively something strange ? Does anybody have any idea why this is happening? When this function is called, the data should be ready, so why do I loose so much time ? I hope somebody will be able to help me with this, because otherwise I'll have to read the raw data and process them by myself. So thanks in advance for your answers!
  18. Hi, I tried MPU_DMP6.ino and it compiles without error for UNO (haven’t tested on real board), but I am using DUE board and the sketch won’t compile for the arduino due board. Could you please tell me why I am getting this error, will be helpful. MPU6050_DMP6.ino: In function 'void setup()': MPU6050_DMP6:165: error: 'TWBR' was not declared in this scope If I put it as a comment then it compiles without error. but still dont know if it will actually work or not. Thank you.
  19. Hello! I have installed Jeff Rowberg's i2cdevlib library which I can use for my MPU-6050 to make it interact with Arduino. However, I have an odd problem with one of its functions. It's got a function to turn the accelerometer & gyroscope readings into linear acceleration. This is the definition of the function: uint8_t MPU6050::dmpGetLinearAccel(VectorInt16 *v, VectorInt16 *vRaw, VectorFloat *gravity) { // get rid of the gravity component (+1g = +8192 in standard DMP FIFO packet, sensitivity is 2g) v -> x = vRaw -> x - gravity -> x*8192; v -> y = vRaw -> y - gravity -> y*8192; v -> z = vRaw -> z - gravity -> z*8192; return 0; } However, whenever the function is called in the example code: // display real acceleration, adjusted to remove gravity mpu.dmpGetQuaternion(&q, fifoBuffer); mpu.dmpGetAccel(&aa, fifoBuffer); mpu.dmpGetGravity(&gravity, &q); mpu.dmpGetLinearAccel(&aaReal, &aa, &gravity); Serial.print("areal\t"); Serial.print(aaReal.x); Serial.print("\t"); Serial.print(aaReal.y); Serial.print("\t"); Serial.println(aaReal.z); I get values way off, when I'm not even moving my MPU-6050! These are a few of the values I get: areal -473 423 -425 areal -460 400 -450 areal -471 522 -458 areal -322 276 -582 Do you know how I can fix this? Thanks! -George
  20. Hey all, I have an MPU-6050 connected to a simple board, with only SCL, SDA and voltage/GND outputs. Meaning, no INT pin to connect to my Arduino (I am using Teensy 3.2). Now I don't know a whole lot about these things, but going by the sketches I've seen so far (well, basically the one sketch by the almighty Jeff) - it is required to use the INT pin in order to access the DMP. Is that just the way the sketch is built, or am I screwed by this board not having the INT output? Because I would really love to get Euler angles or quaternions but I've only seen these calculations done reliably through the DMP. Any help would be appreciated.
  21. Hi, Can anyone tell me how can i get DMP processed angular velocity from MPU-6050 using I2Cdevlib libraries for Arduino?! Thanks in advance
  22. I am trying to connect two LIDAR-Lite 2 Laser Rangefinder (PulsedLight) to an Arduino together using I2C. I know the wiring is correct, the each work separately and used library from github so code should be okay. I am getting the error "NACK" would have any tips on trouble shooting this error. A couple other novices helped check the code but we are all new to I2C.
  23. Hello i post my mpu6050 in board and want to now when i tap in the board the distance between the zone of tap and the mpu ?
  24. Hello i post my mpu6050 in board and want to now when i tap in the board the distance between the zone of tap and the mpu ?
  25. Hello everyone! I don't know if this is the proper place to ask, so i apologies if it is not!. I am using the MPU6050 and when i read the values using the DMP (yaw, pitch and roll), i notice that when i move the MPU6050 in a "yawing" manner, the pitch changes briefly then changes back when i stop yawing. Has anyone experienced this? Any intuition on what is causing this? The Arduino board i am using is Intel Edison with Arduino Kit, Library is MPU6050 built on I2CDev. Note that the pitch and roll are pretty consistent, they do what they are supposed to do. The only issue is with the yaw changing the roll for some reason...
×