Jump to content
I2Cdevlib Forums


  • Content Count

  • Joined

  • Last visited

  1. Your code is very strange. The easiest way to do the integration is this: float velocity = 0; float currAccel; float prevAccel = 0; unsigned long prevTime = millis(); unsigned long currTime; void loop() { //other stuff //refresh currAccel currTime = millis(); velocity += (currAccel + prevAccel)/2*(currTime - prevTime)/1000; //1000 added to get the same units prevAccel = currAccel; prevTime = currTime; } But this will give you a "drift problem". The results won't be even close to good. That are my results. Sensor was not moving during data integration. As you can see the veloc
  2. Unfortunately you cannot do much about it. It is a well known issue. A quote from wikipedia http://en.wikipedia.org/wiki/Inertial_navigation_system: You can find also useful information in this talk: Especially parts starting at 18:40 (single integration) and 23:40 (double integration).
  3. It seems ok and you are getting OUTPUT_READABLE_REALACCEL. You are doing almost the same that is done by this functions: Your code contains the same logic, but written in slightly different order (but if you look closely you will see the same multiplications, shift operations, subtractions etc). I just think that my suggestions would make the code much easier to read.
  4. One of these two is exactly what you want, because it should return 0 values when MPU is stationary. The only difference should be axes: If MPU6050 is stationary then it will return 0 (almost 0) in all three axes. You just have to use the code from lines 324-352 (or copy/modify it). If you want to have the teapot example and these values you can modify the code like this: Now you should be able to use world acceleration data inside teapot demo. Just be careful because teapot array structure has been slightly modified.
  5. I know that this is an old topic but just the information for the future generations. I was using the same board GY-87 with BMP180 and I was able to use BMP85 library without any changes. BMP180 and BMP85 have the same "software" (probably also all the registers are the same, but I wasn't comparing them so accurately). BMP180 is just a later version that is more accurate.
  6. Hi, I think that you want to get exaclty the same thing that is implemented in the example file You have to uncomment one of this definitions: and you will get acceleration without gravity. Check lines 324-352 to see what is exaclty happening.
  7. Hi! Did you manage to solve the problem? I have exaclty the same problem with one of my MPU6050 (breakboard GY-87). It slides for about 6 seconds and after that the readings are constant. On the other hand my second MPU6050 on GY-521 is working fine from the very begining right after start up. I am using DMP.
  8. Regarding your first question: I don't have DUE but this site: http://arduino.cc/en/Reference/attachInterrupt says that it should be possibe. So just use another pin and change this fragment of code: attachInterrupt(0, dmpDataReady, RISING); To be honest I didn't understand the second question.
  9. You should call this functions once: accelGyroMag.setFullScaleGyroRange(MPU9150_GYRO_FS_1000); accelGyroMag.setFullScaleAccelRange(MPU9150_ACCEL_FS_4); You can put them at the end of setup(). Check out MPU9150.cpp for detailed description and more useful functions. BTW This is MPU6050 topic, so this should be theoretically moved to MPU9150.
  10. 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 i
  11. What does ledPin7 and ledPin6 exactly mean? Is is some RGB led? I suppose that ledPin6 means red and ledPin7 means green. You have written that you got this color sequence: - red - green - yellow and green blinking The problem is probably that you are not always turning off your leds. I have added two "else" with comments. if ( ypr[0] * 180/M_PI < 90) { if(currentMillis - previousMillis > interval) { // save the last time you blinked the LED previousMillis = currentMillis; // if the LED is off turn it on and vice-versa: if (ledState == LOW)
  12. I managed to solve this. The problem was reading to many bytes as once. I was reading always the same amount of bytes (64 as this is the size of my buffer) but used only 42 (as this is the default size of DMP packet). As a result bytes were removed from FIFO without actually using them. I will also answer the question I asked above: what is the proper way of working this function: int8_t I2Cdev::readBytes(uint8_t devAddr, uint8_t regAddr, uint8_t length, uint8_t *data, uint16_t timeout) It should read length bytes starting from register number regAddr at once. I am not sure why it works
  13. Hi, I've searched hole forum and the Internet ant haven't found many (to be honest almost none) information if anyone have successfully implemented I2CDev library on BeagleBone Black. I would like to use it with MPU6050. I've started to implement it, but without any success so far. Below, there is one question abut this library, I hope it is not too big offtop. What is the proper way of working this function: int8_t I2Cdev::readBytes(uint8_t devAddr, uint8_t regAddr, uint8_t length, uint8_t *data, uint16_t timeout) All the time I was thinking that it shoud read length bytes startin
  • Create New...