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
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:
Thanks for support and regards,
Dennis G.
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.
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 ?
I suppose this depends from the factory calibration coefficients ?
Greeting,
Dennis G.
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
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:
I this normal ? Is there a formula provided by NXP in order to compensate this?
Regards,
Dan
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).
Bigger is you temperature gradient, better will be the TCO calculation.
Then use these formulas for the parameter computation:
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:
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:
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
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?
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
Hi Anthony,
Thanks for support and regards,
Dennis G.
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):
1)
2)
MAG_PWR is connected to the GPIO of the MCU.
MAG VCC is connected to VDD.
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.
Hi Dennis,
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.
Thanks,
Anthony
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