What do the Magnetometer Values Mean? #2811
Replies: 5 comments
-
Posted at 2021-09-12 by Robin Sun 2021.09.12 Hi @user134221 does this help? Would need to convert to Javascript, as code reads pretty much the same. |
Beta Was this translation helpful? Give feedback.
-
Posted at 2021-09-12 by Robin . . . just found this post Google: calculate magnometer site:espruino.com |
Beta Was this translation helpful? Give feedback.
-
Posted at 2021-09-12 by qucchia Thanks, I'll have a look! |
Beta Was this translation helpful? Give feedback.
-
Posted at 2021-09-12 by qucchia Thanks, that works! At least, when the Bangle's lying flat. Now I'd like to still get the right angle whatever way the watch is oriented. I'm supposing I could use the accelerometer to find out where down is, and use that to rotate the magnetometers' vector... I don't know if I'm even making sense. |
Beta Was this translation helpful? Give feedback.
-
Posted at 2021-09-14 by @gfwilliams Glad you got something working! Just some extra info if it helps:
So if you want to work out the actual rotation, with the Bangle still and after you've rotated it around a bit to calibrate the magnetometer, you should be able to:
|
Beta Was this translation helpful? Give feedback.
-
Posted at 2021-09-12 by qucchia
Hi, I've been trying to figure out a way to calculate the orientation (both azimuth and altitude) of my Bangle using both the accelerometer and the magnetometer. The altitude was easy; I just multiply 90º by the accelerometer's Z value. However, to calculate the azimuth is proving to be trickier. I've tried reading the magnetometer's values at several orientations (the values mag.x, mag.y, mag.z, mag.dx, mag.dy, and mag.dz) but don't understand what they mean. Could someone please explain them to me so I can transform them into a vector to calculate the azimuth? Thanks for the help!
Beta Was this translation helpful? Give feedback.
All reactions