Go Down

Topic: [SOLVED] Obtaining Magnetic Declination (Read 3 times) previous topic - next topic

Bob101

Oct 20, 2012, 11:49 pm Last Edit: Oct 22, 2012, 12:26 am by Bob101 Reason: 1
I have been working on a mobile project that needs to know the direction of true north.

I am using the Venus GPS from Sparkfun which according to the datasheet does not populate the declination field.

The alternative seems to be to try to compute the declination and then use a compass to find magnetic north. I own the Pololu LSM303DLH. I am using an Arduino Mega 2560 so I imagine I have enough room to do this quite accurately even with the rest of the code for the project. Does a library for computing magnetic declination exist for the Arduino?

Failing that I notice that there are libraries for this written in C, for example, NOAA's World Magnetic Model software. The code itself does not seem to vast, 4000 lines of mostly comments and printf statements along with a 2kb coefficient file. Would it be unrealistic to try to include this library directly in an Arduino sketch (perhaps with some wrapping)?

I'm really not sure the best way to approach this but I would like to be able to reasonably accurately compute magnetic declination in and around Europe and Northern Africa for the next 3 -5 years and in a way that will be easy to update in the future. Any guidance?

holmes4

Quote
4000 lines of mostly comments and printf statements along with a 2kb coefficient file.


You only have 2k of data space in the uno so no chance. But the mega should be able to do this. You will need to strip out all the printfs and some /all the includes. You can't use stdio.h for example.

For the UK the difference between true and magnetic north is give on the OS maps and does not change over the 3/5 years you want.

Mark

MarkT

If the GPS can be oriented in line with the vehicle's axis and a magnetometer/compass (is there a vehicle?) then heading bearings can be used to calibrate the declination.  Assuming the compass has compensation for nearby iron masses...
[ I won't respond to messages, use the forum please ]

kg4wsv

Quote
You only have 2k of data space in the uno so no chance.


Wrong.  You have 32kb of program flash and the PROGMEM macro, so if your program will fit in the 30k left, no problem.

-j

mmcp42

I suspect you mean magnetic deviation (difference between true and magnetic North)
declination is the angle the local magnetic field makes with the horizontal
(I theenk!)
there are only 10 types of people
them that understands binary
and them that doesn't

Go Up