Questions tagged [magnetometer]

Anything related to magnetometers, i.e. hardware measurement devices used to measure the intensity and/or the direction of a magnetic field. Many smartphones embed a magnetometer which is used as the sensing device in the implementation of electronic compass applications.

Anything related to magnetometers, i.e. hardware measurement devices used to measure the intensity and/or the direction of a magnetic field. Many smartphones embed a magnetometer which is used as the sensing device in the implementation of electronic compass applications.

See Wikipedia about magnetometers.

258 questions
65
votes
4 answers

In iOS, what is the difference between the Magnetic Field values from the Core Location and Core Motion frameworks?

I have two ways of getting the magnetic fields (strength, x, y, and z) using the iOS device's magnetometer. 1) Core Location Used the CLHeading from CLLocationManagerDelegate method locationManager:didUpdateHeading:. This is similar to Apple's…
MiuMiu
  • 1,905
  • 2
  • 19
  • 28
19
votes
5 answers

How to determine absolute orientation

I have a xyz accelerometer and magnetometer. Now I want to determine the orientation of the device using both. The problem I see is that depending on the device orientation, I'd need to use the sensors in different order. Let me give an example. If…
Al.
  • 1,811
  • 4
  • 15
  • 8
13
votes
7 answers

Android device orientation without geomagnetic

I need to get device orientation. As I know usually used TYPE_ACCELEROMETER and TYPE_MAGNETIC_FIELD sensors. My problem is that SensorManager.getDefaultSensor returns me null for geomagnetic sensor. It returns null for TYPE_ORIENTATION sensor…
Ircover
  • 2,406
  • 2
  • 22
  • 42
13
votes
2 answers

Sensor.TYPE_ROTATION_VECTOR has drift: Is there an alternative?

I'm trying out Sensor.TYPE_ROTATION_VECTOR on Android. It is supposed to use magnetfieldsensor, accelerometer and gyroscope to provide accurate rotation at all times. However, I notice enormous drift occurring on Moto G 2nd. I wonder if this is a…
RobotRock
  • 4,211
  • 6
  • 46
  • 86
13
votes
1 answer

Is Apple's iPhone magnetometer calibration working properly?

I'm currently developing an iPhone App (on iPhone 5, iOS 7, Xcode 5) which requires a very accurate determination of the current attitude. The "attitude" of CMDeviceMotion does not fulfil these requirements because Apple's sensor fusion algorithm…
user2980195
  • 163
  • 1
  • 10
13
votes
2 answers

android nGPS: get location based on magnetic field instead of gps or cell triangulation

Does anybody know how to convert results from the magnetic-field sensor from an android device to coordinates using the World Magnetic Model? Is there a webservice that does that?
Buda Gavril
  • 21,409
  • 40
  • 127
  • 196
12
votes
4 answers

How to get a phone's azimuth with compass readings and gyroscope readings?

I wish to get my phone's current orientation by the following method: Get the initial orientation (azimuth) first via the getRotationMatrix() and getOrientation(). Add the integration of gyroscope reading over time to it to get the current…
Sibbs Gambling
  • 19,274
  • 42
  • 103
  • 174
11
votes
3 answers

Convert magnetic field X, Y, Z values from device into global reference frame

When you use TYPE_MAGNETOMETER sensor, you get X, Y, Z values of magnetic field strength in relation to the device orientation. What I want to get is to convert these values into global reference frame, clarifying: user takes the device, measure…
Yahor
  • 113
  • 1
  • 1
  • 6
11
votes
1 answer

Getting magnetic north from a xyz magnetometer (iPhone 3.0)

I'm actually reposting a question from the iphone development boards. I didn't ask it, but I found it when trying to find its answer. Nobody had yet responded there, so I thought I'd try posting it here. Thanks in advance for any help! Does…
user130071
10
votes
2 answers

How do I convert raw xyz Magnetometer data to a heading?

I'm using an embedded device with a simple 3-axis Magnetometer on it. I have it currently displaying the X Y Z values in micro Teslas but how do I convert these into a compass heading? I have tried looking it up on Google but everything I find seems…
Cypher236
  • 527
  • 1
  • 4
  • 13
9
votes
5 answers

finding orientation using getRotationMatrix() and getOrientation()

Im trying to get the direction of the vector pointing out of the camera, with respect to magnetic north. I'm under the impression that I need to use the values returned from getOrientation(), but I'm not sure what they represent. The values I get…
9
votes
3 answers

Calculating magnetic heading using raw accelerometer and magnetometer data

I have an accelerometer and magnetometer each producing raw X, Y and Z readouts. From this I need to determine the magnetic heading of an object. I'm not that great at trig, but I've put together a formula that does respond pretty well to the…
M. Ryan
  • 6,973
  • 11
  • 52
  • 76
9
votes
2 answers

CMDeviceMotion returns 0 values for magnetic field

I am developing iOS app with compass functionality. I have tried to use CMMagnetometerData updates which give uncalibrated, but normal results. After that I tried to get CMDeviceMotion updates which turned out to give always zero magnetic field…
Tzoiker
  • 1,354
  • 1
  • 14
  • 23
9
votes
3 answers

Android Compass Bearing

I am trying to get the compass bearing in degrees (i.e. 0-360) using the following method: float[] mGravity; float[] mGeomagnetic; public void onSensorChanged(SensorEvent event) { if (event.sensor.getType() == Sensor.TYPE_ACCELEROMETER) …
duncanportelli
  • 3,161
  • 8
  • 38
  • 59
8
votes
1 answer

iPhone compass presents the wrong heading pitch angle is > about 45°

This might be hard to explain the geometry so I will be careful in spelling it out. This is visible in the standard compas app and from the data in CLLocationManager. 1) When holding the phone in portrait orientation, consider the pitch angle to be…
Steven Noyes
  • 1,549
  • 1
  • 11
  • 16
1
2 3
17 18