Android Question Magnetometer readings affected by camera

JackKirk

Well-Known Member
Licensed User
Longtime User
This is not so much a question but an observation with a request for corroboration and input.

I am in the deep throes of developing an app that needs to as accurately as possible measure the orientation of the cameras line of sight.

Part of the exercise has been to develop a magnetometer calibrator which works by comparing the measured magnetic field (total intensity and inclination) with the expected as given by the NOAA model:

https://www.ngdc.noaa.gov/geomag/WMM/DoDWMM.shtml

When I run the app proper with the camera preview running I get slightly different measured magnetic field results to when I run the magnetometer calibrator with no camera.

The difference manifests mainly as a variation of about 1.5 degrees in the measured magnetic fields inclination - which is enough to be of concern to the app.

If I turn the camera off in the app proper - problem goes away.

If I set the camera preview panels visibility to false (but camera still on) in app proper - problem goes away.

If I add a camera preview capability to magnetometer calibrator - results match.

I have the phone in a rigid test rig - this is not a "trembling hand" issue.

Results are consistent and repeatable.

I am using a Samsung S5.

It seems to be not so much the camera as the displaying of the preview - could this induce a local magnetic field?

I've googled my eyeballs out to no avail.

-------------------------------------

So:

o Has anyone ever noticed a similar issue.
o Has anyone got any ideas as to why it is happening.

I'm interested in all responses...
 

JordiCP

Expert
Licensed User
Longtime User
This is really strange. But components inside such integrated devices are so close and their frequencies so high that electromagnetic fields could really "annoy" neighbour components. Of course this should not happen in a good design, as critical parts are shielded to minimize these effects, but it exists.

As, regardless of what it should be in an ideal case, this is happening, I would try with:

Confirm the cause:
  • If it happens with the preview, perhaps it also happens with a non-static image. To confirm this, I would try with a black background and a moving white Imageview (with a timer, for instance). If it doesn't, perhaps the cause is the "high" refresh rate of the preview surface --> then it would be possible to solve it by hiding the camera preview and showing a bitmap-based "slower" one .
  • Active screen region: perhaps you find that it most happens when the preview (or the active screen region) is the top of the screen (or any other). So if your preview is not full screen perhaps a layout change could improve the results.

"Profile" the error type. Given a fixed static orientation, for which you know the right value, let's consider that the observed error is just "noise".
  • Integrate it to find its mean value and variance.
  • So, for your app, instead of getting instant values, integrate them and add/substract the mean observed value. The integration period should be according to the observed variance.
  • As a later step, only if the above gives something good, I would test if this "noise" is consistent for different orientations

Hope it helps...
 
Upvote 0

JackKirk

Well-Known Member
Licensed User
Longtime User
JordiCP,

Thanks for your interest and suggestions, I will have a go at them and report back.

Might be a week or so though...
 
Upvote 0
Top