MAG3110 offset jumps

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

MAG3110 offset jumps

4,634 Views
dennisgallicchi
Contributor II

Dear community,

i'm using the magnetometer MAG3110 to monitoring the occupancy of parking places.

The algorithm that calculates the occupancy, computes a value  that has to follow the measurement of RAW when the parking place is free. It has a temperature compensation to be able to follow the RAW measure of the axis.

General information

  • CTRL_REG1 = 0x1A:

pastedImage_58.png

  • CTRL_REG3 = 0xA0:

pastedImage_62.png

The data acquisition is made every cycle (cycle time can be 8 [s] up to ~1 minute). Between this "sleep period" the Microcontroller turn OFF the power of the sensor.

Generally, the sequence is:

Enable interrupt (to detect boot interrupt), Power ON Sensor, wait 10[ms] (datasheet spec.), disable interrupt, SET CTRL_REG2, SET CTRL_REG1, Start measure timer, Enable interrupt (to detect when measures are ready) , Set watchdog timer 120[ms] (100[ms] +20% of margin), Read Registers, Power OFF Sensor, Disable interrupt and general register Control  (and back to the initial state). Every cycle this procedure is made.

Questions

I take this opportunity to ask some questions:

  1. I noticed that during long periods, which rarely happens that some sensors have a jump  of the "offset" value (this can happen on the single axis until on all three). This causes a false detection and the algorithm requires time to react and understand that the change was not caused by the presence of a car. I observed that the jump of the offset, can be caused by an excessive magnetic field which "contaminates" the sensor. However on some sensors should not have been any strong field that caused this jump. What other possible reason can cause this phenomenon? The AUTO_MRST_EN reduces this kind of effect (offset jumps). The "manual" action Mag_RST has the same results as the AUTO_MRST_EN or it is "better" (acts in a different way) if it is exposed to an excessive magnetic field ?Example of jump:146671_146671.pngOffset_Jump_Example.png
  2. The power supply of the sensor is managed by a mosfet that turn ON/OFF  the MAG3110. I Observed some rare current peaks when the MOSFET switches ON (>100 [mA] for some [us]). Could these short current peaks cause offset jumps?
  3. It is recommended to remove the power to the sensor? If yes, with TM = 1 and AC = 0 (The ASIC will exit standby mode, perform one measurement cycle based on the programmed ODR and OSR setting, update the I2C data registers and re- enter standby mode.) is ideal in case you want to turn off the magnetometer? There is a most recommended configuration in the case we want to turn OFF the power ?
  4. The factory calibration has a temperature compensation. When i analyze data in a place without many changes of magnetic field i can see changing the measures of three axes with the temperature.Could be possible that I see changes with a delta of ~300 (temperature changes ~50 degrees). Example:

146669_146669.pngTemperature _Vs_Measures.png

Thanks for support and regards,

Dennis G.

Labels (1)
12 Replies

2,668 Views
dennisgallicchi
Contributor II

Hi Anthony,

It make sense that depend on the characteristics of the specified sensor and his silicon !

Thanks for your support, it was helpful.

Best regards,

Dennis G.

0 Kudos

2,668 Views
dennisgallicchi
Contributor II

Hello Anthony,

Thanks for the example.

A kind of TCO is already computed from the gateway, using RAW measures and temperatures of a long period for each sensor.

About the factory calibration:

"MAG3110 is factory calibrated for sensitivity and temperature coefficient of sensitivity. All factory calibration coefficients

are automatically applied by the ASIC before a measurement is taken and the result written to registers 0x01 to 0x06"

As you said, for the Temperature Coefficient Offset, it can be characterized for each magnetometer at the final assembly chain and compensated in the firmware.

There is the possibility to have information about the factory calibration coefficients on a specific sensor, reading some registers on the device ?

On some sensors I observed different behavior. For example in this case the Z axis (in blue) looks properly compensated:

Temperature_Drift.png

I suppose this depends from the factory calibration coefficients ?

Greeting,

Dennis G.

0 Kudos

2,668 Views
anthonyduhamel
NXP Employee
NXP Employee

Hello Dennis,

I'm sorry, but you don't have access to other registers except those written in the datasheet.

For the Z axis TCO, in your plot, it looks very small so it's a good thing. But It is a lucky break, I mean, if you test an other sample, you will probably have different behaviors. This not depends of the factory calibration but to the silicon.

Anthony

2,668 Views
dananghel
Contributor I

Hello Anthony,

I am using the MAG3110 to develop a car detection system.I made my device to self calibrate when the MAG starts up and set the offsets, but when expose the MAG to temperatures from 13-41(as reported by the chip) the values on the 3 axis starts to modify like bellow:

pastedImage_1.png

I this normal ? Is there a formula provided by NXP in order to compensate this?

Regards,

Dan 

0 Kudos

2,668 Views
anthonyduhamel
NXP Employee
NXP Employee

Hi Dan,

The phenomenon you're seeing a quite normal, we called this Temperature Coefficient Offset.

You need to characterize the TCOs (1 TCO per axis) of the MAG3110 to avoid the magnetic drift over temperature. Note that the TCOs changes for each device, so you can't apply a direct compensation formula to the raw measurement without one time calibration for each magnetometer.

To calibrate the sensor, you need to record the temperature and the magnetic field of the 3 axis (OUT_x_x registers) at 2 different temperatures (DIE_TEMP register).

pastedImage_2.png

