Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Weird behaviour of the magnetic field measurements while rotating the device

The situation:

I'm trying to create an indoor localisation system with the use of the magnetic field variations inside a building via fingerprinting. As a sensor I'm using my mobile phone a Galaxy Nexus.

Basically the idea to get my fingerprints is to measure the magnetic field in x,y and z direction respectively and rotate the vector by the orientation of the mobile to bring the vector into the world coordinate system. To locate someone he also measures the magnetic field, rotates the vector and send it to the server where I'll run my locating algorithms.

My problem:

When I measure the magnetic field at the same spot in different orientations I don't get the same result after rotating the vector. Even the field strength isn't the same.

To show this I have made four measurements at the same position and rotated the mobile around his z axis (standard Android specification) by 90, 180 and 270 degrees counter-clockwise respectively. Results can be seen on that 'table' and on the Matlab plots (follow link) below (if you want to have other views let me know)

Edit: To be more precise: What I really did was that I defined my own coordinate system called lets say the room coordinate system. I took one wall of the room and defined it as north. The y-axis of my phone aliens with that wall (at the first position) while it was flat on the table. Therefore the positive z-axis points to the sky and the x-axis is defined as the walls in 90 degrees. The vectors named with 'Raw' are the raw values of the phone and so they are in the coordinate system of the phone. The Vector named with 'Rotated' are rotated into that 'room coordinate system'. In the plot the dotted vectors are the raw vectors and the solid ones are the rotated ones.

╔═════════════╦════════╦════════╦════════╦══════════╗
║ Vector      ║    X   ║   Y    ║    Z   ║ Strength ║
╠═════════════╬════════╬════════╬════════╬══════════╣
║ 0°Raw       ║  17.55 ║   8.21 ║ -36.83 ║  41.62   ║
║ 0°Rotated   ║  17.55 ║   8.21 ║ -36.83 ║  41.62   ║
║ 90°Raw      ║  15.74 ║ -11.36 ║ -36.86 ║  41.66   ║
║ 90°Rotated  ║  11.36 ║  15.74 ║ -36.86 ║  41.66   ║
║ 180°Raw     ║ -65.06 ║ -16.18 ║ -44.79 ║  80.63   ║
║ 180°Rotated ║  65.06 ║  16.18 ║ -44.79 ║  80.63   ║
║ 270°Raw     ║   6.38 ║  61.95 ║ -46.37 ║  77.64   ║
║ 270°Rotated ║  61.95 ║  -6.38 ║ -46.37 ║  77.64   ║
╚═════════════╩════════╩════════╩════════╩══════════╝

enter image description hereenter image description here

As you can see even after rotating them they doesn't really match. Do you have any idea why this could be? Anything I might haven't considered yet? Thanks a lot in advance!

Edit2:

Second experiment

I did another experiment with way better results but still not as good as I expected. This time the direction is not as constant as it should be. This time I did my measurements outdoor. I aliened the y-axis to the true north an put it flat on the ground. I rotated it roughly 3 times 90 degrees counter-clockwise. I took with another camera a picture of the position of the mobile and measured the real rotation with photoshop. The results you can see on the table and on the plots below:

╔═════════════╦════════╦════════╦════════╦══════════╗
║ Vector      ║    X   ║   Y    ║    Z   ║ Strength ║
╠═════════════╬════════╬════════╬════════╬══════════╣
║ 0°Raw       ║   1.22 ║  20.31 ║ -57.53 ║  61.02   ║
║ 0°Rotated   ║   1.22 ║  20.31 ║ -57.53 ║  61.02   ║
║ 104°Raw     ║  25.92 ║   5.66 ║ -57.53 ║  63.35   ║
║ 104°Rotated ║ -11.93 ║  23.70 ║ -57.53 ║  63.35   ║
║ 204°Raw     ║   5.42 ║ -16.86 ║ -59.67 ║  62.24   ║
║ 204°Rotated ║ -11.90 ║  13.12 ║ -59.67 ║  62.24   ║
║ 290°Raw     ║ -12.18 ║   0.73 ║ -57.85 ║  59.12   ║
║ 290°Rotated ║  -3.64 ║  11.64 ║ -57.85 ║  59.12   ║
╚═════════════╩════════╩════════╩════════╩══════════╝

enter image description hereenter image description here

Additional notes:

The values are averaged over a couple of seconds. So it's not a problem of noise.

I know I can't use the function getOrientation because it uses the magnetic field to calculate the orientation and that wouldn't make sense since I want to find the variations of the magnetic field. For the example above I created the rotation quaternion manually.

like image 681
Mr.Floppy Avatar asked Mar 31 '13 16:03

Mr.Floppy


People also ask

What is rotating magnetic field?

Rotating Magnetic Field. When we apply a three-phase supply to a three-phase distributed winding of a rotating machine, a rotating magnetic field is produced which rotates in synchronous speed.

How to generate rotating magnetic field in balanced poly phase winding?

When a balanced poly phase current flows in the balanced poly phase winding, a rotating magnetic field is produced. The necessary condition for generation of rotating magnetic field is that “the time angle displacement between the currents and space angle displacement between the winding axes must be equal.”

How does the rotating magnetic field affect the squirrel cage?

The rotating magnetic field is produced radially around the rotor by the varying currents in the stator windings. The rotating magnetic field induces eddy currents in the squirrel cage's vertical bars causing it to rotate.

What is the speed Ns of rotating magnetic field?

Therefore, the speed Ns of rotating magnetic field is given as = (120f/P) r.p.m Thus, the rotating magnetic field revolves with a speed of (120f/P) r.p.m for a P pole machine. This speed is called Synchronous Speed. Hope the concept of rotating magnetic field and its production in three phase electrical machine like Induction Motor is clear.


1 Answers

Make sure that you're monitoring the accuracy of the sensors via the onAccuracyChanged(Sensor sensor, int accuracy) method. I find that with my Nexus 10 tablet, the accuracy regularly changes, and when it's low or unreliable, I get results similar to yours.

like image 184
Stochastically Avatar answered Oct 04 '22 14:10

Stochastically