(HMC5883L) How to calculate strength of magnetic field?

Hi all,

I've been reading through the example code provided for this sensor (the testing demo) and I'm following how to get the respective angles for where the magnetic source is coming from; however, I haven't the faintest how I can calculate the strength for each respective axis.

I'm new to Arduino stuff but I'm trying to make it so a my Uno can take the values from the sensor, detect which direction the strongest magnetic field is coming from, and head towards that direction. The demo explains how we get our angles, but can someone help point me where I need to look for getting the strength working?

The data sheet for the device gives a conversion factor (often called sensitivity factor) that allows calculation of the results in standard units.

Magnetometers MUST be calibrated to be useful, also mentioneded in the data sheet, or see this overview.

The datasheet , page 11 shows the registers CRA/CRB/MR @ adress 0/1/2

Control Register B is used to set sensivity. If u set all GN2,GN1,GN0 to zero, the range is set to +/- 0.88Gauss
A reading of 1370 is equal to 1Ga magn. field.

Posision your sensor horisontally. x and y-axis reflects horisontal field, z .. vertical field

Total field is found using pythagoras

Thanks to all replies. Is there some example code that exists to see how to calculate the strength value?

sqrt(x*x+y*y+z*z)