MPU-6050 (I2C) Library

Can someone help me port this library?
User avatar
Squonk42
Posts: 190
Joined: Thu Dec 29, 2016 9:25 am
Location: Bordeaux, France

Re: MPU-6050 (I2C) Library

Post by Squonk42 » Mon Jun 05, 2017 11:50 am

I wrote a blog entry on the Sensor Fusion subject a few months ago, if this can be useful to someone:
http://www.wifi4things.com/motion-sensor-fusion/

User avatar
RogerClark
Posts: 7482
Joined: Mon Apr 27, 2015 10:36 am
Location: Melbourne, Australia
Contact:

Re: MPU-6050 (I2C) Library

Post by RogerClark » Mon Jun 05, 2017 10:19 pm

Squonk42 wrote:I wrote a blog entry on the Sensor Fusion subject a few months ago, if this can be useful to someone:
http://www.wifi4things.com/motion-sensor-fusion/
Thanks for the link to your roundup of algorithms.

I used the RTIMU lib a few years ago with the MPU9150, but it did not include filtering, ( I am not sure if it got updated to include filtering, but I think the library has been abandoned now by its author).

I was hoping to do some basic inertial navigation for a walking robot I bought, but found the integration errors were far to high without filtering, and applying basic filtering caused a different set of errors.

So I gave up on the idea.

User avatar
Squonk42
Posts: 190
Joined: Thu Dec 29, 2016 9:25 am
Location: Bordeaux, France

Re: MPU-6050 (I2C) Library

Post by Squonk42 » Tue Jun 06, 2017 5:20 am

RogerClark wrote:I used the RTIMU lib a few years ago with the MPU9150, but it did not include filtering, ( I am not sure if it got updated to include filtering, but I think the library has been abandoned now by its author).
From https://github.com/RTIMULib/RTIMULib2:
RTIMULib also supports multiple sensor integration fusion filters such as RTQF and Kalman filters.
RTIMULib is outdated, it is better to use one of the alternatives based on complementary filters and calibration techniques I listed.

User avatar
RogerClark
Posts: 7482
Joined: Mon Apr 27, 2015 10:36 am
Location: Melbourne, Australia
Contact:

Re: MPU-6050 (I2C) Library

Post by RogerClark » Tue Jun 06, 2017 7:53 am

OK.

I don't think I will go back to the same project, but its good to know there is an updated version of the library

User avatar
ahull
Posts: 1657
Joined: Mon Apr 27, 2015 11:04 pm
Location: Sunny Scotland
Contact:

Re: MPU-6050 (I2C) Library

Post by ahull » Wed Aug 16, 2017 9:14 pm

I'm not sure if anybody on the forum is the Joop Brokking who produced this video, but I'll leave this here just for completeness.

- Andy Hull -

rsc
Posts: 17
Joined: Thu Oct 06, 2016 12:03 pm
Location: Argentina

Re: MPU-6050 (I2C) Library

Post by rsc » Mon Sep 18, 2017 12:56 am

the code in that video not work (for my) :| :| :|

aster
Posts: 110
Joined: Thu Mar 30, 2017 2:41 pm
Location: bella italy
Contact:

Re: MPU-6050 (I2C) Library

Post by aster » Fri Oct 06, 2017 4:55 pm

Squonk42 wrote:
Tue Jun 06, 2017 5:20 am
RogerClark wrote:I used the RTIMU lib a few years ago with the MPU9150, but it did not include filtering, ( I am not sure if it got updated to include filtering, but I think the library has been abandoned now by its author).
From https://github.com/RTIMULib/RTIMULib2:
RTIMULib also supports multiple sensor integration fusion filters such as RTQF and Kalman filters.
RTIMULib is outdated, it is better to use one of the alternatives based on complementary filters and calibration techniques I listed.
hey Squonk42, it looks like that your site is down, anyway i am interested in this library for the mpu9260 with quaternion filters. could you give me a link to it? or maybe someone have found something similar?
i am getting bored of rtimu it is a mess :roll:

aster
Posts: 110
Joined: Thu Mar 30, 2017 2:41 pm
Location: bella italy
Contact:

Re: MPU-6050 (I2C) Library

Post by aster » Mon Oct 09, 2017 11:33 am

i found this library: https://github.com/sparkfun/SparkFun_MP ... no_Library
and i am using cheap sensors from aliexpress like this:
Image

right now i am testing it only with i2c (spi later) and i found an error:
the WHO_AM_I_MPU9250 register could be both 0x71 and 0x73 (mine is 0x73 may it means that my sensors is a fake one? boh)

same problem with the magnetometer:
WHO_AM_I_AK8963 register should be 0x48 but it looks like that my imu doesn't have this registers!

anyway i forced the imu to run a test with the library and i get:
AK8963 mag biases (mG)
-56.29
193.08
339.12
AK8963 mag scale (mG)
1.17
0.77
1.17

example basinc data output without moving the imu

Code: Select all

