Tilt Compensation Azimuth ? with Pitch Ø et le Roll ?

March 19th, 2011 by jed Leave a reply »

Post to Twitter

A) Introduction

We need to calculate the Azimuth ? or its course. According to Wikipedia,the Azimuth or the course is the angle that the intended path of the boat makes with a fixed reference object (typically true north). Typically course is measured in degrees from 0° clockwise to 360° in compass convention (0° being north, 90° being east). Course is customarily expressed in three digits, using preliminary zeros if needed, e.g. 058°. This angle is measured using a compass, a magnetic compass or gyro.

The components that I have chosen to calculate my Azimuth:

HMC5843 magnetic compass is a three-axis magnetometer. It identifies the angle of rotation relative to the magnetic north of the Earth with a resolution of 7 milli-gauss.


The accelerometer AXL335 delivering voltages proportional to acceleration with a sensitivity: + / – 3 g.

B) Calculate Azimuth ? without compensation:

\psi = (180 *(\frac{atan2(-1 * YMagneto, XMagneto)}{pi}))+180;

This expression works if the HMC5843 is not tilted.

ps: Warning in Excel, you must reverse the values for atan2, it can save you time ….

You can download a sample program that demonstrates how to read a microcontroller ATMega328 HMC5843
Download: here

C) The angles Ø Pitch and Roll ? for a two-axis accelerometer and three axis:

With the ADXL335 accelerometer, it is possible to calculate the pitch Ø and Roll ? to correct our azimuth ?. Here is a scheme to visualize the angle on the boat.


For a two-axis accelerometer following equation:

\theta=\arcsin(Xaccel)*\frac{180}{pi}

\phi= \arcsin(Yaccel)*\frac{180}{pi}

For a three-axis accelerometer as the HMC5843 equation here:

\theta= \dfrac {atan(-Xaccel)} {\sqrt(Yaccel^2+Zaccell^2))}*\frac{180}{pi}

\phi= \dfrac {atan(Yaccel)}{\sqrt(Xaccel^2+Zaccel^2))}*\frac{180}{pi}

D) Azimuth ? tilt compensation :

The HMC5843 provides correct values if it is flat. So every time my boat will be tilted angle the rotation relative to magnetic north by the compass given no longer correct. It is possible to compensate for this error (tilt compensation) using the values of the compass and an accelerometer.

That compensation is also possible for two lines with the compass algorithm Yun Seong Cho and Chan Gook Park, which allows using the dip angle to estimate the third axis. You can download their work below

Download : TiltCompensation.pdf

For a two-axis magnetometer, you must calculate the dip angle to approximate the third axis Z.

To calculate :

\delta = \dfrac{1}{tan(2*tan(Latitude)}

ex:  \delta = \dfrac{1}{tan(2*tan(48.86213)} ) = 25.0112° ou 48.86213° coïncide avec ma latitude.

Compass for two axes, it is necessary to approximate the third axis Z by the value of the dip angle

Zmagneto = \dfrac {sin(\theta)+Xmc*sin(\theta)-Ymc*cos(\theta)*sin(\phi)} {cos(\phi)*cos(\theta) }

However, to get more accurate values, it is better to use a compass as the HMC5843 three axes.
To calculate the azimuth with compensation:

Horizontal vector : xh = x*cos(\theta)+y*sin(\phi)-z*cos(\theta)*sin(\theta);

Vertical vector : yh= y*cos(\phi)+z*sin(\phi);

Heading : \psi= arctan(-yh/xh)

Links : http://fr.wikipedia.org/wiki/Cap_%28navigation%29

Cette note est également disponible en: French

Advertisement

9 comments

  1. Derek says:

    Hi,

    Interesting project that you are working on. I’ve started playing with the HMC6343 and was looking up pitch, roll, azimuth and found your site. I was wondering if you guys have seen any simple sensors that do a good job of measuring depth of water?

    Thanks,

    Derek

  2. jed says:

    Thank you for your comment about my boat : – )

    Unfortunately, I have no advice to buy a sensor to measuring depth of water.

    You can maybe look this web site :
    http://njhurst.com/electronics/watersensor/new/

    Do you have a site web about project ? ( I’m curious )

    Good luck,

    Jed

  3. may says:

    Hi Jed,
    May I know for the three-axis accelerometer as the HMC5843 equation, the “Xaccel” value you used is raw value or any other forms of values? thanks!

  4. Trevor Masar says:

    Concise explaination a Statistician: A man who believes figures don’t lie, but admits than under analysis some of them won’t operate either.
    The task of the individual still remains to be the spark that moves mankind ahead much more than teamwork.

  5. Ahmed Mohamed says:

    Hello

    I am using a Magnetometer HCM5883L and i would like to use tilt compensation.

    My X-axis points forward (out of the screen) Y-axis to the left and Z-axis downwards.

    could you please help me with the equations.

  6. robot says:

    whats the diffrence between
    For a two-axis accelerometer following equation
    and
    For a three-axis accelerometer as the HMC5843 equation

  7. Diego says:

    Hello there!
    I have just got introduced to these tools (gyro, accelerometer and magnetometer) and I’m very interested on them.
    I bought this IMU, whichfrom I can get the values of x, y and z (for all those tools – acc, gyro and mag) and I was wondering how to get the IMU’s inclination and azimuth (suposing it is in a static state).
    I would very much appreciate if could help me getting more into this.
    Thank you.

  8. Osman Buran says:

    Hi,

    I have same problem with you. I tied to solve this problem using LSM303D but I cannot succeed also combine HMC5843 with MPU6060 and also LSM303D with MPU6050. Which accelerometer did you use? Can you share Arduino code sample?

Leave a Reply

Twitter links powered by Tweet This v1.8.1, a WordPress plugin for Twitter.