cancel
Showing results for 
Search instead for 
Did you mean: 

How to understand zero "Magnetic sensor offset" of LSM303AH?

A.R.f.
Associate II

LSM303AH's datasheet specifies "Magnetic sensor offset" equal to 0 mgauss. This requires offset cancellation to be enabled. How should this value be interpreted? Is this zero offset feasible only in some particular conditions? Then, what offset can be expected otherwise? Or, is this chip really capable of eliminating the offset on its own?

8 REPLIES 8
Miroslav BATEK
ST Employee

Offset cancellation removes the intrinsic sensor offset.

If there is hard-iron distortion (magnetic object placed near the magnetometer) it should be compensated by an external processor.

For more details check chapters 8 and 9 in the application note AN5087.

https://www.st.com/content/ccc/resource/technical/document/application_note/group0/a1/68/64/1e/b0/26/44/fb/DM00437054/files/DM00437054.pdf/jcr:content/translations/en.DM00437054.pdf

A.R.f.
Associate II

Thank you for the answer. Could you, please, also shed some light on what are the "set and reset pulse in the magnetic sensor"?

Miroslav BATEK
ST Employee

You can have a look at chapter Set/Reset Strap in this document: https://www.sparkfun.com/datasheets/IC/HMC105X.pdf

A.R.f.
Associate II

Thank you for recommendation of literature on the subject. If I understand the description correctly, then, assuming that set and reset pulses are the same, this technique allows to remove residual magnetization of the sensor and to remove offset only with no external magnetic field applied. Hence, it is useless in presence of geomagnetic field. Is that so, or did I miss something important? Please, let me know what is the case and, if I'm wrong, I would appreciate an additional explanation.

Miroslav BATEK
ST Employee

I think you understanding is correct.

To eliminate influence of  the surroundings of a magnetometer you can use our MotionMC magnetometer calibration library.

https://www.st.com/content/ccc/resource/technical/document/user_manual/group0/dc/4f/b0/4d/e3/41/4f/4b/DM00382798/files/DM00382798.pdf/jcr:content/translations/en.DM00382798.pdf

A.R.f.
Associate II

Thank you for the explanation. However, if that is the case, then the zero offset specified in the datasheet is very misleading, as it is relevant only in environment with magnetic shielding. Does ST have data on what is the offset of LSM303AH without this "offset cancellation"?

In this case my customer has selected a processor of other brand and I won't be able to change that. Still, such general calibration, as also recommended for MotionMC, would be very problematic here, if not just impossible. I think the only possibility would be to do such full calibration before the device gets delivered to the end user. Is there any chance that this calibration would be valid in long term, even neglecting HI, or other interference in final location?

Miroslav BATEK
ST Employee

I don't think it is misleading, the sensor itself has zero offset. It is not possible to automatically remove external magnetic field, the sensor doesn't know what is wanted and unwanted magnetic field.

I don't know what is your target application, but Hard Iron and Soft Iron error is given by the near surroundings of the sensor. So the calibration can be done during manufacturing process and will be valid in long term. It would be better to discuss your particular case with our marketing or FAE, because I don't know what is the purpose of your device, what will be environment, ...

Btw, if you buy ST sensors we can provide you MotionMC library also for other MCU.

A.R.f.
Associate II

I need to go into the details then.

I understood that, according to the documentation, what offset cancelation does, is it makes two measurements:

H1 = Hoff + Hset

H2 = Hoff + Hreset = Hoff - Hset

Hset is magnetic field for "set pulse". Hreset is magnetic field for "reset pulse", Hreset = -Hset.

Hoff is the offset of measurement.

Now, by simple subtraction (H1-H2)/2, we can eliminate Hoff and get only Hset.

But, Hset is not the measured external field. It is generated internally in the chip, isn't it?

Thus, with external magnetic field Hext the measurements look rather like this:

H1' = Hext + Hoff + Hset

H2' = Hext + Hoff + Hreset

and there is no way to separate Hext from Hoff.

What maybe could be done, would be to first determine Hoff with no external magnetic field (in particular, no geomagnetic field) by averaging H1 and H2, and then, if this value was constant in time (didn't drift or age), it could be subtracted from each measurement. But why would documentation say that two (set/reset) measurements are necessary each time?

The only explanation I can see that would make sense would be if set/reset pulses effectively rotated the axes of the magnetometer, so that Hset = Hext and Hreset = -Hext, but the docs seem to tell something different, that Hset and Hreset are indepent from any external fields.

Could you, please, comment on that?