X-acceleration: -43.70 mg Y-acceleration: 0.31 mg Z-acceleration: 999.94 mg 
X-gyro rate: 0.046 degrees/sec Y-gyro rate: 0.031 degrees/sec Z-gyro rate: 0.000 degrees/sec
X-mag field: 1.82 mG Y-mag field: 0.00 mG Z-mag field: 49.20 mG
Temperature is 26.3 degrees C
X-acceleration: -46.94 mg Y-acceleration: 1.22 mg Z-acceleration: 1001.34 mg 
X-gyro rate: 0.015 degrees/sec Y-gyro rate: 0.168 degrees/sec Z-gyro rate: 0.008 degrees/sec
X-mag field: 5.45 mG Y-mag field: -7.29 mG Z-mag field: 35.14 mG
Temperature is 26.3 degrees C
X-acceleration: -45.04 mg Y-acceleration: 0.31 mg Z-acceleration: 999.02 mg 
X-gyro rate: -0.114 degrees/sec Y-gyro rate: 0.130 degrees/sec Z-gyro rate: -0.107 degrees/sec
X-mag field: 3.63 mG Y-mag field: -9.11 mG Z-mag field: 33.38 mG
Temperature is 26.3 degrees C
X-acceleration: -44.49 mg Y-acceleration: 1.22 mg Z-acceleration: 1004.39 mg 
X-gyro rate: -0.053 degrees/sec Y-gyro rate: 0.206 degrees/sec Z-gyro rate: -0.008 degrees/sec
X-mag field: 5.45 mG Y-mag field: -3.64 mG Z-mag field: 45.68 mG
Temperature is 26.3 degrees C
X-acceleration: -44.37 mg Y-acceleration: 0.37 mg Z-acceleration: 999.27 mg 
X-gyro rate: -0.008 degrees/sec Y-gyro rate: 0.038 degrees/sec Z-gyro rate: 0.069 degrees/sec
X-mag field: 5.45 mG Y-mag field: -10.93 mG Z-mag field: 17.57 mG
Temperature is 26.3 degrees C
X-acceleration: -45.53 mg Y-acceleration: 1.22 mg Z-acceleration: 1001.40 mg 
X-gyro rate: -0.008 degrees/sec Y-gyro rate: 0.092 degrees/sec Z-gyro rate: -0.008 degrees/sec
X-mag field: 7.26 mG Y-mag field: -5.46 mG Z-mag field: 36.90 mG
Temperature is 26.3 degrees C
X-acceleration: -45.17 mg Y-acceleration: 0.92 mg Z-acceleration: 998.23 mg 
X-gyro rate: -0.053 degrees/sec Y-gyro rate: 0.153 degrees/sec Z-gyro rate: 0.053 degrees/sec
X-mag field: 9.08 mG Y-mag field: 10.93 mG Z-mag field: 17.57 mG
Temperature is 26.3 degrees C
X-acceleration: -48.77 mg Y-acceleration: -1.95 mg Z-acceleration: 999.02 mg 
X-gyro rate: -0.061 degrees/sec Y-gyro rate: 0.069 degrees/sec Z-gyro rate: 1.144 degrees/sec
X-mag field: -12.71 mG Y-mag field: -14.57 mG Z-mag field: 38.66 mG
Temperature is 26.3 degrees C
X-acceleration: -46.02 mg Y-acceleration: 0.61 mg Z-acceleration: 1004.82 mg 
X-gyro rate: 0.038 degrees/sec Y-gyro rate: 0.183 degrees/sec Z-gyro rate: -0.046 degrees/sec
X-mag field: 21.79 mG Y-mag field: -9.11 mG Z-mag field: 36.90 mG
Temperature is 26.3 degrees C
X-acceleration: -44.86 mg Y-acceleration: 0.18 mg Z-acceleration: 1000.06 mg 
X-gyro rate: -0.046 degrees/sec Y-gyro rate: 0.130 degrees/sec Z-gyro rate: 0.099 degrees/sec
X-mag field: 5.45 mG Y-mag field: -10.93 mG Z-mag field: 45.68 mG
Temperature is 26.3 degrees C
X-acceleration: -48.22 mg Y-acceleration: 2.50 mg Z-acceleration: 1003.78 mg 
X-gyro rate: -0.099 degrees/sec Y-gyro rate: 0.069 degrees/sec Z-gyro rate: -0.076 degrees/sec
X-mag field: 3.63 mG Y-mag field: -1.82 mG Z-mag field: 29.87 mG
Temperature is 26.3 degrees C
X-acceleration: -46.94 mg Y-acceleration: 0.43 mg Z-acceleration: 1002.20 mg 
X-gyro rate: -0.023 degrees/sec Y-gyro rate: 0.153 degrees/sec Z-gyro rate: 0.206 degrees/sec
X-mag field: -3.63 mG Y-mag field: -12.75 mG Z-mag field: 47.44 mG
Temperature is 26.3 degrees C
X-acceleration: -48.71 mg Y-acceleration: 1.34 mg Z-acceleration: 1000.18 mg 
X-gyro rate: -0.038 degrees/sec Y-gyro rate: 0.046 degrees/sec Z-gyro rate: -0.046 degrees/sec
X-mag field: 3.63 mG Y-mag field: -1.82 mG Z-mag field: 36.90 mG
Temperature is 26.3 degrees C
X-acceleration: -44.98 mg Y-acceleration: 0.85 mg Z-acceleration: 1002.38 mg 
X-gyro rate: -0.061 degrees/sec Y-gyro rate: 0.168 degrees/sec Z-gyro rate: 0.130 degrees/sec
X-mag field: 1.82 mG Y-mag field: 3.64 mG Z-mag field: 35.14 mG
Temperature is 26.3 degrees C
X-acceleration: -45.65 mg Y-acceleration: -0.31 mg Z-acceleration: 1001.71 mg 
X-gyro rate: -0.046 degrees/sec Y-gyro rate: 0.145 degrees/sec Z-gyro rate: -0.084 degrees/sec
X-mag field: -1.82 mG Y-mag field: -18.22 mG Z-mag field: 35.14 mG
Temperature is 26.3 degrees C
X-acceleration: -47.61 mg Y-acceleration: 2.56 mg Z-acceleration: 1001.16 mg 
X-gyro rate: -0.061 degrees/sec Y-gyro rate: 0.145 degrees/sec Z-gyro rate: -0.046 degrees/sec
X-mag field: 7.26 mG Y-mag field: -1.82 mG Z-mag field: 33.38 mG
Temperature is 26.3 degrees C
X-acceleration: -45.53 mg Y-acceleration: 2.26 mg Z-acceleration: 997.31 mg 
X-gyro rate: 0.000 degrees/sec Y-gyro rate: 0.160 degrees/sec Z-gyro rate: 0.069 degrees/sec
X-mag field: 5.45 mG Y-mag field: -10.93 mG Z-mag field: 42.17 mG
Temperature is 26.3 degrees C
X-acceleration: -46.75 mg Y-acceleration: 1.40 mg Z-acceleration: 1001.16 mg 
X-gyro rate: -0.053 degrees/sec Y-gyro rate: 0.221 degrees/sec Z-gyro rate: -0.069 degrees/sec
X-mag field: 9.08 mG Y-mag field: 7.29 mG Z-mag field: 28.11 mG
Temperature is 26.3 degrees C
X-acceleration: -44.98 mg Y-acceleration: -1.04 mg Z-acceleration: 997.38 mg 
X-gyro rate: -0.084 degrees/sec Y-gyro rate: 0.130 degrees/sec Z-gyro rate: -0.053 degrees/sec
X-mag field: 25.42 mG Y-mag field: 9.11 mG Z-mag field: 26.36 mG
Temperature is 26.3 degrees C
X-acceleration: -46.08 mg Y-acceleration: 1.10 mg Z-acceleration: 1002.50 mg 
X-gyro rate: -0.107 degrees/sec Y-gyro rate: 0.069 degrees/sec Z-gyro rate: 0.053 degrees/sec
X-mag field: 12.71 mG Y-mag field: -18.22 mG Z-mag field: 31.63 mG
Temperature is 26.3 degrees C
X-acceleration: -46.75 mg Y-acceleration: 0.92 mg Z-acceleration: 1003.66 mg 
X-gyro rate: -0.107 degrees/sec Y-gyro rate: 0.069 degrees/sec Z-gyro rate: -0.038 degrees/sec
X-mag field: 10.89 mG Y-mag field: 1.82 mG Z-mag field: 40.41 mG
Temperature is 26.3 degrees C
X-acceleration: -45.47 mg Y-acceleration: 1.46 mg Z-acceleration: 1000.98 mg 
X-gyro rate: 0.053 degrees/sec Y-gyro rate: 0.183 degrees/sec Z-gyro rate: -0.038 degrees/sec
X-mag field: 1.82 mG Y-mag field: -7.29 mG Z-mag field: 28.11 mG
Temperature is 26.3 degrees C
X-acceleration: -48.95 mg Y-acceleration: 4.33 mg Z-acceleration: 1000.67 mg 
X-gyro rate: -0.053 degrees/sec Y-gyro rate: 0.153 degrees/sec Z-gyro rate: -0.038 degrees/sec
X-mag field: 23.60 mG Y-mag field: -10.93 mG Z-mag field: 35.14 mG
Temperature is 26.3 degrees C
X-acceleration: -46.51 mg Y-acceleration: 0.79 mg Z-acceleration: 997.25 mg 
X-gyro rate: -0.076 degrees/sec Y-gyro rate: 0.069 degrees/sec Z-gyro rate: -0.015 degrees/sec
X-mag field: -7.26 mG Y-mag field: -5.46 mG Z-mag field: 57.98 mG
Temperature is 26.3 degrees C
X-acceleration: -47.91 mg Y-acceleration: 0.12 mg Z-acceleration: 1000.18 mg 
X-gyro rate: 0.008 degrees/sec Y-gyro rate: 0.099 degrees/sec Z-gyro rate: -0.092 degrees/sec
X-mag field: 1.82 mG Y-mag field: -21.86 mG Z-mag field: 49.20 mG
Temperature is 26.3 degrees C
X-acceleration: -46.81 mg Y-acceleration: 1.46 mg Z-acceleration: 996.95 mg 
X-gyro rate: -0.031 degrees/sec Y-gyro rate: 0.107 degrees/sec Z-gyro rate: 0.046 degrees/sec
X-mag field: 1.82 mG Y-mag field: 10.93 mG Z-mag field: 35.14 mG
Temperature is 26.3 degrees C
X-acceleration: -47.55 mg Y-acceleration: 0.43 mg Z-acceleration: 999.94 mg 
X-gyro rate: -0.130 degrees/sec Y-gyro rate: 0.153 degrees/sec Z-gyro rate: -0.008 degrees/sec
X-mag field: 0.00 mG Y-mag field: -20.04 mG Z-mag field: 40.41 mG
Temperature is 26.3 degrees C
X-acceleration: -49.56 mg Y-acceleration: 0.12 mg Z-acceleration: 1002.26 mg 
X-gyro rate: -0.069 degrees/sec Y-gyro rate: 0.114 degrees/sec Z-gyro rate: 0.008 degrees/sec
X-mag field: -5.45 mG Y-mag field: -7.29 mG Z-mag field: 42.17 mG
Temperature is 26.3 degrees C
X-acceleration: -44.92 mg Y-acceleration: 1.77 mg Z-acceleration: 1003.11 mg 
X-gyro rate: 0.015 degrees/sec Y-gyro rate: 0.107 degrees/sec Z-gyro rate: 0.015 degrees/sec
X-mag field: 7.26 mG Y-mag field: -9.11 mG Z-mag field: 36.90 mG
Temperature is 26.3 degrees C
X-acceleration: -50.72 mg Y-acceleration: 0.92 mg Z-acceleration: 1000.92 mg 
X-gyro rate: -0.023 degrees/sec Y-gyro rate: 0.099 degrees/sec Z-gyro rate: 0.816 degrees/sec
X-mag field: 29.05 mG Y-mag field: -20.04 mG Z-mag field: 40.41 mG
Temperature is 26.3 degrees C
X-acceleration: -48.77 mg Y-acceleration: 0.12 mg Z-acceleration: 999.63 mg 
X-gyro rate: 0.038 degrees/sec Y-gyro rate: 0.160 degrees/sec Z-gyro rate: -0.191 degrees/sec
X-mag field: 19.97 mG Y-mag field: -10.93 mG Z-mag field: 21.09 mG
Temperature is 26.3 degrees C
X-acceleration: -47.30 mg Y-acceleration: 2.38 mg Z-acceleration: 1003.48 mg 
X-gyro rate: 0.000 degrees/sec Y-gyro rate: 0.092 degrees/sec Z-gyro rate: -0.122 degrees/sec
X-mag field: 19.97 mG Y-mag field: -18.22 mG Z-mag field: 35.14 mG
Temperature is 26.3 degrees C
X-acceleration: -46.94 mg Y-acceleration: 2.01 mg Z-acceleration: 1003.11 mg 
X-gyro rate: -0.053 degrees/sec Y-gyro rate: 0.153 degrees/sec Z-gyro rate: -0.061 degrees/sec
X-mag field: 7.26 mG Y-mag field: -16.39 mG Z-mag field: 36.90 mG
Temperature is 26.3 degrees C
X-acceleration: -47.00 mg Y-acceleration: 0.98 mg Z-acceleration: 1000.12 mg 
X-gyro rate: -0.015 degrees/sec Y-gyro rate: 0.084 degrees/sec Z-gyro rate: -0.084 degrees/sec
X-mag field: 10.89 mG Y-mag field: -5.46 mG Z-mag field: 33.38 mG
Temperature is 26.3 degrees C
X-acceleration: -43.21 mg Y-acceleration: 1.22 mg Z-acceleration: 1000.67 mg 
X-gyro rate: -0.038 degrees/sec Y-gyro rate: 0.153 degrees/sec Z-gyro rate: 0.061 degrees/sec
X-mag field: 18.16 mG Y-mag field: -12.75 mG Z-mag field: 36.90 mG
Temperature is 26.3 degrees C
X-acceleration: -45.59 mg Y-acceleration: 0.24 mg Z-acceleration: 998.23 mg 
X-gyro rate: -0.031 degrees/sec Y-gyro rate: 0.114 degrees/sec Z-gyro rate: -0.046 degrees/sec
X-mag field: -9.08 mG Y-mag field: -18.22 mG Z-mag field: 38.66 mG
Temperature is 26.3 degrees C
X-acceleration: -49.01 mg Y-acceleration: 2.38 mg Z-acceleration: 1000.92 mg 
X-gyro rate: -0.061 degrees/sec Y-gyro rate: 0.099 degrees/sec Z-gyro rate: -0.046 degrees/sec
X-mag field: -5.45 mG Y-mag field: -18.22 mG Z-mag field: 35.14 mG
Temperature is 26.3 degrees C
X-acceleration: -46.94 mg Y-acceleration: 0.06 mg Z-acceleration: 1003.17 mg 
X-gyro rate: -0.023 degrees/sec Y-gyro rate: 0.137 degrees/sec Z-gyro rate: 0.046 degrees/sec
X-mag field: -7.26 mG Y-mag field: -12.75 mG Z-mag field: 57.98 mG
Temperature is 26.3 degrees C
X-acceleration: -47.97 mg Y-acceleration: 0.31 mg Z-acceleration: 997.19 mg 
X-gyro rate: -0.046 degrees/sec Y-gyro rate: 0.153 degrees/sec Z-gyro rate: -0.168 degrees/sec
X-mag field: 3.63 mG Y-mag field: -16.39 mG Z-mag field: 43.93 mG
Temperature is 26.3 degrees C
X-acceleration: -46.20 mg Y-acceleration: 2.69 mg Z-acceleration: 1001.83 mg 
X-gyro rate: -0.114 degrees/sec Y-gyro rate: 0.191 degrees/sec Z-gyro rate: -0.053 degrees/sec
X-mag field: 0.00 mG Y-mag field: -1.82 mG Z-mag field: 43.93 mG
Temperature is 26.3 degrees C
X-acceleration: -50.29 mg Y-acceleration: 1.53 mg Z-acceleration: 1002.93 mg 
X-gyro rate: -0.038 degrees/sec Y-gyro rate: 0.153 degrees/sec Z-gyro rate: 0.038 degrees/sec
X-mag field: -3.63 mG Y-mag field: -5.46 mG Z-mag field: 40.41 mG
Temperature is 26.3 degrees C
X-acceleration: -45.72 mg Y-acceleration: -0.18 mg Z-acceleration: 1002.01 mg 
X-gyro rate: -0.069 degrees/sec Y-gyro rate: 0.076 degrees/sec Z-gyro rate: 0.015 degrees/sec
X-mag field: 1.82 mG Y-mag field: -21.86 mG Z-mag field: 24.60 mG
Temperature is 26.3 degrees C
X-acceleration: -47.79 mg Y-acceleration: 0.55 mg Z-acceleration: 999.88 mg 
X-gyro rate: -0.130 degrees/sec Y-gyro rate: 0.183 degrees/sec Z-gyro rate: -0.015 degrees/sec
X-mag field: 0.00 mG Y-mag field: 1.82 mG Z-mag field: 15.81 mG
Temperature is 26.3 degrees C
X-acceleration: -47.06 mg Y-acceleration: 3.23 mg Z-acceleration: 1003.54 mg 
X-gyro rate: -0.046 degrees/sec Y-gyro rate: 0.008 degrees/sec Z-gyro rate: -0.092 degrees/sec
X-mag field: 27.24 mG Y-mag field: -7.29 mG Z-mag field: 28.11 mG
Temperature is 26.3 degrees C
X-acceleration: -48.22 mg Y-acceleration: 0.18 mg Z-acceleration: 1000.00 mg 
X-gyro rate: -0.084 degrees/sec Y-gyro rate: 0.130 degrees/sec Z-gyro rate: -0.069 degrees/sec
X-mag field: 3.63 mG Y-mag field: 1.82 mG Z-mag field: 29.87 mG
Temperature is 26.3 degrees C
X-acceleration: -46.20 mg Y-acceleration: 1.95 mg Z-acceleration: 998.84 mg 
X-gyro rate: 0.015 degrees/sec Y-gyro rate: 0.092 degrees/sec Z-gyro rate: -0.053 degrees/sec
X-mag field: 3.63 mG Y-mag field: 5.46 mG Z-mag field: 29.87 mG
Temperature is 26.3 degrees C
X-acceleration: -46.57 mg Y-acceleration: 1.65 mg Z-acceleration: 998.47 mg 
X-gyro rate: 0.015 degrees/sec Y-gyro rate: 0.214 degrees/sec Z-gyro rate: -0.046 degrees/sec
X-mag field: 1.82 mG Y-mag field: 0.00 mG Z-mag field: 35.14 mG
Temperature is 26.3 degrees C
X-acceleration: -48.71 mg Y-acceleration: -0.43 mg Z-acceleration: 998.29 mg 
X-gyro rate: -0.092 degrees/sec Y-gyro rate: 0.046 degrees/sec Z-gyro rate: -0.099 degrees/sec
X-mag field: 5.45 mG Y-mag field: -10.93 mG Z-mag field: 52.71 mG
Temperature is 26.3 degrees C
X-acceleration: -46.14 mg Y-acceleration: 2.08 mg Z-acceleration: 997.25 mg 
X-gyro rate: -0.069 degrees/sec Y-gyro rate: 0.015 degrees/sec Z-gyro rate: -0.084 degrees/sec
X-mag field: -7.26 mG Y-mag field: -5.46 mG Z-mag field: 47.44 mG
Temperature is 26.3 degrees C
X-acceleration: -46.26 mg Y-acceleration: 1.95 mg Z-acceleration: 1003.97 mg 
X-gyro rate: -0.015 degrees/sec Y-gyro rate: 0.114 degrees/sec Z-gyro rate: -0.008 degrees/sec
X-mag field: -25.42 mG Y-mag field: -20.04 mG Z-mag field: 40.41 mG
Temperature is 26.3 degrees C
X-acceleration: -46.69 mg Y-acceleration: 2.38 mg Z-acceleration: 1000.18 mg 
X-gyro rate: -0.092 degrees/sec Y-gyro rate: 0.107 degrees/sec Z-gyro rate: -0.107 degrees/sec
X-mag field: 7.26 mG Y-mag field: -23.68 mG Z-mag field: 40.41 mG
Temperature is 26.3 degrees C
X-acceleration: -45.96 mg Y-acceleration: -0.98 mg Z-acceleration: 1000.43 mg 
X-gyro rate: -0.092 degrees/sec Y-gyro rate: 0.153 degrees/sec Z-gyro rate: -0.031 degrees/sec
X-mag field: -9.08 mG Y-mag field: -14.57 mG Z-mag field: 42.17 mG
Temperature is 26.3 degrees C
X-acceleration: -46.08 mg Y-acceleration: 0.18 mg Z-acceleration: 999.27 mg 
X-gyro rate: 0.023 degrees/sec Y-gyro rate: 0.221 degrees/sec Z-gyro rate: -0.008 degrees/sec
X-mag field: 9.08 mG Y-mag field: -7.29 mG Z-mag field: 24.60 mG
Temperature is 26.3 degrees C
X-acceleration: -46.94 mg Y-acceleration: 2.01 mg Z-acceleration: 999.88 mg 
X-gyro rate: -0.023 degrees/sec Y-gyro rate: 0.092 degrees/sec Z-gyro rate: -0.053 degrees/sec
X-mag field: 19.97 mG Y-mag field: 7.29 mG Z-mag field: 28.11 mG
Temperature is 26.3 degrees C
X-acceleration: -44.25 mg Y-acceleration: 1.71 mg Z-acceleration: 1000.61 mg 
X-gyro rate: -0.061 degrees/sec Y-gyro rate: 0.046 degrees/sec Z-gyro rate: -0.084 degrees/sec
X-mag field: 21.79 mG Y-mag field: -12.75 mG Z-mag field: 29.87 mG
Temperature is 26.3 degrees C
X-acceleration: -47.06 mg Y-acceleration: 1.16 mg Z-acceleration: 1001.77 mg 
X-gyro rate: 0.015 degrees/sec Y-gyro rate: 0.092 degrees/sec Z-gyro rate: 0.000 degrees/sec
X-mag field: 25.42 mG Y-mag field: 1.82 mG Z-mag field: 12.30 mG
Temperature is 26.3 degrees C
X-acceleration: -44.19 mg Y-acceleration: 0.92 mg Z-acceleration: 1001.89 mg 
X-gyro rate: 0.046 degrees/sec Y-gyro rate: 0.191 degrees/sec Z-gyro rate: 0.008 degrees/sec
X-mag field: -1.82 mG Y-mag field: 0.00 mG Z-mag field: 35.14 mG
Temperature is 26.3 degrees C
X-acceleration: -46.08 mg Y-acceleration: 0.67 mg Z-acceleration: 999.39 mg 
X-gyro rate: -0.015 degrees/sec Y-gyro rate: 0.046 degrees/sec Z-gyro rate: -0.008 degrees/sec
X-mag field: 1.82 mG Y-mag field: 0.00 mG Z-mag field: 38.66 mG
Temperature is 26.3 degrees C
X-acceleration: -46.88 mg Y-acceleration: 1.65 mg Z-acceleration: 1001.22 mg 
X-gyro rate: 0.069 degrees/sec Y-gyro rate: 0.137 degrees/sec Z-gyro rate: -0.069 degrees/sec
X-mag field: 3.63 mG Y-mag field: 1.82 mG Z-mag field: 33.38 mG
Temperature is 26.3 degrees C
X-acceleration: -46.63 mg Y-acceleration: 3.36 mg Z-acceleration: 1000.43 mg 
X-gyro rate: 0.000 degrees/sec Y-gyro rate: 0.122 degrees/sec Z-gyro rate: 0.023 degrees/sec
X-mag field: 3.63 mG Y-mag field: -16.39 mG Z-mag field: 50.96 mG
Temperature is 26.3 degrees C
X-acceleration: -48.71 mg Y-acceleration: 2.38 mg Z-acceleration: 997.86 mg 
X-gyro rate: -0.023 degrees/sec Y-gyro rate: 0.168 degrees/sec Z-gyro rate: -0.137 degrees/sec
X-mag field: -3.63 mG Y-mag field: -20.04 mG Z-mag field: 47.44 mG
Temperature is 26.3 degrees C
X-acceleration: -43.09 mg Y-acceleration: 2.14 mg Z-acceleration: 1002.87 mg 
X-gyro rate: -0.076 degrees/sec Y-gyro rate: 0.191 degrees/sec Z-gyro rate: -0.069 degrees/sec
X-mag field: -3.63 mG Y-mag field: -23.68 mG Z-mag field: 40.41 mG
Temperature is 26.3 degrees C
X-acceleration: -46.08 mg Y-acceleration: 1.77 mg Z-acceleration: 999.02 mg 
X-gyro rate: -0.008 degrees/sec Y-gyro rate: 0.153 degrees/sec Z-gyro rate: 0.832 degrees/sec
X-mag field: 3.63 mG Y-mag field: -12.75 mG Z-mag field: 33.38 mG
Temperature is 26.3 degrees C
X-acceleration: -49.56 mg Y-acceleration: 1.89 mg Z-acceleration: 1002.08 mg 
X-gyro rate: -0.046 degrees/sec Y-gyro rate: 0.099 degrees/sec Z-gyro rate: 0.015 degrees/sec
X-mag field: 1.82 mG Y-mag field: -7.29 mG Z-mag field: 31.63 mG
Temperature is 26.3 degrees C
X-acceleration: -46.51 mg Y-acceleration: 2.32 mg Z-acceleration: 998.17 mg 
X-gyro rate: -0.076 degrees/sec Y-gyro rate: 0.191 degrees/sec Z-gyro rate: -0.114 degrees/sec
X-mag field: 27.24 mG Y-mag field: 0.00 mG Z-mag field: 35.14 mG
Temperature is 26.3 degrees C
X-acceleration: -46.57 mg Y-acceleration: 2.99 mg Z-acceleration: 1003.42 mg 
X-gyro rate: -0.153 degrees/sec Y-gyro rate: 0.206 degrees/sec Z-gyro rate: -0.046 degrees/sec
X-mag field: 16.34 mG Y-mag field: -7.29 mG Z-mag field: 35.14 mG
Temperature is 26.3 degrees C
X-acceleration: -44.31 mg Y-acceleration: 2.44 mg Z-acceleration: 999.39 mg 
X-gyro rate: 0.000 degrees/sec Y-gyro rate: 0.137 degrees/sec Z-gyro rate: -0.015 degrees/sec
X-mag field: 18.16 mG Y-mag field: 9.11 mG Z-mag field: 12.30 mG
Temperature is 26.3 degrees C
X-acceleration: -43.76 mg Y-acceleration: 1.34 mg Z-acceleration: 1000.31 mg 
X-gyro rate: -0.031 degrees/sec Y-gyro rate: 0.183 degrees/sec Z-gyro rate: -0.008 degrees/sec
X-mag field: 10.89 mG Y-mag field: -1.82 mG Z-mag field: 15.81 mG
Temperature is 26.3 degrees C
X-acceleration: -47.97 mg Y-acceleration: 1.59 mg Z-acceleration: 999.82 mg 
X-gyro rate: 0.053 degrees/sec Y-gyro rate: 0.099 degrees/sec Z-gyro rate: -0.038 degrees/sec
X-mag field: 1.82 mG Y-mag field: -10.93 mG Z-mag field: 31.63 mG
Temperature is 26.3 degrees C
X-acceleration: -46.69 mg Y-acceleration: 1.53 mg Z-acceleration: 996.34 mg 
X-gyro rate: -0.084 degrees/sec Y-gyro rate: 0.244 degrees/sec Z-gyro rate: 0.000 degrees/sec
X-mag field: -14.53 mG Y-mag field: -20.04 mG Z-mag field: 43.93 mG
Temperature is 26.3 degrees C
X-acceleration: -47.79 mg Y-acceleration: 1.83 mg Z-acceleration: 1000.67 mg 
X-gyro rate: -0.114 degrees/sec Y-gyro rate: 0.099 degrees/sec Z-gyro rate: -0.038 degrees/sec
X-mag field: -5.45 mG Y-mag field: -29.14 mG Z-mag field: 49.20 mG
Temperature is 26.3 degrees C
X-acceleration: -48.65 mg Y-acceleration: -0.24 mg Z-acceleration: 1002.08 mg 
X-gyro rate: -0.015 degrees/sec Y-gyro rate: 0.168 degrees/sec Z-gyro rate: -0.038 degrees/sec
X-mag field: -7.26 mG Y-mag field: -9.11 mG Z-mag field: 43.93 mG
Temperature is 26.3 degrees C
X-acceleration: -47.79 mg Y-acceleration: 1.34 mg Z-acceleration: 1001.04 mg 
X-gyro rate: -0.008 degrees/sec Y-gyro rate: 0.252 degrees/sec Z-gyro rate: -0.061 degrees/sec
X-mag field: -3.63 mG Y-mag field: -12.75 mG Z-mag field: 33.38 mG
Temperature is 26.3 degrees C
X-acceleration: -46.08 mg Y-acceleration: -1.83 mg Z-acceleration: 998.96 mg 
X-gyro rate: 0.008 degrees/sec Y-gyro rate: 0.084 degrees/sec Z-gyro rate: -0.053 degrees/sec
X-mag field: -7.26 mG Y-mag field: -16.39 mG Z-mag field: 47.44 mG
Temperature is 26.3 degrees C
X-acceleration: -44.80 mg Y-acceleration: 1.34 mg Z-acceleration: 998.35 mg 
X-gyro rate: -0.061 degrees/sec Y-gyro rate: 0.107 degrees/sec Z-gyro rate: -0.015 degrees/sec
X-mag field: -1.82 mG Y-mag field: -18.22 mG Z-mag field: 24.60 mG
Temperature is 26.3 degrees C
X-acceleration: -48.95 mg Y-acceleration: 2.32 mg Z-acceleration: 998.72 mg 
X-gyro rate: -0.092 degrees/sec Y-gyro rate: 0.046 degrees/sec Z-gyro rate: -0.061 degrees/sec
X-mag field: 10.89 mG Y-mag field: -1.82 mG Z-mag field: 15.81 mG
Temperature is 26.3 degrees C
X-acceleration: -47.12 mg Y-acceleration: 1.46 mg Z-acceleration: 999.51 mg 
X-gyro rate: -0.038 degrees/sec Y-gyro rate: 0.214 degrees/sec Z-gyro rate: -0.099 degrees/sec
X-mag field: -1.82 mG Y-mag field: -18.22 mG Z-mag field: 35.14 mG
Temperature is 26.3 degrees C
X-acceleration: -45.23 mg Y-acceleration: 1.77 mg Z-acceleration: 1002.93 mg 
X-gyro rate: -0.092 degrees/sec Y-gyro rate: 0.069 degrees/sec Z-gyro rate: -0.015 degrees/sec
X-mag field: 7.26 mG Y-mag field: -1.82 mG Z-mag field: 40.41 mG
Temperature is 26.3 degrees C
X-acceleration: -46.88 mg Y-acceleration: 1.10 mg Z-acceleration: 999.39 mg 
X-gyro rate: -0.023 degrees/sec Y-gyro rate: 0.015 degrees/sec Z-gyro rate: 0.031 degrees/sec
X-mag field: 9.08 mG Y-mag field: -3.64 mG Z-mag field: 21.09 mG
Temperature is 26.3 degrees C
X-acceleration: -46.26 mg Y-acceleration: -0.18 mg Z-acceleration: 996.58 mg 
X-gyro rate: -0.061 degrees/sec Y-gyro rate: 0.191 degrees/sec Z-gyro rate: -0.069 degrees/sec
X-mag field: 0.00 mG Y-mag field: -16.39 mG Z-mag field: 50.96 mG
Temperature is 26.3 degrees C
X-acceleration: -45.23 mg Y-acceleration: 1.77 mg Z-acceleration: 1002.75 mg 
X-gyro rate: -0.069 degrees/sec Y-gyro rate: 0.214 degrees/sec Z-gyro rate: -0.069 degrees/sec
X-mag field: -3.63 mG Y-mag field: 5.46 mG Z-mag field: 54.47 mG
Temperature is 26.3 degrees C
X-acceleration: -45.53 mg Y-acceleration: 0.24 mg Z-acceleration: 998.60 mg 
X-gyro rate: -0.092 degrees/sec Y-gyro rate: 0.092 degrees/sec Z-gyro rate: 0.031 degrees/sec
X-mag field: -9.08 mG Y-mag field: -18.22 mG Z-mag field: 49.20 mG
Temperature is 26.3 degrees C
X-acceleration: -46.51 mg Y-acceleration: 0.49 mg Z-acceleration: 1000.79 mg 
X-gyro rate: -0.122 degrees/sec Y-gyro rate: 0.137 degrees/sec Z-gyro rate: -0.099 degrees/sec
X-mag field: -3.63 mG Y-mag field: -16.39 mG Z-mag field: 57.98 mG
Temperature is 26.3 degrees C
X-acceleration: -47.67 mg Y-acceleration: 2.14 mg Z-acceleration: 1002.08 mg 
X-gyro rate: -0.099 degrees/sec Y-gyro rate: 0.046 degrees/sec Z-gyro rate: 0.031 degrees/sec
X-mag field: 0.00 mG Y-mag field: -20.04 mG Z-mag field: 43.93 mG
Temperature is 26.3 degrees C
X-acceleration: -46.81 mg Y-acceleration: 0.73 mg Z-acceleration: 1000.37 mg 
X-gyro rate: 0.000 degrees/sec Y-gyro rate: 0.168 degrees/sec Z-gyro rate: 0.000 degrees/sec
X-mag field: 14.53 mG Y-mag field: -20.04 mG Z-mag field: 36.90 mG
Temperature is 26.3 degrees C
X-acceleration: -47.73 mg Y-acceleration: 1.22 mg Z-acceleration: 1003.36 mg 
X-gyro rate: 0.008 degrees/sec Y-gyro rate: 0.031 degrees/sec Z-gyro rate: -0.069 degrees/sec
X-mag field: 7.26 mG Y-mag field: -5.46 mG Z-mag field: 36.90 mG
Temperature is 26.3 degrees C

