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
5
votes
2 answers

Android - SensorManager strange behaviour of getOrientation

I need to retrieve the orientation of my phone. At the moment i wrote this : public void onSensorChanged(SensorEvent event) { switch (event.sensor.getType()){ case Sensor.TYPE_MAGNETIC_FIELD: this.mag_vals = event.values.clone(); …
hara
  • 3,274
  • 4
  • 37
  • 55
5
votes
0 answers

How to adequatly replace Sensor.TYPE_ORIENTATION (which is now deprecated)?

I've tried several code snippets found on the internet in SensorManager.getOrientation() - related discussions. None give magnetic azimuth reliably, as Sensor.TYPE_ORIENTATION did. Could anyone share a working code for Sensor.TYPE_ORIENTATION…
Violet Giraffe
  • 32,368
  • 48
  • 194
  • 335
4
votes
2 answers

How do I use Core Motion to output magnetometer data using SwiftUI?

I am having trouble outputting the data for the magnetometer, accelerometer and gyroscope using Core Motion with SwiftUI. I'm assuming my problem has something to do with the startMagnetometerUpdates(). I've tried using source code found here on…
mango
  • 55
  • 1
  • 4
4
votes
0 answers

Reading Magnetometer Data MPU9250 AK8963

I wrote code to work with the MPU9250 (gyroscope and accelerometer), but I can’t read the data from another AK8963 device. There is a magnetometer on it, I get static data. In i2cdetect, I only have 0x68, i.e. the MPU9250. AK8963 at address 0x0C,…
goose
  • 109
  • 1
  • 10
4
votes
1 answer

gyro, accelerometer, magnetometer and Kalman filter

I want to use gyro, accelermeter and magnetometer to get a full smooth rotation in 3 axis. The first problem is that my outputs individualy has very noise and I want to know how can I remove it. The second problem is the gyro drift that I think it…
khatarat
  • 49
  • 1
  • 1
  • 2
4
votes
1 answer

I2C with stm32f4 using HMC5883l

I've been trying to connect my HMC5883l board to stm32f4, however something is not working properly. I've initiated the i2c, sent the configuration bits to REGA, REGB and REGMR (Mode Register) and sent it back via USB connection with…
donwazonesko
  • 135
  • 1
  • 10
4
votes
1 answer

getting info from magnetic sensors

I'm listening for sensor values, and getting them OK in my handler with if (event.sensor.getType() == Sensor.TYPE_MAGNETIC_FIELD) { for (i=0;i<3; i++) mag[i] = event.values[i]; The developer docs say for Sensor.TYPE_MAGNETIC_FIELD you…
Peter vdL
  • 4,953
  • 10
  • 40
  • 60
4
votes
1 answer

Using iOS device as teslameter (magnetometer discussion)

In my app I want to detect how strong surrounding magnetic/electromagnetic fields are. What I want to achieve is to measure magnetic field change to know if it's stronger than in control measurement or if it's lower. This is my code: -…
Ivan Nesterenko
  • 939
  • 1
  • 12
  • 23
4
votes
1 answer

Finding a Compass Heading on Android

I want to display an arrow at my location on that displays my direction relative to a destination location. Similar to this stackoverflow question: Calculate compass bearing / heading to location in Android I want to find the heading or the measure…
Nightlife
  • 133
  • 3
  • 10
4
votes
1 answer

How to get magnetometer data using swift?

I am trying to get the magnetic field data from my iphone 6 by using CoreMotion. I had no problems accessing the raw data with the following code: if available { motionMangager.magnetometerUpdateInterval = updateInterval …
iSteffi
  • 178
  • 2
  • 11
4
votes
2 answers

How do I get the angle of the phone relative to the Earth's magnetic field?

I was planning to calculate the angle the phone is relative to the earth's magnetic field. For this I planned to use Sensor.TYPE_GEOMAGNETIC_ROTATION_VECTOR. In Geomagnetic Rotation Vector, it explains that event.values return the same values as in…
SysClaude
  • 146
  • 2
  • 8
4
votes
1 answer

What is magnetometer tilt compensation and why is it required?

When reading about magnetometer / magnetic field / "compass" sensors it is often said that sensor tilt compensation e.g. by using an accelerometer is required in order to get correct measurements. (Note that I am not talking about hard iron and soft…
sunside
  • 8,069
  • 9
  • 51
  • 74
4
votes
1 answer

Possible to use a set of vectors as input to a neural network?

Hope there are some neural network heads out here who can help with this! (: Background: I'm using an accelerometer to draw shapes in the air, and I'm wondering if it's possible to use a neural network to detect what shape I've drawn. Let's assume I…
4
votes
1 answer

How to distinguish movement accelerations from oscillations and noise in iphone

Hi everybody on stackoverflow. SHORT VERSION :) I need to use (x,y,z) acceleration values related only to the movement of the iPhone. Just to be clear, think an environment like a car. The iPhone's accelerometer is very sensitive. If I log…
kevin
  • 75
  • 5
3
votes
1 answer

What does the full scale range in a IMU MPU9250 datasheet signify and which is better to use?

I have MPU9250 IMU, which I am working on to get orientations from the sensor output data. While exploring the MPU9250 (also other sensor such as BNO055) datasheet I came across the full scale range for accel & gyro given as ±2 ±4 ±8 ±16 (g) and…
TheLazy
  • 253
  • 1
  • 15
1 2
3
17 18