Skip to main content
Visitor II
November 14, 2021
Solved

Orientation string when MEMS on bottom layer

  • November 14, 2021
  • 4 replies
  • 1446 views

Hello,

In my application, I must place the MEMS in the bottom layer. When looking from top layer, the pin mark is in the upper right as shown below. What would be correct string for gyro and accelerometer into X-CUBE-MEMS algorithms? Thanks.

0693W00000GXUjfQAH.png

    This topic has been closed for replies.
    Best answer by BSaraiva

    JDave, I wanted to check this post for any answers just to see how others are addressing this subject.

    I don't have a direct answer because I don't know what you mean by "correct string", but any 3D sensor application must be implemented with a 3D rotation matrix concept. In a proper system, your sensor can be pretty much in any position (even inclined at weird angles from your horizontal reference), and there will always be a rotation matrix to bring the dynamic values into your preferred reference system.

    On a separate subject, may I suggest that you include part numbers on your question? Nowhere in your post we know which sensor you are actually referring to.

    Regards

    Bruno

    4 replies

    JDave.4Author
    Visitor II
    November 15, 2021

    Any ideas?

    BSaraivaAnswer
    Visitor II
    November 16, 2021

    JDave, I wanted to check this post for any answers just to see how others are addressing this subject.

    I don't have a direct answer because I don't know what you mean by "correct string", but any 3D sensor application must be implemented with a 3D rotation matrix concept. In a proper system, your sensor can be pretty much in any position (even inclined at weird angles from your horizontal reference), and there will always be a rotation matrix to bring the dynamic values into your preferred reference system.

    On a separate subject, may I suggest that you include part numbers on your question? Nowhere in your post we know which sensor you are actually referring to.

    Regards

    Bruno

    JDave.4Author
    Visitor II
    November 17, 2021

    The part number is LSM6DS3, I have already provided axis info for this product. Orientation string is used as input to the motion algorithms in the X-CUBE-MEMS. Since the IC mounted at bottom side, it needs to be adjusted. I am not sure how to modif them. Any comments?

     diKnobs.AccOrientation[0] = 'e';

     diKnobs.AccOrientation[1] = 'n';

     diKnobs.AccOrientation[2] = 'u';

     diKnobs.GyroOrientation[0] = 'e';

     diKnobs.GyroOrientation[1] = 'n';

     diKnobs.GyroOrientation[2] = 'u';

    Visitor II
    November 17, 2021

    Ok, understood. I don't particularly like these "magic macros" solutions. When you have a chance, do spend some time learning about rotation matrix, and all that comes with IMU orientation. And try to follow a widely used orthogonal reference for your project, otherwise in the future it will become a mess to integrate with other "more professional" projects. NED is one that is common.

    But for now, making things simple: just visualize the readings from your accelerometers. You want approximately +1g in your vertical axis when the product is sitting level. If you get the opposite value, probably changing the magic letter will do the trick (you are probably aware that e, n, u stand for east, north and up, so d for down will be an option).

    Good luck!

    JDave.4Author
    Visitor II
    November 17, 2021

    It is easy to determine positive axes for acc. but what about gyro? They need to be correctly aligned with acc. otherwise the algorithm may not work properly.

    Visitor II
    November 17, 2021
    Correct: the gyro must have exactly the same orientation that you use for the accelerometer.