example ahrs outputs:

Code: Select all

ax = -46.02 ay = -55.11 az = 930.18 mg
gx = -0.10 gy = 0.11 gz = -0.05 deg/s
mx = 1 my = 151 mz = 14 mG
q0 = 1.00 qx = -0.03 qy = 0.03 qz = -0.04
Yaw, Pitch, Roll: -13.22, 2.93, -3.52
rate = 239.05 Hz

ax = -48.46 ay = -58.90 az = 936.28 mg
gx = -0.14 gy = 0.18 gz = 0.05 deg/s
mx = 1 my = 151 mz = 28 mG
q0 = 1.00 qx = -0.03 qy = 0.03 qz = -0.05
Yaw, Pitch, Roll: -14.91, 2.92, -3.87
rate = 239.21 Hz

ax = -45.53 ay = -52.73 az = 946.47 mg
gx = -0.10 gy = 0.18 gz = 0.02 deg/s
mx = 5 my = 158 mz = 7 mG
q0 = 1.00 qx = -0.03 qy = 0.03 qz = -0.03
Yaw, Pitch, Roll: -12.59, 2.92, -3.44
rate = 239.07 Hz

ax = -48.28 ay = -56.03 az = 944.70 mg
gx = 0.00 gy = 0.15 gz = -0.17 deg/s
mx = 9 my = 162 mz = 7 mG
q0 = 1.00 qx = -0.03 qy = 0.03 qz = -0.03
Yaw, Pitch, Roll: -11.93, 2.95, -3.39
rate = 239.26 Hz

