MinIMU-9 v5 unstable Gyro reading

Hello,
I’ve been trying to get the correct gyro reading based on the information from the site.
MCU is teensy3.2 and are connected as is supposed.
I calibrated the sensor with the example code from LIS3MDL library.
Then downloaded the the example code from below and changed min. max. values with the ones that I got from the calibration example.


Of course I uncommented //#define IMU_V5.
Then I get propper angle value(-180~180) reading at the third from the serial monitor.
But It is not tilt compensated. As soon as I tilt or roll, the angle goes wrong.
And the both gyro data(roll and pitch) are jumping around.
The accelerometer data is correct.
Will you guide me to solve this problem?

Thanks, jun

Hello.

How are you viewing the gyro and acceleration data (the AHRS program does not output those values by default)? Can you run the Serial example sketches from our LSM6 and LIS3MDL Arduino libraries and post the output from each of them?

Brandon

At first I want to ask you what is the output of the two values from AHRS program. I assumed the first two are absolute values of roll and pitch depending on the angle. If not so, how can I get them?
What I get from the AHRS default setting is continuous but is not absolute angle value that I expected.
You may checkout the video below of the default AHRS program serial output.

Here’s Serial monitor output of LSM6 serial example while the unit stays still.

A: 1609 -49 16487 G: 264 -198 -375
A: 1644 -53 16526 G: 215 -174 -509
A: 1625 -35 16447 G: 237 -81 -448
A: 1578 12 16531 G: 205 -174 -415
A: 1635 -43 16715 G: 235 -72 -435
A: 1656 -104 16788 G: 229 -150 -442
A: 1646 -30 16376 G: 266 -252 -763
A: 1688 -8 16594 G: 6 -117 -491
A: 1592 -76 16577 G: 253 -141 -498
A: 1686 -36 16535 G: 263 -213 -509
A: 1646 34 16560 G: 176 -75 -444
A: 1399 -16 16647 G: 238 -279 -271
A: 1661 -11 16683 G: 241 -198 -486
A: 1751 -21 16811 G: 181 -354 -585
A: 1676 -96 16788 G: 79 -11 -422
A: 1719 3 16644 G: 275 -194 -496
A: 1633 -21 16603 G: 203 -165 -727
A: 1653 235 16712 G: 232 -63 -352
A: 1721 -71 16552 G: 235 -142 -387
A: 1664 -58 16548 G: 267 -165 -509
A: 1648 -26 16459 G: 264 -97 -432
A: 1562 94 16480 G: 248 -188 -371
A: 1655 247 16471 G: 119 -92 -423
A: 1734 -10 16668 G: 224 -173 -406
A: 1673 22 16735 G: 304 -255 -466
A: 1689 -31 16755 G: 488 -306 -549
A: 1562 -58 16533 G: 201 -88 -404
A: 1662 -56 16528 G: 313 -242 -506
A: 1681 7 16488 G: 226 -243 -502
A: 1642 -95 16788 G: 182 -132 -473
A: 1592 -58 16643 G: 16 -88 -438
A: 1704 56 16575 G: 125 -84 -438
A: 1702 -62 16411 G: 145 -6 -340

Here’s output of LIS3MDL while the sensor stays still.

M: 2556 -1815 941
M: 2533 -1831 942
M: 2531 -1822 923
M: 2515 -1844 921
M: 2516 -1830 941
M: 2557 -1845 959
M: 2546 -1827 951
M: 2525 -1819 896
M: 2570 -1836 918
M: 2520 -1851 926
M: 2548 -1838 882
M: 2543 -1811 901
M: 2540 -1806 882
M: 2542 -1821 897
M: 2572 -1824 903
M: 2537 -1843 888
M: 2544 -1833 897
M: 2496 -1820 905
M: 2527 -1827 913
M: 2514 -1795 926
M: 2526 -1807 910
M: 2524 -1849 950
M: 2517 -1857 922
M: 2524 -1836 937
M: 2529 -1816 933
M: 2521 -1802 929
M: 2541 -1842 908
M: 2529 -1826 898
M: 2534 -1833 939
M: 2536 -1834 935
M: 2517 -1830 960
M: 2561 -1830 912
M: 2517 -1844 925

Thank you for posting the video and output you are getting. The output of the AHRS code is dependent on how PRINT_DCM, PRINT_ANALOGS, and PRINT_EULER are defined. The example AHRS code sets PRINT_DCM and 'PRINT_ANALOGS` to 0 and ‘PRINT_EULER’ to 1, so the output is [roll, pitch, yaw], where roll is rotation about the x-axis, pitch is rotation about the y-axis, and yaw is rotation about the z-axis. You can see the definition of these axes in relation to the board in this picture:

I noticed you have the component-side of the board facing upwards. Did you assign the associated “SENSOR_SIGN” definition for that orientation as described in the comments of the AHRS example code (e.g. commenting out line 41 and uncommenting line 49)? If not, could you try doing that and seeing if that fixes the problem?

Additionally, you should also make sure it is sitting on a level surface and not moving for a few seconds while the AHRS program is starting up.

Brandon

Yes, it was the SENSOR_SIGN issue. I corrected and now it works like charm!!!
Thank you very much for your kind efforts!
Best jun