LSM303AGR Magnetometer result is deviated when iron comes nearby
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:
- Calibration process:Close the door and calibrate it.at that position magnetometer gives ~0 value of each direction as i have done hard iron compensation.
- Door Open: when any magnetometer axis value is beyond 50 value.
- Door Close: when every magnetometer axis value is below 15 value.