ax = -52.19 ay = -58.84 az = 929.38 mg
gx = -0.11 gy = 0.29 gz = -0.04 deg/s
mx = 5 my = 151 mz = 10 mG
q0 = 1.00 qx = -0.03 qy = 0.03 qz = -0.03
Yaw, Pitch, Roll: -11.55, 2.93, -3.44
rate = 240.35 Hz

ax = -48.34 ay = -56.95 az = 934.88 mg
gx = -0.10 gy = 0.19 gz = 0.03 deg/s
mx = 16 my = 162 mz = 17 mG
q0 = 1.00 qx = -0.03 qy = 0.03 qz = -0.04
Yaw, Pitch, Roll: -12.68, 2.97, -3.45
rate = 239.08 Hz

ax = -49.56 ay = -55.73 az = 937.99 mg
gx = -0.09 gy = 0.10 gz = -0.04 deg/s
mx = 12 my = 165 mz = 21 mG
q0 = 1.00 qx = -0.03 qy = 0.03 qz = -0.03
Yaw, Pitch, Roll: -12.29, 2.95, -3.52
rate = 237.73 Hz

ax = -45.59 ay = -54.69 az = 942.63 mg
gx = -0.03 gy = 0.17 gz = -0.06 deg/s
mx = 19 my = 154 mz = 28 mG
q0 = 1.00 qx = -0.03 qy = 0.03 qz = -0.02
Yaw, Pitch, Roll: -10.37, 2.93, -3.52
rate = 239.00 Hz

