Skip to main content
Visitor II
May 25, 2021
Question

Offset cancellation procedure with LSM303AGR.

  • May 25, 2021
  • 3 replies
  • 1341 views

I can't figure out the right implementation of LSM303AGR offset cancellation with single measurement mode. If I set to 1 OFF_CANC an OFF_CANC_ONE_SHOT in CFG_REG_B_M, then I have to do 2 readings and apply the Offset cancellation formula? The SET / RESET pulses automatically alternate with each other on every reading?

    This topic has been closed for replies.

    3 replies

    ST Employee
    May 27, 2021

    Hi @LCenn.1​ ,

    when you use single read you have to apply the cancellation formula yourself, just as you said.

    but you don't have to make 2 different measurements: the H(n-1) is the previous measurement.

    as the application note says, the more these 2 measurements are distant, the more the offset drift can be large.

    so for the first measure, you should not apply the formula, but for the next ones you should.

    hope I was clear enough

    Niccolò

    p.s. if you found a solution to your problem, please, select a best answer to help other users with similar issues

    LCenn.1Author
    Visitor II
    June 7, 2021

    I understand your instruction, but there are still aspects that are not clear to me:

    a) a distance of seconds (1-5s) between single measurements is capable of causing significant offset variations?

    b) what the "SET/RESET pulse" means? Are we talking about the polarity of the measurement bridge polarization?

    c) what is the cause of the offset?

    This analisys became necessary when we noticed that the sensor does not seem to correctly detect its rotation within the earth's magnetic field. Rotation is detected, but it often happens that when the original position is restored, the data read does not return to the expected values. The same happens by exposing the sensor to an external magnetic field (magnet) and then removing it.

    Looking at the offset problem, are we looking in the right direction?

    Regards,

    Lorenzo

    ST Employee
    June 8, 2021

    Hi Lorenzo @LCenn.1​ ,

    before replying to your question individually let me ask you:

    did you try to use the precompiled libraries to calibrate the magnetometer?

    you can check this Application Note for more details

    Let me know if this helps

    Niccolò