Jump to content
I2Cdevlib Forums


  • Posts

  • Joined

  • Last visited

  • Days Won


Community Answers

  1. luisrodenas's post in MPU6050 - getAccelerationX(); hangs during timer interrupt - Please advise was marked as the answer   
    I think you cannot call the function readBytes() from an ISR, at least you shouldnt. The reason for this is because that function includes I2C communications, that take some time and also may conflict with ISR manager for reasons I don't really know.
    Just use the timer interrupt to change the value of a flag, and then check that flag from main code and execute the readbytes().
  2. luisrodenas's post in Why should I wait for MPU interrupt (sometimes very long!!!) was marked as the answer   
    That's rigth if you only want to use RAW values... or if you read fifo whenever you want...  but the optimal way is by interruptions.
    Read the DMP sketch's comments. In order to use interruptions you have to connect your MPU's INT pin to Arduino UNO's 0 pin.
    By default DMP runs at 100Hz, but can be modified if you want to. (Max is 200Hz)
  3. luisrodenas's post in How to decide Gyro and Accelerometer offsett was marked as the answer   
    What I do to get calibration values using Arduino is the following:
    - Put the MPU6050 in a flat and horizontal surface. Use an inclinometer to check that it is as horizontal as possible.
    - Modify the RAW program to put every offset to 0. ("setXGyroOffset/setYGyroOffset/setZGyroOffset/setZAccelOffset"  =0 ).
    - Upload the RAW program to your arduino and open serial monitor so you can see the values it is returning.
    - Leave it operating for a few minutes (5-10) so temperature gets stabilized.
    - Check the values in the serial monitor and write them down.
    - Now modify your program again updating your offsets and run the sketch, with updated offsets.
    - Repeat this process until your program is returning 0 for every gyro, 0 for X and Y accel, and +16384 for Z accel.
    Once you achieve this, those are the offsets for that MPU6050, you will have to repeat this for every MPU6050 you use.
    - If you stop the sketch for a while, sensor's temperature will get lower. If you only stop it to reprogram new offsets, you dont need to wait those 5-10 minutes every time.
    - What you should try to achieve is to get the average of every gyro and XY accel to those values mentioned, so it is best if you modify the sketch to take, for example, 10000 measures, and just show on the serial monitor the average, because there is always some noise.
    - It is not so straigthforward to update your offset every time. In my case, I had to put my initial readings, negated (change sign) and divided by 4 (gyros) and by 7.8 (accels).
  • Create New...