1

Im using the SparkFun MAG3110 3D sensor: https://www.sparkfun.com/products/12670

My application is essentially to make a contactless "magnetic joystick" using a local magnet for accurate and constant 3D position sensing in x, y, x planes of a local magnet, exactly like in this video (skip to 1:06): https://www.youtube.com/watch?v=CO6y6bjFfmY

The magnet I'm using is constant, so i'm trying to figure out a way to remove the earths magnetic field noise around the sensor so it cannot interfere with the sensors readings as if the earths magnetic field was virtually not present.

I've already written code that takes about 50 samples in each plane (x,y,z) and takes the average of each of the planes and outputs those readings minus the average offset values (Ex: Serial.print(x-xavg), Serial.print(y-yavg), Serial.print(z-zavg)). I did this to basically "zero out" the earths magnetic field, like zeroing a weight scale.

That wasn't really effective and results were not anywhere near constant after introducing and removing the local magnet, over and over again.

I've considered:

  • a low pass filter
  • sensor fusion using my gyroscope/accelerometer module (I know that sensor fusion is usually used to calibrate the Magnometer to be a more accurate compass, but is there anyway to use this technique to eliminate the earths magnetic field?)
  • using data from http://www.magnetic-declination.com/ to tie into my calculations to offset the readings
  • Using an electromagnet module to output the earths magnetic field inverted continuously in an attempt to cancel out the earths magnetic field
  • trying to find a whole new sensor completely that does not have a low enough sensitivity to even detect earths magnetic field

So my questions are:

  1. Is there any way to do this?
  2. Are any of my considerations practical or possible?

  3. Are there even any 3d magnetic sensors on the market that do NOT pick up the earths magnetic field? - I've contacted SparkFun, Arrow, ST, and other companies about this exact question and never really get a sure answer on this question specifically?

  4. if not, how was this man in the video able to reduce noise around his sensor? - He shows visually that his sensor is starting to filter out noise, saying that he's using an "adaptive averages" algorithm and links to some code, but I was unable to see/find that and don't understand how he is doing that?

3 Answers 3

1

One option is a magnetic gradiometer. This consists of two magnetometers, which are placed at different distances from the local magnet (one close, one far). You subtract the readings to eliminate dependence on the earth's magnetic field, on the (fairly good) assumption that the earth's field does not change over the distance between the sensors.

1

Earth magnetic field is pretty constant. In your measurements it will show up as an offset that you could subtract, but of course it will change if the sensor rotates.

Whatever measurement noise you see certainly doesnt' come from Earth. Either your setup is close to a local source of magnetic radiation (inductors, wires with high alternating current), or your sensor picks up noise from its power supply. Put your sensor away from high currents, power it with batteries and see how much noise you'll get in that case.

1
0

If you're already subtracting the mean of several samples of the ambient field, what's left should be noise, and much lower than your signal (the field due to your handheld magnet).

If you're trying to get a level of precision at the same order of magnitude as the noise, you'll need a larger 'N' (sample size), perhaps of both the ambient and of the desired signal, or apply even more stringent statistical techniques.

But I doubt that's what the experimenter in the video was doing. It's more likely he was close enough the sensor and with a strong enough magnet, that the noise was insignificant by comparison. He was using a rare-earth magnet - are you? Those typically have a stronger field that a more common ceramic or steel one. If not, you may need to use yours at a smaller distance from the sensor to get a similar signal to noise ratio.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

Not the answer you're looking for? Browse other questions tagged or ask your own question.