Jump to content
I2Cdevlib Forums

Search the Community

Showing results for tags 'mpu-6050'.

  • 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 19 results

  1. Hi I'm new to Arduino and I'm trying to use a 6DOF IMU (the MPU-6050) along with the i2cdevlib. I've been able to set the libraries and to execute a sketch in order to calculate the offset of the IMU starting from the raw data. Now I'm trying to execute the example code that i found on the github of the i2cdevlibhttps://github.com/jrowberg/i2cdevlib/blob/master/Arduino/MPU6050/Examples/MPU6050_DMP6/MPU6050_DMP6.ino setting the output in the YPR modeCode: #define OUTPUT_READABLE_YAWPITCHROLL with and without my offset parameters. In both sketches I found the same issue. The data on the serial shift from the initial position for 5-8 second showing an increment of several degrees (depends on the cases but usually there are 12-25 degrees) of the YPR angles without moving the IMU. The same thing happen with the Euler anglesCode: #define OUTPUT_READABLE_EULER I've tried also to execute the quaternion output modeCode: #define OUTPUT_READABLE_QUATERNION which i don't know how to read (I'm just started learning about this) but the value I read on the serial seems to stay "stable". I might solve this with a delay from the turn on which allow me to see of how much degrees the IMU "virtually moved" and then subtract that value to future reading (such as another offset) but i find this not usefull since I need the IMU to have the right angles on the turn on. Thanks for reading, hope someone could help me
  2. Hi there, I have tried the GY-521 sensor on Arduino by using the guide from (http://playground.arduino.cc/Main/MPU-6050). It worked well. Can anyone guide me on how can I add another GY-512 module please? How do I define the additional sensor modules in the program? I was planning to use a total of 4 of them connected to my Arduino Uno as required in my exoskeleton project. However based on my research, I have found out that the MPU-6050 chip has a limitation where I could only connect a miximum of 2 of the sensor modules. Please help to understand the I2C communication as well.
  3. Hello, I am beginning with the MPU-6050. To understand what are the data we get, I have read this topic : http://www.i2cdevlib.com/forums/topic/4-understanding-raw-values-of-accelerometer-and-gyrometer/. What I would like to do is know how tilted is the sensor in relation to the three axes. In french, we say that a "gyroscope" is used to get this, and a "gyromètre" do to get the angular velocity. Here, this sensor enables the user to read the angular velocity. Perhaps I should often read the angular velocity and try to determine the incline depending on the time... But it might be quite imprecise, mightn't it ? May you explain me how could I solve this problem ? Thank you in advance, Soaocohoa
  4. Hi guys, I'm using Jeff Rowberg's code with my MPU-6050, and I managed to get everything working fine except for some YAW drift. I'm aware of the temperature factors as well as the "big shake" causing this drift. That being said, i'm trying to manually reset the sensors (set them to zero) in order to eliminate this drift (let's say, when pressing a button, for simplicity sake). I'm not sure if I should disable the FIFO before resetting the sensor or if that doesn't matter. Not sure if I should reset the FIFO either (I'm using resetSensors) I've tried many combinations but it didn't seem to make a change (if I disable the FIFO, the value jumps to 3.14!?) Resetting the sensors ALWAYS seem to increase the YAW in small increments. So if YAW < 0 then it's "fine" because I can stop resetting when reaching zero. BUT if YAW > 0 it will sum up as well (until it reaches the maximum, jumps to negative and finally reach 0 again). My questions are: - Cannot I reset to zero immediately in one shot (instead of calling resetSensors on the loop until it reaches zero?) Because depending on how far it is from zero, it may take some considerable time to reach it. - If the first question's answer is "no": what can I do to make "resetSensors" sum up when the value is negative and substract when the value is positive? Thank you very much for your help, I really am spending a lot of time on this so I appreciate any feedback! Cheers, Synth
  5. 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.
  6. 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
  7. Hi I have Gyro device on board attached to stepper motor, doing 360deg spin and capture data (FIFO method). Below is the FIFO results. NB: The 1st row can be ignored since the Gyro is not continous capture mode. ==================================================================Setup FXAS21002 is same as MPU-6050, hence the setting is G_F_SETUP = 0b10100000 // 32 Count and Circular Mode G_INT_SRC_FLAG = 0b00000100 // Select SRC_FIFO as source interrupt G_CTRL_REG2, = 0b11000010 // Enable FIFO interrupt, mapped to INT1 - PTA5, push-pull, active low interrupt G_CTRL_REG1, = 0b00011100 // ODR = 12.5Hz, Standby mode G_CTRL_REG3, = 0b00001000 // WRAPTOONE=1 for FIFO method. G_CTRL_REG0 = 0b00000000 // LPF = 256Hz, HPF disabled, HPF cutoff frequency = N/A, Gain = ±2000 || 62.5 (mdps/LSB) Note the gain is Gain = ±2000 || 62.5 (mdps/LSB) and Sample Rate is 12.5Hz which mean it take 2.56 second for FIFO to be populated and trigger interrupts. Each element of FIFO data is 80mSec capture rate within the IC. ==================================================================Raw Data to Readout for (i=0; i<32; i++) { index = i*6; FXASFIFOData.FXAS_GRYODataRaw.X = ((INT16) I2CrxBuffer[index+0] << 8 | I2CrxBuffer[index+1]); // 1LSB = 0.0078125deg/Sec FXASFIFOData.FXAS_GRYODataRaw.Y = ((INT16) I2CrxBuffer[index+2] << 8 | I2CrxBuffer[index+3]); FXASFIFOData.FXAS_GRYODataRaw.Z = ((INT16) I2CrxBuffer[index+4] << 8 | I2CrxBuffer[index+5]); FXASFIFOData.FXAS_GRYOData.X = (((INT32)FXASFIFOData.FXAS_GRYODataRaw.X *1000) /128); //mDeg/Sec FXASFIFOData.FXAS_GRYOData.Y = (((INT32)FXASFIFOData.FXAS_GRYODataRaw.Y *1000) /128); FXASFIFOData.FXAS_GRYOData.Z = (((INT32)FXASFIFOData.FXAS_GRYODataRaw.Z *1000) /128); //-------------------------------------------------------Sum it up as part of integration. FXASData.iGryoData.X += FXASFIFOData.FXAS_GRYOData.X; FXASData.iGryoData.Y += FXASFIFOData.FXAS_GRYOData.Y; FXASData.iGryoData.Z += FXASFIFOData.FXAS_GRYOData.Z; } ==================================================================FIFO Data ---INFO: FXAS (Gryo) Invoking Capture Process ---INFO: Received FXAS: RIT PREV INT: 820078 || RIT AT INT: 840080 ---INFO: Interrupt Period = 20002 ---------------------------------------------------------------------- ---INFO: FIFO No: 0 | X: 531 | Y: 156 | Z: -453 ---INFO: FIFO No: 1 | X: -54 | Y: -304 | Z: -15 ---INFO: FIFO No: 2 | X: -62 | Y: -296 | Z: -7 ---INFO: FIFO No: 3 | X: -70 | Y: -304 | Z: -7 ---INFO: FIFO No: 4 | X: -85 | Y: -312 | Z: -15 ---INFO: FIFO No: 5 | X: -78 | Y: -304 | Z: -7 ---INFO: FIFO No: 6 | X: 14507 | Y: -304 | Z: 23 ---INFO: FIFO No: 7 | X: 84304 | Y: -335 | Z: 234 ---INFO: FIFO No: 8 | X: 93226 | Y: -304 | Z: 304 ---INFO: FIFO No: 9 | X: 93335 | Y: -359 | Z: 375 ---INFO: FIFO No: 10 | X: 93351 | Y: -492 | Z: 421 ---INFO: FIFO No: 11 | X: 93320 | Y: -484 | Z: 281 ---INFO: FIFO No: 12 | X: 88078 | Y: -390 | Z: 195 ---INFO: FIFO No: 13 | X: 20671 | Y: -437 | Z: 7 ---INFO: FIFO No: 14 | X: -39 | Y: -289 | Z: -15 ---INFO: FIFO No: 15 | X: -78 | Y: -289 | Z: -15 ---INFO: FIFO No: 16 | X: -78 | Y: -304 | Z: -15 ---INFO: FIFO No: 17 | X: -85 | Y: -296 | Z: -15 ---INFO: FIFO No: 18 | X: -93 | Y: -312 | Z: -7 ---INFO: FIFO No: 19 | X: -93 | Y: -304 | Z: -7 ---INFO: FIFO No: 20 | X: -85 | Y: -304 | Z: -7 ---INFO: FIFO No: 21 | X: -85 | Y: -289 | Z: -23 ---INFO: FIFO No: 22 | X: -85 | Y: -296 | Z: -23 ---INFO: FIFO No: 23 | X: -93 | Y: -296 | Z: -15 ---INFO: FIFO No: 24 | X: -78 | Y: -304 | Z: -15 ---INFO: FIFO No: 25 | X: -85 | Y: -304 | Z: -7 ---INFO: FIFO No: 26 | X: -101 | Y: -312 | Z: -15 ---INFO: FIFO No: 27 | X: -93 | Y: -304 | Z: -15 ---INFO: FIFO No: 28 | X: -101 | Y: -304 | Z: -15 ---INFO: FIFO No: 29 | X: -93 | Y: -304 | Z: 0 ---INFO: FIFO No: 30 | X: -93 | Y: -296 | Z: -7 ---INFO: FIFO No: 31 | X: -85 | Y: -296 | Z: -23 ---------------------------------------------------------------------- ---------------------------------------------------------------------- ---INFO: Offset Zero Parameter: X: 0 | Y: 0 | Z: 0 ---INFO: Integrated Results : X: 1097 | Y: 9872 | Z: 579431 ---INFO: Results is represented as mDeg/2.56Sec, Depending on RIT. ==================================================================Motor For 360 spin, I get 579431 readout (sum of 32 FIFO data). As for Motor: I have stepper Motor (full step), operating 2.5mSec/Step and 200 Step. This transulate to 2.5mSec/Step => 60 / (2.5mSec/Step * 200 Step) = 120 rpm or 2 rps. =================================================================Query I trying to figure out what the Gyro really mean in relationship to Motor spin? Should I expect 360deg result? Can anyone offer meaningful interpertation of the results here?
  8. 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
  9. Hi, everyone, I'm making a college project that consists in a quadcopter with Arduino. I'm trying to use MPU-6050 to balance it. I've already read about this sensor and done a complementary filter to combine the effects of the accelerometer and gyroscope. It worked nicely, and I'm using Processing to manage it. However, I still have no idea about how to use this combinated data to balance the quadcopter's motors. I've tried to do a simple test: if the quadcopter inclines at least 15 degrees to some side, motor(s) of the opposite side stops. This is a very bad solution, of course. Also, as the quadcopter vibrates, the MPU's accelerometer vibrates too, forcing the combinated data (angle of MPU) to be very different from the real angle. I found lot of stuff about making a filter, but couldn't find much stuff about balancing a quadcopter with MPU. So, I would appreciate every single help! Sorry about my English, this is not my natural language. Thanks!
  10. 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.
  11. Hi, Can anyone tell me how can i get DMP processed angular velocity from MPU-6050 using I2Cdevlib libraries for Arduino?! Thanks in advance
  12. Hi Jeff First I want to say thanks for all the libraries not just the MPU-6050, been using them with a several different standalone sensors and combo boards. They all work great. Now for the question. I am using the FreeIMU code written by Fabio and as I was going through several of the comments I came across his todo list which brought me to the your's and his discussion on temperature compensation for the ITG-3200 board. One of the things that I noticed is that when I first start it takes quite a while before I can get stable readings from the MPU-6050 and the cube programs not to go nuts. From what I can see from dumping the 6050 temp the readings don't really stabilize until about 22degC. It also appears that the temp affects the accel readings and the gyro readings (raw) to different degrees depending on the axis (gyro or accel). I have only looked at 19-23degC region and not tried to heat it up yet . I can attach the graphs if you are interested. Was wondering if you had any experience with this and point me in the right direction to correct it in the code, also based on the data is it worth it to put in the correction or just put a test in let it warm up first until a set limit. Thanks for any advice - Mike UPDATE: Reran the experiment using a 1 second delay with similar results which I am uploading as a PDF images along with the Temperature profile. Out of curiosity I also ran just ran the MPU from startup for about 1 hour which I am also attaching which I am also uploading for your reference. Temp Profile.pdf Accel-Temp22-25.pdf Gyro-Temp22-25.pdf Accel-Temp Default.pdf
  13. here is my code, i copied this code form , to run this code with mpu-6050 i need to change register set bit values, form datasheet of mpu6050 i changed the values , but still i did not get the right result. #include <Wire.h> //Include the Wire.h library so we can communicate with the gyro //Declaring variables int cal_int; unsigned long UL_timer; double gyro_pitch, gyro_roll, gyro_yaw; double gyro_roll_cal, gyro_pitch_cal, gyro_yaw_cal; byte highByte, lowByte; //Setup routine void setup(){ Wire.begin(); //Start the I2C as master Serial.begin(9600); //Start the serial connetion @ 9600bps //The gyro is disabled by default and needs to be started Wire.beginTransmission(105); //Start communication with the gyro (adress 1101001) Wire.write(0x20); //We want to write to register 20 Wire.write(0x0F); //Set the register bits as 00001111 (Turn on the gyro and enable all axis) Wire.endTransmission(); //End the transmission with the gyro Wire.beginTransmission(105); //Start communication with the gyro (adress 1101001) Wire.write(0x23); //We want to write to register 23 Wire.write(0x80); //Set the register bits as 10000000 (Block Data Update active) Wire.endTransmission(); //End the transmission with the gyro delay(250); //Give the gyro time to start //Let's take multiple samples so we can determine the average gyro offset Serial.print("Starting calibration..."); //Print message for (cal_int = 0; cal_int < 2000 ; cal_int ++){ //Take 2000 readings for calibration gyro_signalen(); //Read the gyro output gyro_roll_cal += gyro_roll; //Ad roll value to gyro_roll_cal gyro_pitch_cal += gyro_pitch; //Ad pitch value to gyro_pitch_cal gyro_yaw_cal += gyro_yaw; //Ad yaw value to gyro_yaw_cal if(cal_int%100 == 0)Serial.print("."); //Print a dot every 100 readings delay(4); //Wait 4 milliseconds before the next loop } //Now that we have 2000 measures, we need to devide by 2000 to get the average gyro offset Serial.println(" done!"); //2000 measures are done! gyro_roll_cal /= 2000; //Divide the roll total by 2000 gyro_pitch_cal /= 2000; //Divide the pitch total by 2000 gyro_yaw_cal /= 2000; //Divide the yaw total by 2000 } //Main program void loop(){ delay(250); //Wait 250 microseconds for every loop gyro_signalen(); //Read the gyro signals print_output(); //Print the output } void gyro_signalen(){ Wire.beginTransmission(105); //Start communication with the gyro (adress 1101001) Wire.write(168); //Start reading @ register 28h and auto increment with every read Wire.endTransmission(); //End the transmission Wire.requestFrom(105, 6); //Request 6 bytes from the gyro while(Wire.available() < 6); //Wait until the 6 bytes are received lowByte = Wire.read(); //First received byte is the low part of the angular data highByte = Wire.read(); //Second received byte is the high part of the angular data gyro_roll = ((highByte<<8)|lowByte); //Multiply highByte by 256 and ad lowByte if(cal_int == 2000)gyro_roll -= gyro_roll_cal; //Only compensate after the calibration lowByte = Wire.read(); //First received byte is the low part of the angular data highByte = Wire.read(); //Second received byte is the high part of the angular data gyro_pitch = ((highByte<<8)|lowByte); //Multiply highByte by 256 and ad lowByte gyro_pitch *= -1; //Invert axis if(cal_int == 2000)gyro_pitch -= gyro_pitch_cal; //Only compensate after the calibration lowByte = Wire.read(); //First received byte is the low part of the angular data highByte = Wire.read(); //Second received byte is the high part of the angular data gyro_yaw = ((highByte<<8)|lowByte); //Multiply highByte by 256 and ad lowByte gyro_yaw *= -1; //Invert axis if(cal_int == 2000)gyro_yaw -= gyro_yaw_cal; //Only compensate after the calibration } void print_output(){ Serial.print("Pitch:"); if(gyro_pitch >= 0)Serial.print("+"); Serial.print(gyro_pitch/57.14286,0); //Convert to degree per second if(gyro_pitch/57.14286 - 2 > 0)Serial.print(" NoU"); else if(gyro_pitch/57.14286 + 2 < 0)Serial.print(" NoD"); else Serial.print(" ---"); Serial.print(" Roll:"); if(gyro_roll >= 0)Serial.print("+"); Serial.print(gyro_roll/57.14286,0); //Convert to degree per second if(gyro_roll/57.14286 - 2 > 0)Serial.print(" RwD"); else if(gyro_roll/57.14286 + 2 < 0)Serial.print(" RwU"); else Serial.print(" ---"); Serial.print(" Yaw:"); if(gyro_yaw >= 0)Serial.print("+"); Serial.print(gyro_yaw/57.14286,0); //Convert to degree per second if(gyro_yaw/57.14286 - 2 > 0)Serial.println(" NoR"); else if(gyro_yaw/57.14286 + 2 < 0)Serial.println(" NoL"); else Serial.println(" ---"); }
  14. Hello, Complete code novice, I'm using Jeff Rowberg's library and sample code to get the Yaw, Pitch and Roll orientations of the gyro. However wanting to get the angular acceleration using these, (I'm thinking along the lines of, yaw value(t=t+1)-yaw value(t=t)/(time^2), knowing that the sample rate is 10 ms) and then depending on these values, if they are about a certain threshold a light turns on. However I'm very confused where to input these alterations of the code and actually how to write them. Any help really appreciated!
  15. I have a quick question regarding the MPU-6050. I'm using it in a quadcopter, connected to a Pro Mini, and I'm having some trouble. I'm using the DMP data, but I get FIFO overflows all the time. I tried using both solutions posted on the I2C forums here, but neither worked for me. In addition, occasionally I get a reading or two that are abnormal, and the rest are fine, i.e., the MPU is stationary, and once in a while the reading jumps at least ten degrees, and then suddenly jumps back the next reading. I suspect this may have to do with the FIFO overflow, but I'm not sure how to find out. I'd love it if you could point me in the right direction, or let me know what I need to do to solve this issue. I can post screenshots/sample data if need be. Thanks!
  16. 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 :-)
  17. I was hoping someone in this forum could help me understand the quaternion data output from the MPU-6050 when using the MPU6050-DMP6 code by Jeff Rowberg. I'm working on a project that contiuously records 3D positioning. Previously I had been recording euler angles, however, I ran into problems with Gimbal lock. Now I've started recording quaternions to avoid Gimbal lock, but the math involved is a little beyond me at the moment. I'm having a hard time making sense of the quaternion values I get from the device and relating them to real world dimensions. I want to be able to tilt the device sensor 90 degrees and confirm in the device data that this was accurately recorded. Here is some recorded quaternion data using the Arduino Pro Mini 3.3V, 8MHz ATmega 328 board: MPU-6050 at baseline pointing straight (after waiting 10 seconds) quaternion_straight: .4337, .2398, -.4392, -.7495 MPU-6050 pointing 90 degrees downward (attitude/pitch =-90 degrees) quaternion_down: -.1815, .4730, -.1089, -.8553 MPU-6050 pointing 90 degrees upward (attitude/pitch =+90 degrees) quaternion_up: .8190, -.1508, -.4704, -.2919 MPU-6050 tilted 90 degrees right (banking/roll =+90 degrees)quaternion_right: .0665, .5426, -.8361, -.0451MPU-6050 tilted -90 degrees left (banking/roll =-90 degrees)quaternion_left: .5125, -.0204, -.0079, -.8584 In an attempt to make sense of the data I have tried to convert the quaternion values to euler angles by using the following formula (http://en.wikipedia.org/wiki/Conversion_between_quaternions_and_Euler_angles): When I apply this formula I get euler values. As I believe the formula above gives me radian values all euler values below are already *(180/pi) to convert radian -> degrees. MPU-6050 at baseline pointing straight (after waiting 10 seconds) euler_straight: .60.04, -1.23, -120.61 MPU-6050 pointing 90 degrees downward (attitude/pitch =-90 degrees) euler_down: 1.58, 58.06, 156.92 MPU-6050 pointing 90 degrees upward (attitude/pitch =+90 degrees) euler_up: 3.087, -59.15, -40.98 MPU-6050 tilted 90 degrees right (banking/roll =+90 degrees) euler_right: 171.50, -3.57, -113.77 MPU-6050 tilted -90 degrees left (banking/roll =-90 degrees)euler_left: -0.42, -2.47, -118.31 The above values do not seem to correlate with the movements of the sensor described - e.g. the calculated euler values report movement in >1 dimensions (φ pitch -1.23 -> 58.06 and ψ roll -120.61 -> 156.92) In an attempt to calibrate the device to match up with real world dimensions I've tried: quaternion_straight*inverse(quaternion_straight)= 1, 0, 0, 0 quaternion_down*inverse(quaternion_straight)= 0.7236, 0.5427, -0.2764, -0.3254 euler conversion(quaternion_down*inverse(quaternion_straight))= 75.02, -2.68, -50.49 Once again 75.02, -2.68, -50.49 does not correspond to a 90 tilt in one direction/dimension. And I've also tried: euler_straight-euler_straight= 0, 0, 0 euler_down-euler_straight= -58.47, 59.30, 277.53 -58.47, 59.30, 277.53 does not correspond to a 90 tilt in one direction and does not match with the above mentioned 75.02, -2.68, -50.49 which I might have expected. As you might be able to see from what I have tried above, I have so far been unsuccessful in demonstrating that the device data is recorded accurately when I move the device 90 degrees in one direction. Do you have any suggestions of things to try and/or read up on? Does anyone see any obvious mistakes in my calculations above or how I'm approaching the problem? Let me know if my explanations above need further elaboration. I know everyone is very busy but any ideas or help would be greatly appreciated if you have time.
  18. We have some Arduino MEGA 2560-based boards with an on-board MPU-6050 at the default I2C address 0x68. i2cdevlib is extremely helpful (thank you Jeff!), except we can't seem to generate offsets that zero the sensor outputs. I've been using luisrodenas' Arduino sketch, which he posted in this forum recently, to calculate MPU6050 offsets. I modified the output to print the mean (2000 samples in this case) of the sensor outputs and the revised offsets calculated based on those mean values each time through the loop. The full data is attached and I've included a sample from gyro_z below. As you can see, the offsets change to try to move the mean values to zero. The sensors outputs seem to resist this adjustment, then at some offset threshold, the sensor values jump way past zero. This cycle then repeats. Only the gyro_y value responds as expected. Does anyone have any ideas what could be causing this? I've verified this on several PCBs, so it doesn't seem to be a bad MPU. I saw similar results setting offsets manually, so I don't think the issue is in the calibration sketch. Thanks, Mike MPU6050 connection successful Reading sensors for first time... Calculating offsets... Configuration: buffersize=2000 acel_deadzone=16 giro_deadzone=2 mean_gz gz_offset 492 140 931 -170 -93 -139 -89 -110 -88 -81 -89 -52 -88 -23 -89 6 934 -305 -1112 65 934 -246 -89 -217 -89 -188 -89 -159 -89 -130 -88 -101 -89 -72 -89 -43 -89 -14 -89 15 934 -296 -1113 75 output.txt
  19. Hi, First of all a thanks to Jeff Rowberg for putting in all the hard work to make this sensor more accessible. In an attempt to use the sensor output and avoid issues with gimbal lock I've been using the quaternion output from the MPU-6050_DMP6 code for my project. It seems however that the quaternion output with 2 significant digits is not as sensitive as the euler or ypr output. Is there anyone who has had success with changing the quaternion output to 3 or more significant digits?
×
×
  • Create New...