ax = -48.28 ay = -55.66 az = 936.28 mg
gx = -0.09 gy = 0.22 gz = 0.05 deg/s
mx = -10 my = 153 mz = 29 mG
q0 = 1.00 qx = -0.03 qy = 0.03 qz = 0.01
Yaw, Pitch, Roll: -6.97, 2.94, -3.65
rate = 239.19 Hz

ax = -48.71 ay = -55.05 az = 937.62 mg
gx = -0.07 gy = 0.20 gz = 0.05 deg/s
mx = 1 my = 140 mz = 35 mG
q0 = 1.00 qx = -0.03 qy = 0.03 qz = -0.04
Yaw, Pitch, Roll: -12.95, 2.94, -3.75
rate = 238.96 Hz

ax = -47.91 ay = -56.21 az = 937.50 mg
gx = -0.05 gy = 0.19 gz = -0.02 deg/s
mx = 1 my = 140 mz = 17 mG
q0 = 1.00 qx = -0.03 qy = 0.03 qz = -0.03
Yaw, Pitch, Roll: -11.92, 2.93, -3.49
rate = 239.08 Hz

ax = -47.91 ay = -55.11 az = 935.85 mg
gx = -0.07 gy = 0.03 gz = -0.07 deg/s
mx = 0 my = 142 mz = 15 mG
q0 = 1.00 qx = -0.03 qy = 0.03 qz = -0.02
Yaw, Pitch, Roll: -10.80, 2.96, -3.54
rate = 240.70 Hz

