Continue to Site

# Magnetometer help needed!

Status
Not open for further replies.

#### charles98

##### New Member
Hello,

First off, I have to say I am relatively new to magnetometers.

I have been working in a project for the detection of magnets (they can be different sizes) in a three dimensional space around the sensor.

The magnets and sensor positions are not strictly defined and they can be in any orientation in space. I am now using the LIS3MDL board to try and accomplish this.

I am able to use SensorLab library with MotionCal to obtain relatively good values for calibration. I then use the calibrated magnetometer output values to calculate the magnitude of the magnetic field. By continuously reading the sensor, I check for the increase or decrease in the magnitude value which occur when a magnet approaches from any direction.

The problem I have is that over time the sensor will experience drift in the measurements.

This will cause the magnitude value, which before was relatively stable, to change a lot as I rotate the sensor

Is there any way to solve this problem?

I have by now done some research and have not reached any answer. Any tips or knowledge would be appreciated.

Thank you in advance for any help, really!

This will cause the magnitude value, which before was relatively stable, to change a lot as I rotate the sensor

how much is "a lot"? Fractions of a gauss? Or several gauss?

I am using the values in uT for each axis.

When calibrated I get a magnitude of around 41 give or take 1 or 2 uT when rotating the sensor.

After some time this magnitude starts drifting a lot more, from 30 to 50uT while rotating.

That is to be expected - the earth's magnetic field is 30 to 60 uTesla so your base measurement of 42 is to be expected. Rotating your compass (I mean magnetometer) will cause that as you turn it.

So how do we solve this issue so that we dont have false positives when approaching the neodymium magnet?

I noticed that someone in another project used two magnetometers with one 90 degrees around the Z axis (attachment helps understading).

I don´t really know how that would help with the false positives.

Any idea?

#### Attachments

• 126197481_3418411341600882_38055262496824847_n.jpg
151.8 KB · Views: 117
That would be kind of like a second microphone on a noise cancelling microphone. If the second microphone (not pointed at the singer picks up the same thing as the singer's microphone, it is cancelled with a difference amplifier.
In the case of magnetometers, I think (Think) the idea is that if x = y the effect is background noise and only the z-axis changes are real signal to detect a field. The math (relation) between x and y is probably more complicated than x = y. I think there is a square in there somewhere to cancel +/-. I'm sure more details are on the web somewhere.

Status
Not open for further replies.