2020-01-30 02:45 AM
Hi,
we have used LSM303AGR magnetometer for cupboard Door Open/Close detection and it is working properly.
On door close position, i am getting ~0 of every direction as i have done hard iron compensation.
Issue i am getting in small cupboard is to open the door, door handle is required to rotate. when handle is rotated completely, Handle iron comes near magnetometer IC and due to that result is deviated.
Is there any solution for that?
Logic implemented to detect door Open/Close position:
2020-01-30 03:34 AM
> Is there any solution for that?
Depends on how you view the problem.
The effect is intrinsic to magnetometers - they measure a magnetic field, wherever it comes from.
But you can calibrate the sensor (search for "soft iron calibration"). Like e.g. here:
https://www.instructables.com/id/Easy-hard-and-soft-iron-magnetometer-calibration/
https://pdocs.kauailabs.com/navx-mxp/guidance/magnetometer-calibration/
2020-02-03 03:47 AM
Thanks Ozone,
I observed another issue like magnetometer value changes after sometimes at same location.
Initially:
Fri 11/22/2019 18:27:54.801 : X : -4, Y : 0, Z : -3
After:
Thu 01/30/2020 18:58:06.330 : X : 18, Y : -5, Z : 31
Can you please help what is going wrong?
2020-03-02 03:15 AM
Can you please help what is going wrong in below mentioned case?
magnetometer value changes after some days at same location and same position.
Initially:
Fri 11/22/2019 18:27:54.801 : X : -4, Y : 0, Z : -3
After:
Thu 01/30/2020 18:58:06.330 : X : 18, Y : -5, Z : 31
2020-03-02 03:26 AM
Absolute terms of both field measurments would be more descriptive.
The magnetic field of the earth is not constant.
See here, especially the "Geomagnetic Activity" diagram:
https://www.swpc.noaa.gov/communities/space-weather-enthusiasts
2020-03-02 03:47 AM
Thanks Ozone,
I am measuring my device(Door) position based on magnetometer readings. Is there any way to resolve issue of magnetometer readings changed after some days?
2020-03-02 05:26 AM
> I am measuring my device(Door) position based on magnetometer readings.
Not sure about the way you want to measure an object position with a magnetometer.
The manufacturing industry often uses magnetic position sensors which are threshold-based. Moving objects often have magnets of magnetic metal attached to aid detection. The gained information is binary (e.g. door closed or not).
For position measurement, distance sensors (optical or ultrasonic) might be a better choice, or rotary encoders.