I have been trying to use the magnetometer to accurately compute compass heading . However, I seem to be getting results that render the measurement somewhat useless. After I compute the Atan of mag.x and mag.y then calculate for 360 degrees, I find that my puck is very quickly jumping past 270 to 360 and relatively slowly projecting 0 to 270. Sort of like 90 degrees measurement occurs in 10 degrees of rotation and 270 degrees measurement occurs in 350 degrees rotation. I have tried moving the puck into an entirely demagnetized space away from every possible external magnet source and still get these ranges. I’m trying to lay the puck flat on the table and turn the puck as if it were a volume knob.
Is the magnetometer not capable of being used as a compass ?
Espruino is a JavaScript interpreter for low-power Microcontrollers. This site is both a support community for Espruino and a place to share what you are working on.
I have been trying to use the magnetometer to accurately compute compass heading . However, I seem to be getting results that render the measurement somewhat useless. After I compute the Atan of mag.x and mag.y then calculate for 360 degrees, I find that my puck is very quickly jumping past 270 to 360 and relatively slowly projecting 0 to 270. Sort of like 90 degrees measurement occurs in 10 degrees of rotation and 270 degrees measurement occurs in 350 degrees rotation. I have tried moving the puck into an entirely demagnetized space away from every possible external magnet source and still get these ranges. I’m trying to lay the puck flat on the table and turn the puck as if it were a volume knob.
Is the magnetometer not capable of being used as a compass ?