ax = -50.11 ay = -58.23 az = 938.35 mg
gx = -0.05 gy = 0.22 gz = -0.06 deg/s
mx = 18 my = 160 mz = 1 mG
q0 = 1.00 qx = -0.03 qy = 0.03 qz = -0.04
Yaw, Pitch, Roll: -13.33, 2.94, -3.57
rate = 239.08 Hz

ax = -46.20 ay = -55.91 az = 936.40 mg
gx = -0.03 gy = 0.16 gz = -0.01 deg/s
mx = 25 my = 153 mz = 8 mG
q0 = 1.00 qx = -0.03 qy = 0.03 qz = -0.04
Yaw, Pitch, Roll: -12.86, 2.92, -3.46
rate = 238.78 Hz

ax = -47.42 ay = -53.77 az = 938.84 mg
gx = -0.09 gy = 0.10 gz = -0.01 deg/s
mx = 1 my = 169 mz = 14 mG
q0 = 1.00 qx = -0.03 qy = 0.03 qz = -0.01
Yaw, Pitch, Roll: -9.53, 2.93, -3.56
rate = 238.01 Hz

ax = -49.68 ay = -55.05 az = 937.38 mg
gx = 0.00 gy = 0.21 gz = 0.02 deg/s
mx = 10 my = 163 mz = 19 mG
q0 = 1.00 qx = -0.03 qy = 0.03 qz = -0.02
Yaw, Pitch, Roll: -10.53, 2.98, -3.77
rate = 239.09 Hz

