I saw lot of topics with the same title but answers are different.

I have a magnetometer in my phone which give me the components of magnetic field in direction of X, Y, Z.

If my phone lays on a table the 'z' axis points up. (see the picture below). The values of magnetometer are: ~15 microT in X direction, ~8 microT in Y direction and ~-55 microT in Z direction. axis

Which of the following angles can be determined using datas of magnetometer? Roll, pitch, yaw? And how?

Thank you, Robert

  • 1
    Welcome to Robotics, Róbert Rádi. Could you please provide a diagram or drawing of your setup? Please include the orientation of the sensor/phone, showing which directions the axes are pointing; your definition of what roll, pitch, and yaw are; and in which plane the magnetic field exists. This diagram should be enough for you to answer your own question, but please do edit your question to include the diagram if it's not. I don't know if your phone's z-axis points up when the phone is held upright, like on a call, or if z is up when the phone is laid on its back, or something else. – Chuck Oct 1 at 13:11
  • Dear Chuck, I have edited my post. I hope this helps you all to understand my problem! – Róbert Rádi Oct 3 at 12:58

Usually the magnetometer is used to find the yaw. It acts as a digital compass in this case. To calculate roll and pitch you need an accelerometer. But there are some techniques that can be used to calculate the roll and pitch using the magnetometer. For that you need to place a magnet close to the mobile phone and observe the sensor values. Using these values you can calculate the roll and pitch with respect to the position of the magnet. You may find the necessary equations from the following link.

https://www.dfrobot.com/wiki/index.php/How_to_Use_a_Three-Axis_Accelerometer_for_Tilt_Sensing

  • Dear Tharindu Suraj! Thank you for your answer. But as I see, the link you suggested gives just information about how to calculate roll, pitch using an accelerometer. Do you have any ideas where could I find the description of method you mentioned? – Róbert Rádi Oct 10 at 7:55
  • I assume that you understand the basic principle which is used to calculate the roll and pitch. Basically it uses the gravitational acceleration measurements on x,y and z axes to calculate the rotation from the neutral position where Az = 9.8ms-2. Using the same principle, taking the magnetic field into account you can calculate the roll and pitch. I couldn't find any sources related to this. This is just an idea I came up before. – Tharindu Suraj Oct 11 at 10:18

Your Answer

 

By clicking "Post Your Answer", you acknowledge that you have read our updated terms of service, privacy policy and cookie policy, and that your continued use of the website is subject to these policies.

Not the answer you're looking for? Browse other questions tagged or ask your own question.