Cardinal points with eCompass

cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 

Cardinal points with eCompass

1,826 Views
nikivendola
Contributor III

Hello everyone,
I found the following document on the implementation of eCompass:

http://cache.freescale.com/files/sensors/doc/app_note/AN4248.pdf


The described algorithm allows to find ways of movement of the three corners.
But how do I figure out which cardinal point is addressed?
Is there a document that explains it?

 

Thanks for any help

Labels (1)
Tags (2)
8 Replies

1,287 Views
michaelestanley
NXP Employee
NXP Employee

I'm not sure I 100% understand your question, but let me take a stab at it...

You ask "which cardinal point"... I believe the answer is "ALL of them".  Whatever your device is, we assume it is a rigid body, and all axes rotate together.

Also, if you haven't already, I strongly suggest you download the sensor fusion library from nxp.com/sensorfusion. For eCompass to work properly, you really want access to our full magnetic calibration library.  Both are included as in the fusion library.

Regards,

Mike

0 Kudos

1,287 Views
nikivendola
Contributor III

Excuse me, I'll send a new message because I can not change my answer.

V the inverse revenue of eqn. 23.
The problem is where I have to read B.

It seems to me that the document tells me that I have to read the following site:
http://wdc.kugi.kyoto-u.ac.jp/igrf/

But where?
Can you give me an example with B relative to a zone.

Thank you and greetings.

0 Kudos

1,287 Views
michaelestanley
NXP Employee
NXP Employee

It would help if you told us a bit more of what you are trying to do.

Are you attempting to write your own magcal code?

Are you attempting to use Freescale's standalone magnetic calibration?

Are you using NXP's Sensor Fusion library which incorporates magnetic calibration?

Regardless, you do not "look up" V or B.  You compute them from measured values and knowledge of the way the fields work.  See "Magnetometer Autocalibation Leveraging Measurement Locus Constraints" by Dr. Demoz Gebre-Egziabher in the July-August 2008 Journal of Aircraft for a theoretical background on the topic.

If using Freescale's standalone magnetic calibration, we recommend you upgrade to our sensor fusion integrated version.  The standalone version is no longer supported.

If already using the NXP sensor fusion library, you don't need to deal with any of this.  It is already taken care of for you.  You simply read the calibrated sensor readings as described in section 3.3.2 of the Version 5.00 sensor fusion user guide.

If you are using the sensor fusion library, and truly want to know the hidden details, look at magnetic.h in the source directory of any of the FSFK examples in the kit.  struct MagCalibration contains what you are after.

Regards,

Mike

0 Kudos

1,287 Views
nikivendola
Contributor III

Hi,
Sorry for the delayed response but I thought I had found the way but I still have doubts.

I try to explain better.
I have a self-produced board with Freescale components, I am not referring to any card or your program.

I found the document in question and I thought that the algorithm therein is sufficient to implement a eCompass.

I thought I would use the one in C # suitably modified for C.

Only I miss the value of V. I have not figured out how I return the value of V.

Do you have other suggestions?

Thank you and greetings

0 Kudos

1,287 Views
michaelestanley
NXP Employee
NXP Employee

V is the hard iron offset.  If you take many, many, measurements from your magnetometer, while rotating it in all directions in 3-dimensional space, then plot the points, you will get a 3D ellipsoid.  V is the 3D coordinate of the center of that ellipsoid.  We get it in our software, along with soft iron components, by doing a full least squares fit to a rather complex equation.  If you want only hard iron offsets, you could simply take the average of all those points (crude), or fit to an ellipsoid and take the center of that (better).

1,287 Views
nikivendola
Contributor III

I used the algorithm that I found in this document.
http://cache.freescale.com/files/sensors/doc/app_note/AN4248.pdf


To calculate the V B I used to correct the final part of this document.
http://www.nxp.com/files/sensors/doc/app_note/AN4246.pdf
I get the value of this type:
iPhi:-52;

iThe: 29;

iPsi: -12440.

In your opinion they are correct? Ie the order of magnitude is possible?
Now how do I build virtual compass?
I can contact in private perhaps to e-mail?

Thank you and greetings

0 Kudos

1,287 Views
michaelestanley
NXP Employee
NXP Employee

Are these intended to be magnetic offsets or angles?  If the former, then -12440 seems way too big.  If angles, then you should be in the range of 0 to 360.  You can contact me at Mike.Stanley@nxp.com.  I would still ask, why are you not using the eCompass example in the V5.00 Sensor Fusion code at nxp.com/sensorfusion?  It does everything for you.

1,287 Views
nikivendola
Contributor III

Ok,

I wanted to ask where I have to read the values for the component V to correct the Hard-Iron effect.

That is, if you look at the eqn. 23 of page 9 of the link
to the previous document sees that it is composed of 3 terms:

- Bp which is the value measured by the magnetometer,

- V which is the correction factor Hard-Iron,

- B which is the correct value of the magnetic field from the value of Hard -Iron.

I only know Bp, the value V where is it?

Thanks again.

0 Kudos