Skip to content

Commit d23fc6e

Browse files
committed
adding explanation of how to use the calibration script
1 parent 563d858 commit d23fc6e

File tree

1 file changed

+14
-2
lines changed

1 file changed

+14
-2
lines changed

examples/lis2mdl_compass.py

Lines changed: 14 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -10,11 +10,23 @@
1010
sensor = adafruit_lis2mdl.LIS2MDL(i2c)
1111

1212
# You will need the calibration values from your magnetometer calibration
13-
# these values are in uT and are in X, Y, Z order (min and max values)
13+
# these values are in uT and are in X, Y, Z order (min and max values).
14+
#
15+
# To get these values run the lis2mdl_calibrate.py script on your device.
16+
# Twist the device around in 3D space while it calibrates. It will print
17+
# some calibration values like these:
18+
# ...
19+
# Calibrating - X: -46.62, Y: -22.33, Z: -16.94 uT
20+
# ...
21+
# Calibration complete:
22+
# hardiron_calibration = [[-63.5487, 33.0313], [-40.5145, 53.8293], [-43.7153, 55.5101]]
23+
#
24+
# You need t copy your own value for hardiron_calibration from the output and paste it
25+
# into this script here:
1426
hardiron_calibration = [[-61.4879, 34.4782], [-43.6714, 53.5662], [-40.7337, 52.4554]]
1527

1628

17-
# This will take the magnetometer values, adjust them with the calibraitons
29+
# This will take the magnetometer values, adjust them with the calibrations
1830
# and return a new array with the XYZ values ranging from -100 to 100
1931
def normalize(_magvals):
2032
ret = [0, 0, 0]

0 commit comments

Comments
 (0)