I've been (unsuccessfully) trying to convert the magnetometer readings to a compass headings. I've been googling, and due to my maths education stopping at GCSE level, I don't understand most of the conversions. I tried following the adafruit guide but it's for a different magnetometer sensor, and the readings don't seem the same, Adafruit guide says the readings are in micro-Teslas and will be between 20 and 60 micro Teslas, and in the Puck guide it's saying a similar number, but that the increments are in 0.1 micro Teslas. I am getting readings of { "x": -3431, "y": 4167, "z": 508 } so even divided by 10 these are off.
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've been (unsuccessfully) trying to convert the magnetometer readings to a compass headings. I've been googling, and due to my maths education stopping at GCSE level, I don't understand most of the conversions. I tried following the adafruit guide but it's for a different magnetometer sensor, and the readings don't seem the same, Adafruit guide says the readings are in micro-Teslas and will be between 20 and 60 micro Teslas, and in the Puck guide it's saying a similar number, but that the increments are in 0.1 micro Teslas. I am getting readings of
{ "x": -3431, "y": 4167, "z": 508 }
so even divided by 10 these are off.I thought that the following code might work:
But I don't get the readings I would expect.
Am I missing something or being a dope?