Bigger is you temperature gradient, better will be the TCO calculation.

Then use these formulas for the parameter computation:

pastedImage_3.png

Once you've characterized the TCO parameters, I suggest you to register them into the MCU flash. 

Finally, for each raw measurement (B_raw can be also your offet compensated data), you can apply the formulas below:

pastedImage_4.png

Note that you need also to get the DIE_TEMP register value to compensate the magnetic value.

Please find below an example  of the calibration effect improvements I got using this method:

pastedImage_5.png

I hope it helps.

For a car detection system, you can also not use the offset calibration (HardIron) and the TCO either. In fact you just need to detect the magnetic change in a pretty low timespan. Working with the vector magnitude (VECM) of the magnetic field ( sqrt(x²+y²+z²) ), you should be able to detect long drift (temperature effect) and quick magnetic drift (vehicle presence). I mean if between two measurements of the VECM (previous VECM - current VECM) with a data rate of lets say of 0.5Hz the magnetic value does not change a lot, you don't have any car there. This algorithm can be very simple and efficient, it does not care of the offset and temperature drift. But that's an other way of thinking.

Have a great day,

Anthony

2,668 Views
dananghel
Contributor I

Hello Anthony,

I have  one question : if I want to measure the variation of the magnitude without and in the presence of a metallic object at two different temperatures (+40/-20 celsius), the variation at +40 should be identical with the variation at -20?

0 Kudos

2,668 Views
anthonyduhamel
NXP Employee
NXP Employee

Hello Dan,

In the "without metallic object" case, the TCO should be constant, so the slope (variation) would be about the same. For example if you have a TCO of 0.36 uT/°C on the X axis with a magnetic field of 50 uT at 25°C (ambient temperature), you should have  ((40-25)*0.36+50) => 55.4 uT at 40°C and ((-20-25)*0.36+50)=> 33.8 uT at -20°C. This is the temperature effect on the device's m-cell.

This law does not really work in the "with metallic object" case. I mean, the TCO of the m-cell will be exactly the same, but unfortunately the magnetic strength of the ferromagnetic object also changes with the temperature.

So you would probably not have the same behaviors in the 2 different cases.

Anthony

0 Kudos

2,668 Views
dennisgallicchi
Contributor II

Hi Anthony,

  • About the capacitors, i agree with your observation. Perhaps also the rare peaks during the magnetometer power-ON are due to this (since the capacitors are discharged during power off).
  • Regarding the temperature compensation, to reduce power consumption and resources only the RAW measurements and temperature are send from the "sensor device". Upstream it is still done the necessary temperature compensation. If I wanted to do the temperature correction on the device, I suppose I could use the Offset User Correction changing the offset value () for each axes (in function of the smart algorithm).

Thanks for support and regards,

Dennis G.

0 Kudos

2,668 Views
anthonyduhamel
NXP Employee
NXP Employee

Dennis,

What I called TCO is not really an offset, but a slope expressed in uT/°C or in count/°C. So you can't use the OffsetUserCorrection register to calibrate the sensor. I attach example source files for TCO calibration

Anthony

0 Kudos

2,668 Views
dennisgallicchi
Contributor II

Hello Anthony,

Thanks for your answer was helpful ! Sorry but I din't found the application notes before, it confirmed some doubts.

Only one thing regarding the figure 6 on the document (AN4984):

pastedImage_16.png

  • As i said, a mosfet is used to switch ON/OFF the sensor. "VDD connection and capacitors removed", it means that the capacitors should be downstream of the sensor power supply? I mean, which of the following configurations (1 or 2) is correct?

1) pastedImage_18.png

2) pastedImage_24.png

MAG_PWR is connected to the GPIO of the MCU.

MAG VCC is connected to VDD.

  • Just a question regarding your chart. Is the magnetometer axis in Count (LSB) ?

     If I understand right the question, the Fast Read Mode is disabled, the complete 16-bit data are read (OUT_X_MSB,      OUT_X_LSB, OUT_Y_MSB, OUT_Y_LSB, OUT_Z_MSB, OUT_Z_LSB).

Thanks and regards,

Dennis G.

0 Kudos

2,668 Views
anthonyduhamel
NXP Employee
NXP Employee

Hi Dennis,

  • "As i said, a mosfet is used to switch ON/OFF the sensor. "VDD connection and capacitors removed", it means that the capacitors should be downstream of the sensor power supply?"

          The first setup does not power off the magnetometer until the caps are not unloaded so you will lose all the energy stored in it at each data collection.

          The second configuration should consume less energy than the 1st one.

  • For the Temperature Coefficient Offset, it can be characterized for each magnetometer at the final assembly chain and compensated in the firmware. For example, on the chart you shared with us, for this MAG3110 sample, the Z axis TCO is about 0.6uT/°C  (300count/50°C). You can also implement a smart algorithm to fix this problem (and avoid factory calibration) and work with relative measurements

Thanks,

Anthony

0 Kudos

2,668 Views
anthonyduhamel
NXP Employee
NXP Employee

Hello Dennis,

We have an  application note (AN4984) on NXP magnetometer in one shot measurement. It should answer to some of your questions.

The sensor is not totally temperature calibrated in factory as it is mentioned in the datasheet (2.1 Table 3 page5) on the Tcs/TCO row (+-0.1 %/°C) .

Just a question regarding your chart. Is the magnetometer axis in Count (LSB)?

Thanks,

Anthony