I have updated an app [1] to github for Bangle.js, which connects to a Puck.js, obtains some magnetometer data, and then finds the best fitting ellipse to this data. The object cal_data consists of a matrix A, a translation vector v, and a radius r. If the calibration goes as it should, then, if you first translate any reading from the magnetometer by -v, and then multiply the vector by A, then you should land on the sphere with radius r.
The app is still in a somewhat rudimentary form, but it works.
When the app is done with data collection and analysis, it displays some numbers on the screen. First, if the three eigenvalues displayed all coincide (more or less), then the data fits on a sphere, more or less, whereas if they are very different, then the ellipse is skewed, indicating 'soft iron distortion', whereas the transation vector indicates 'hard iron distortion (whatever that means).
I should note that the app tells the Puck.js to stop giving out data after 500 readings, which might be a bit much. However, data collection can be stopped by pressing the button on the Puck.js, it should be enough to let this run for just a couple of seconds, but make sure to rotate the Puck.js around while data is being gathered. Data gathering is indicated by blinking lights on the Puck.js.
The app also saves the data on the watch. For now, I will be using it for data collection, but the code is ready to be used with any application.
Right now I am going out for a run, I'll be back soon with new data from outside.
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 updated an app [1] to github for Bangle.js, which connects to a Puck.js, obtains some magnetometer data, and then finds the best fitting ellipse to this data. The object cal_data consists of a matrix A, a translation vector v, and a radius r. If the calibration goes as it should, then, if you first translate any reading from the magnetometer by -v, and then multiply the vector by A, then you should land on the sphere with radius r.
The app is still in a somewhat rudimentary form, but it works.
When the app is done with data collection and analysis, it displays some numbers on the screen. First, if the three eigenvalues displayed all coincide (more or less), then the data fits on a sphere, more or less, whereas if they are very different, then the ellipse is skewed, indicating 'soft iron distortion', whereas the transation vector indicates 'hard iron distortion (whatever that means).
I should note that the app tells the Puck.js to stop giving out data after 500 readings, which might be a bit much. However, data collection can be stopped by pressing the button on the Puck.js, it should be enough to let this run for just a couple of seconds, but make sure to rotate the Puck.js around while data is being gathered. Data gathering is indicated by blinking lights on the Puck.js.
The app also saves the data on the watch. For now, I will be using it for data collection, but the code is ready to be used with any application.
Right now I am going out for a run, I'll be back soon with new data from outside.
[1] https://github.com/baldursigurds/calibrtr