ax = -48.22 ay = -55.24 az = 934.81 mg
gx = -0.05 gy = 0.18 gz = 0.02 deg/s
mx = 1 my = 169 mz = 31 mG
q0 = 1.00 qx = -0.03 qy = 0.03 qz = -0.02
Yaw, Pitch, Roll: -11.35, 2.94, -3.53
rate = 240.90 Hz

ax = -47.00 ay = -56.03 az = 939.51 mg
gx = -0.05 gy = 0.19 gz = -0.06 deg/s
mx = -1 my = 158 mz = 35 mG
q0 = 1.00 qx = -0.03 qy = 0.03 qz = -0.02
Yaw, Pitch, Roll: -10.62, 2.89, -3.64
rate = 239.10 Hz

ax = -45.10 ay = -56.95 az = 939.15 mg
gx = 0.04 gy = 0.14 gz = -0.06 deg/s
mx = -1 my = 154 mz = 28 mG
q0 = 1.00 qx = -0.03 qy = 0.03 qz = -0.02
Yaw, Pitch, Roll: -11.30, 2.91, -3.77
rate = 238.99 Hz

ax = -46.26 ay = -56.27 az = 938.72 mg
gx = 0.05 gy = 0.19 gz = -0.07 deg/s
mx = 12 my = 169 mz = 17 mG
q0 = 1.00 qx = -0.03 qy = 0.03 qz = -0.04
Yaw, Pitch, Roll: -13.00, 2.93, -3.44
rate = 238.82 Hz

ax = -48.03 ay = -54.93 az = 941.83 mg
gx = -0.07 gy = 0.24 gz = -0.03 deg/s
mx = 25 my = 149 mz = 12 mG
q0 = 1.00 qx = -0.03 qy = 0.03 qz = -0.07
Yaw, Pitch, Roll: -16.46, 2.94, -3.39
rate = 239.02 Hz

ax = -47.12 ay = -54.08 az = 944.09 mg
gx = -0.05 gy = 0.17 gz = -0.10 deg/s
mx = 10 my = 160 mz = 22 mG
q0 = 1.00 qx = -0.03 qy = 0.03 qz = -0.03
Yaw, Pitch, Roll: -11.60, 2.92, -3.61
rate = 238.57 Hz

ax = -49.32 ay = -55.79 az = 936.95 mg
gx = -0.06 gy = 0.27 gz = 0.02 deg/s
mx = 12 my = 154 mz = 10 mG
q0 = 1.00 qx = -0.03 qy = 0.03 qz = -0.04
Yaw, Pitch, Roll: -12.75, 2.97, -3.46
rate = 239.10 Hz

