Questions tagged [magnetometer]

33 questions
12
votes
4 answers

Converting three-axis magnetometer values to degrees

I have a 9-DOF sensor (MPU-9150) and I want to use its magnetometer to retrieve the rotation angle, from 0 to 359. However, its library returns three values: x, y and z. I do not know how to transform this into a single value. Is there any way to do…
Guilherme
  • 235
  • 1
  • 2
  • 10
1
vote
0 answers

HMC5883L Magnetometer X, Z values constant, only Y value Changes

I have a HMC5883L module connected to an Arduino Mega 2560 via +5, GND, SCL, SDA. The Arduino code is from the MagMaster-master example, as follows: #include "Wire.h" #include "HMC5883L.h" HMC5883L compass; //Copy the folder "HMC5883L" in the…
starship15
  • 764
  • 4
  • 10