ax = -49.74 ay = -57.43 az = 935.24 mg
gx = 0.00 gy = 0.19 gz = 0.05 deg/s
mx = 10 my = 160 mz = 26 mG
q0 = 1.00 qx = -0.03 qy = 0.03 qz = -0.02
Yaw, Pitch, Roll: -10.39, 2.94, -3.33
rate = 238.10 Hz

ax = -49.26 ay = -58.23 az = 939.64 mg
gx = -0.14 gy = 0.21 gz = -0.05 deg/s
mx = 10 my = 153 mz = 12 mG
q0 = 1.00 qx = -0.03 qy = 0.03 qz = -0.02
Yaw, Pitch, Roll: -11.21, 2.96, -3.65
rate = 239.06 Hz

ax = -47.12 ay = -57.01 az = 937.99 mg
gx = 0.02 gy = 0.18 gz = 0.01 deg/s
mx = 12 my = 151 mz = 38 mG
q0 = 1.00 qx = -0.03 qy = 0.03 qz = -0.04
Yaw, Pitch, Roll: -13.57, 2.91, -3.31
rate = 239.16 Hz

ax = -47.67 ay = -55.91 az = 940.31 mg
gx = -0.02 gy = 0.18 gz = 0.02 deg/s
mx = 14 my = 149 mz = 22 mG
q0 = 1.00 qx = -0.03 qy = 0.03 qz = -0.05
Yaw, Pitch, Roll: -14.27, 2.95, -3.45
rate = 239.19 Hz

ax = -48.16 ay = -54.69 az = 936.65 mg
gx = -0.11 gy = 0.20 gz = -0.08 deg/s
mx = 10 my = 156 mz = 8 mG
q0 = 1.00 qx = -0.03 qy = 0.03 qz = -0.05
Yaw, Pitch, Roll: -13.90, 2.95, -3.42
rate = 240.15 Hz

ax = -48.52 ay = -59.33 az = 938.54 mg
gx = -0.11 gy = 0.23 gz = 0.06 deg/s
mx = 16 my = 162 mz = 38 mG
q0 = 1.00 qx = -0.03 qy = 0.03 qz = -0.03
Yaw, Pitch, Roll: -12.12, 2.94, -3.56
rate = 237.58 Hz

ax = -47.85 ay = -55.97 az = 934.57 mg
gx = -0.04 gy = 0.26 gz = -0.05 deg/s
mx = 0 my = 145 mz = 8 mG
q0 = 1.00 qx = -0.03 qy = 0.03 qz = -0.02
Yaw, Pitch, Roll: -10.93, 2.94, -3.41
rate = 239.15 Hz

ax = -48.77 ay = -57.37 az = 941.77 mg
gx = -0.09 gy = 0.30 gz = -0.02 deg/s
mx = 21 my = 156 mz = 12 mG
q0 = 1.00 qx = -0.03 qy = 0.03 qz = -0.04
Yaw, Pitch, Roll: -12.95, 2.94, -3.43
rate = 240.64 Hz

ax = -49.56 ay = -57.43 az = 936.58 mg
gx = -0.02 gy = 0.19 gz = -0.10 deg/s
mx = 9 my = 158 mz = 7 mG
q0 = 1.00 qx = -0.03 qy = 0.03 qz = -0.02
Yaw, Pitch, Roll: -11.20, 2.93, -3.54
rate = 239.65 Hz

ax = -49.38 ay = -55.91 az = 936.77 mg
gx = -0.06 gy = 0.18 gz = -0.04 deg/s
mx = 1 my = 158 mz = 10 mG
q0 = 1.00 qx = -0.03 qy = 0.03 qz = -0.02
Yaw, Pitch, Roll: -10.58, 2.94, -3.52
rate = 239.21 Hz

ax = -47.00 ay = -55.18 az = 936.77 mg
gx = -0.04 gy = 0.24 gz = -0.07 deg/s
mx = 10 my = 145 mz = 33 mG
q0 = 1.00 qx = -0.03 qy = 0.03 qz = -0.04
Yaw, Pitch, Roll: -13.45, 2.97, -3.38
rate = 240.57 Hz

ax = -50.72 ay = -56.70 az = 935.67 mg
gx = -0.05 gy = 0.14 gz = -0.14 deg/s
mx = 5 my = 158 mz = 31 mG
q0 = 1.00 qx = -0.03 qy = 0.03 qz = -0.02
Yaw, Pitch, Roll: -10.48, 2.96, -3.43
rate = 239.13 Hz
i am not sure if i have better results with rtimu or this one, i should make some test but really i am a little bit bored. So i think i will use this library since people who understand more than me (like Squonk42) about this topic said that quaternion filters are better and i like the spi interface

aster
Posts: 110
Joined: Thu Mar 30, 2017 2:41 pm
Location: bella italy
Contact:

Re: MPU-6050 (I2C) Library

Post by aster » Mon Oct 09, 2017 12:37 pm

about the SPI: before moving to stm i am testing it with an arduino uno
connections:
mpu9250 - arduino
vcc-5v
gnd-gnd
scl- 13
ad0-12
sda-11
ncs-10

i am not convincet by this code:

Code: Select all

uint8_t MPU9250::readBytesSPI(uint8_t registerAddress, uint8_t count,
                           uint8_t * dest)
{
  SPI.beginTransaction(SPISettings(SPI_DATA_RATE, MSBFIRST, SPI_MODE));
  select();

  SPI.transfer(registerAddress | READ_FLAG);

  uint8_t i;

  for (i = 0; i < count; i++)
  {
    dest[i] = SPI.transfer(0x00);
#ifdef SERIAL_DEBUG
    Serial.print("readBytesSPI::Read byte: 0x");
    Serial.println(dest[i], HEX);
#endif
  }

  SPI.endTransaction();
  deselect();

  delayMicroseconds(50);

  return i; // Return number of bytes written}
same for writing

Code: Select all

uint8_t MPU9250::writeByteSPI(uint8_t registerAddress, uint8_t writeData)
{
  uint8_t returnVal;

  SPI.beginTransaction(SPISettings(SPI_DATA_RATE, MSBFIRST, SPI_MODE));
  select();

  SPI.transfer(registerAddress);
  returnVal = SPI.transfer(writeData);

  deselect();
  SPI.endTransaction();
  /*
#ifdef SERIAL_DEBUG
  Serial.print("MPU9250::writeByteSPI slave returned: 0x");
  Serial.println(returnVal, HEX);
#endif
*/
  return returnVal;
}
why it begin and end the spi comunication for every few bytes? or is it normal? :?:

stevestrong
Posts: 1829
Joined: Mon Oct 19, 2015 12:06 am
Location: Munich, Germany

Re: MPU-6050 (I2C) Library

Post by stevestrong » Mon Oct 09, 2017 1:27 pm

aster wrote:
Mon Oct 09, 2017 12:37 pm
why it begin and end the spi comunication for every few bytes? or is it normal? :?:
Well, define "normal" first... ;)
One can do it if the SPI port is shared with other peripherals. Otherwise is not needed, is enough to do it once in setup() or begin().

Post Reply