9DoF Sensor Stick question

Hi.

I bought your 9DoF Sensor Stick through a Dutch reseller (Antratek; their website says it’s your product, and it looks completely identical), and hooked it up to my Arduino and ran the basic I2C sketch. While the gyro and acceleration measurements seem to work, the magnetic field measurements seem to be stuck at the same value: they only vary a tiny bit (which looks like noise), but rotating the sensor has no discernible effect.

From there I would conclude that there is a problem with this unit. Should I send it back, or might I have overlooked something?

Thanks.

I’ll attach a few measurements, using the LSM9DS1_Basic_I2C.ino test. I explicitly added these lines:

imu.setAccelScale(2);

imu.setGyroScale(245);

imu.setMagScale(4);

to be on the safe side, but that didn’t have any effect.

In the first test, I turn the the board with the sensor 180 degrees from East to West and back (not too quickly). What I expect is changing values for G and M, but they stay almost constant: Mx varies between 0.16 and 0.29, My between 0.05 and 0.15, and Mz between -0.43 and -0.36. G changes even less, especially given that the sensor is not moving in the first and last few samples.

Are these values to be expected? The function that calculates heading seems to think otherwise.

The full output is:

G: 18.70, -49.31, -1.43 deg/s

A: 0.05, 0.02, 1.00 g

M: 0.29, 0.05, -0.41 gauss

Pitch, Roll: -3.02, 0.97

Heading: 199.24

G: 18.73, -49.28, -1.38 deg/s

A: 0.07, 0.01, 0.98 g

M: 0.29, 0.06, -0.40 gauss

Pitch, Roll: -3.82, 0.58

Heading: 199.22

G: 18.88, -49.27, -1.38 deg/s

A: 0.05, 0.02, 0.99 g

M: 0.29, 0.05, -0.40 gauss

Pitch, Roll: -3.08, 0.91

Heading: 198.82

G: 18.86, -49.54, -1.32 deg/s

A: 0.06, -0.00, 1.04 g

M: 0.29, 0.06, -0.40 gauss

Pitch, Roll: -3.22, -0.07

Heading: 199.37

G: 18.91, -49.18, -1.21 deg/s

A: 0.06, 0.01, 1.00 g

M: 0.29, 0.06, -0.40 gauss

Pitch, Roll: -3.15, 0.82

Heading: 199.92

G: 18.69, -49.55, -1.18 deg/s

A: 0.05, 0.02, 1.00 g

M: 0.29, 0.06, -0.41 gauss

Pitch, Roll: -2.65, 1.18

Heading: 200.64

G: 18.83, -49.33, -1.34 deg/s

A: 0.17, -0.04, 0.95 g

M: 0.29, 0.07, -0.40 gauss

Pitch, Roll: -9.84, -2.55

Heading: 201.51

G: 18.80, -49.38, -1.23 deg/s

A: 0.07, 0.05, 1.01 g

M: 0.29, 0.08, -0.42 gauss

Pitch, Roll: -4.03, 2.75

Heading: 204.22

G: 18.60, -49.35, -1.56 deg/s

A: 0.04, 0.05, 1.01 g

M: 0.27, 0.10, -0.42 gauss

Pitch, Roll: -2.10, 2.97

Heading: 208.40

G: 18.81, -49.69, -1.43 deg/s

A: 0.05, -0.06, 1.10 g

M: 0.25, 0.11, -0.43 gauss

Pitch, Roll: -2.75, -3.14

Heading: 213.08

G: 18.99, -49.33, -1.37 deg/s

A: 0.26, 0.34, 1.05 g

M: 0.22, 0.11, -0.41 gauss

Pitch, Roll: -13.17, 17.78

Heading: 215.13

G: 18.86, -49.43, -1.41 deg/s

A: 0.19, 0.07, 0.93 g

M: 0.22, 0.09, -0.39 gauss

Pitch, Roll: -11.36, 4.34

Heading: 211.60

G: 18.63, -49.38, -1.48 deg/s

A: 0.07, -0.03, 0.96 g

M: 0.21, 0.12, -0.39 gauss

Pitch, Roll: -4.01, -1.72

Heading: 217.65

G: 18.72, -49.46, -1.32 deg/s

A: 0.07, 0.03, 0.90 g

M: 0.17, 0.14, -0.36 gauss

Pitch, Roll: -4.27, 1.94

Heading: 229.20

G: 18.63, -49.42, -1.52 deg/s

A: 0.05, 0.03, 1.01 g

M: 0.16, 0.14, -0.34 gauss

Pitch, Roll: -3.04, 1.70

Heading: 230.56

G: 18.64, -49.48, -1.30 deg/s

A: 0.05, 0.03, 1.01 g

M: 0.16, 0.14, -0.34 gauss

Pitch, Roll: -2.98, 1.43

Heading: 228.91

G: 18.81, -49.42, -1.32 deg/s

A: 0.06, 0.03, 1.00 g

M: 0.16, 0.14, -0.35 gauss

Pitch, Roll: -3.22, 1.48

Heading: 229.10

G: 18.70, -49.48, -1.37 deg/s

A: 0.05, 0.03, 1.00 g

M: 0.16, 0.13, -0.34 gauss

Pitch, Roll: -3.06, 1.51

Heading: 228.61

G: 18.58, -49.35, -1.46 deg/s

A: 0.05, 0.03, 1.00 g

M: 0.16, 0.14, -0.34 gauss

Pitch, Roll: -3.11, 1.56

Heading: 230.56

G: 18.85, -49.43, -1.40 deg/s

A: 0.06, 0.02, 1.01 g

M: 0.16, 0.15, -0.35 gauss

Pitch, Roll: -3.41, 1.38

Heading: 231.10

G: 18.59, -49.39, -1.24 deg/s

A: 0.07, 0.06, 1.02 g

M: 0.16, 0.15, -0.36 gauss

Pitch, Roll: -4.19, 3.23

Heading: 230.95

G: 18.64, -49.61, -1.40 deg/s

A: 0.05, 0.09, 0.98 g

M: 0.18, 0.15, -0.37 gauss

Pitch, Roll: -3.20, 5.46

Heading: 227.85

G: 18.54, -49.25, -1.23 deg/s

A: 0.07, 0.00, 0.96 g

M: 0.22, 0.13, -0.39 gauss

Pitch, Roll: -4.45, 0.09

Heading: 219.26

G: 18.65, -49.49, -1.29 deg/s

A: 0.10, 0.05, 1.01 g

M: 0.23, 0.11, -0.40 gauss

Pitch, Roll: -5.66, 2.95

Heading: 213.95

G: 18.85, -49.34, -1.40 deg/s

A: 0.02, -0.00, 1.04 g

M: 0.22, 0.11, -0.41 gauss

Pitch, Roll: -0.91, -0.23

Heading: 214.23

G: 18.85, -49.41, -1.53 deg/s

A: 0.15, 0.14, 1.00 g

M: 0.23, 0.11, -0.42 gauss

Pitch, Roll: -8.60, 7.73

Heading: 213.92

G: 18.93, -49.53, -1.44 deg/s

A: 0.08, 0.01, 0.96 g

M: 0.25, 0.11, -0.44 gauss

Pitch, Roll: -4.88, 0.46

Heading: 212.78

G: 18.73, -49.67, -1.26 deg/s

A: 0.12, 0.08, 1.01 g

M: 0.28, 0.11, -0.43 gauss

Pitch, Roll: -6.79, 4.63

Heading: 209.47

G: 18.76, -49.47, -1.39 deg/s

A: 0.14, 0.00, 0.99 g

M: 0.28, 0.09, -0.41 gauss

Pitch, Roll: -8.01, 0.00

Heading: 205.63

G: 18.79, -49.48, -1.33 deg/s

A: 0.04, 0.05, 1.02 g

M: 0.29, 0.07, -0.41 gauss

Pitch, Roll: -2.25, 3.05

Heading: 202.03

G: 18.89, -49.32, -1.50 deg/s

A: 0.05, 0.02, 1.00 g

M: 0.29, 0.06, -0.41 gauss

Pitch, Roll: -2.64, 1.04

Heading: 200.11

G: 18.81, -49.67, -1.29 deg/s

A: 0.05, 0.02, 1.01 g

M: 0.29, 0.06, -0.41 gauss

Pitch, Roll: -2.81, 0.97

Heading: 201.25

G: 18.85, -49.53, -1.44 deg/s

A: 0.05, 0.02, 1.01 g

M: 0.29, 0.06, -0.41 gauss

Pitch, Roll: -2.83, 1.08

Heading: 200.65

G: 18.83, -49.55, -1.46 deg/s

A: 0.05, 0.02, 1.01 g

M: 0.29, 0.06, -0.40 gauss

Pitch, Roll: -2.95, 0.88

Heading: 200.18

G: 18.70, -49.54, -1.29 deg/s

A: 0.05, 0.01, 1.01 g

M: 0.28, 0.06, -0.40 gauss

Pitch, Roll: -2.94, 0.78

Heading: 200.44

G: 18.79, -49.29, -1.31 deg/s

A: 0.05, 0.02, 1.01 g

M: 0.29, 0.06, -0.40 gauss

Pitch, Roll: -2.96, 0.87

Heading: 199.98

G: 18.75, -49.74, -1.55 deg/s

A: 0.05, 0.02, 1.00 g

M: 0.29, 0.06, -0.40 gauss

Pitch, Roll: -2.94, 1.01

Heading: 199.69

G: 18.65, -49.50, -1.30 deg/s

A: 0.05, 0.01, 1.01 g

M: 0.28, 0.05, -0.40 gauss

Pitch, Roll: -3.05, 0.62

Heading: 198.92

G: 18.79, -49.61, -1.50 deg/s

A: 0.05, 0.01, 1.00 g

M: 0.29, 0.06, -0.39 gauss

Pitch, Roll: -2.79, 0.83

Heading: 199.65

G: 18.51, -49.47, -1.46 deg/s

A: 0.05, 0.01, 1.00 g

M: 0.29, 0.05, -0.40 gauss

Pitch, Roll: -2.97, 0.75

Heading: 199.38

G: 18.54, -49.51, -1.37 deg/s

A: 0.05, 0.01, 1.00 g

M: 0.28, 0.05, -0.41 gauss

Pitch, Roll: -3.13, 0.29

Heading: 199.32

Second test run: putting the board up straight (90 degrees up) and back. The values for “A” vary as expected, but G stays constant (sort of), while M seems to respond more: Mz goes from -0.4 to -0.1 and back.

G: 18.84, -49.26, -1.41 deg/s

A: 0.05, 0.03, 1.00 g

M: 0.29, 0.06, -0.38 gauss

Pitch, Roll: -2.93, 1.85

Heading: 199.54

G: 18.93, -49.28, -1.41 deg/s

A: 0.05, 0.03, 1.01 g

M: 0.29, 0.06, -0.38 gauss

Pitch, Roll: -2.92, 1.83

Heading: 200.00

G: 18.65, -49.38, -1.19 deg/s

A: 0.05, 0.03, 1.01 g

M: 0.29, 0.06, -0.38 gauss

Pitch, Roll: -3.08, 1.66

Heading: 200.22

G: 18.83, -49.44, -1.19 deg/s

A: 0.06, 0.03, 1.01 g

M: 0.29, 0.06, -0.38 gauss

Pitch, Roll: -3.33, 1.76

Heading: 199.52

G: 18.77, -49.33, -1.50 deg/s

A: 0.05, 0.03, 1.01 g

M: 0.29, 0.06, -0.38 gauss

Pitch, Roll: -2.96, 1.83

Heading: 200.70

G: 18.80, -49.31, -1.34 deg/s

A: 0.05, 0.03, 1.00 g

M: 0.29, 0.06, -0.38 gauss

Pitch, Roll: -2.82, 1.82

Heading: 199.80

G: 18.80, -49.47, -1.33 deg/s

A: 0.05, 0.03, 1.00 g

M: 0.29, 0.06, -0.37 gauss

Pitch, Roll: -2.73, 1.70

Heading: 199.70

G: 18.93, -49.37, -1.37 deg/s

A: 0.05, 0.03, 1.01 g

M: 0.29, 0.05, -0.38 gauss

Pitch, Roll: -2.78, 1.64

Heading: 199.05

G: 18.64, -49.45, -1.46 deg/s

A: 0.05, 0.04, 1.00 g

M: 0.30, 0.07, -0.37 gauss

Pitch, Roll: -2.89, 2.24

Heading: 201.01

G: 19.09, -49.39, -1.36 deg/s

A: 0.05, 0.03, 1.01 g

M: 0.29, 0.06, -0.37 gauss

Pitch, Roll: -2.65, 1.66

Heading: 200.66

G: 19.00, -49.34, -1.30 deg/s

A: 0.03, 0.04, 0.98 g

M: 0.29, 0.06, -0.37 gauss

Pitch, Roll: -2.00, 2.50

Heading: 200.76

G: 18.73, -49.46, -1.39 deg/s

A: 0.10, -0.03, 1.02 g

M: 0.30, 0.06, -0.37 gauss

Pitch, Roll: -5.51, -1.72

Heading: 200.59

G: 18.59, -49.35, -1.24 deg/s

A: 0.12, 0.04, 0.98 g

M: 0.31, 0.07, -0.37 gauss

Pitch, Roll: -7.19, 2.39

Heading: 200.60

G: 18.61, -49.56, -1.38 deg/s

A: 0.24, 0.05, 0.94 g

M: 0.33, 0.06, -0.36 gauss

Pitch, Roll: -14.43, 2.91

Heading: 199.38

G: 18.64, -49.57, -1.44 deg/s

A: 0.25, -0.01, 1.11 g

M: 0.36, 0.06, -0.35 gauss

Pitch, Roll: -12.49, -0.33

Heading: 198.08

G: 18.92, -49.48, -1.63 deg/s

A: 0.41, 0.08, 0.87 g

M: 0.39, 0.06, -0.34 gauss

Pitch, Roll: -25.36, 5.36

Heading: 197.30

G: 18.69, -49.52, -1.41 deg/s

A: 0.62, 0.08, 0.80 g

M: 0.42, 0.06, -0.31 gauss

Pitch, Roll: -37.86, 5.46

Heading: 196.90

G: 18.94, -49.51, -1.37 deg/s

A: 0.71, 0.03, 0.74 g

M: 0.44, 0.06, -0.28 gauss

Pitch, Roll: -43.87, 2.28

Heading: 196.15

G: 18.84, -49.43, -1.30 deg/s

A: 0.79, 0.08, 0.53 g

M: 0.46, 0.07, -0.25 gauss

Pitch, Roll: -55.96, 8.52

Heading: 197.00

G: 18.64, -49.28, -1.45 deg/s

A: 0.84, -0.01, 0.58 g

M: 0.47, 0.06, -0.22 gauss

Pitch, Roll: -55.55, -1.12

Heading: 195.90

G: 18.67, -49.42, -1.44 deg/s

A: 0.92, 0.02, 0.43 g

M: 0.49, 0.06, -0.19 gauss

Pitch, Roll: -64.59, 2.85

Heading: 195.64

G: 18.78, -49.39, -1.41 deg/s

A: 0.95, 0.01, 0.37 g

M: 0.48, 0.06, -0.16 gauss

Pitch, Roll: -68.68, 1.34

Heading: 195.63

G: 18.92, -49.67, -1.42 deg/s

A: 0.96, 0.01, 0.27 g

M: 0.49, 0.06, -0.13 gauss

Pitch, Roll: -74.22, 1.09

Heading: 195.69

G: 18.56, -49.36, -1.42 deg/s

A: 0.98, 0.01, 0.19 g

M: 0.48, 0.06, -0.12 gauss

Pitch, Roll: -79.23, 3.59

Heading: 195.61

G: 18.84, -49.57, -1.41 deg/s

A: 1.04, -0.01, 0.16 g

M: 0.48, 0.06, -0.10 gauss

Pitch, Roll: -81.32, -3.46

Heading: 195.55

G: 18.60, -49.67, -1.50 deg/s

A: 1.00, 0.00, 0.05 g

M: 0.48, 0.06, -0.08 gauss

Pitch, Roll: -87.06, 4.63

Heading: 195.79

G: 18.70, -49.25, -1.41 deg/s

A: 1.00, 0.02, 0.05 g

M: 0.48, 0.06, -0.08 gauss

Pitch, Roll: -87.22, 19.80

Heading: 195.75

G: 18.61, -49.43, -1.49 deg/s

A: 1.00, 0.01, 0.05 g

M: 0.47, 0.06, -0.08 gauss

Pitch, Roll: -87.25, 17.14

Heading: 195.73

G: 18.74, -49.43, -1.44 deg/s

A: 1.00, 0.02, 0.04 g

M: 0.47, 0.06, -0.08 gauss

Pitch, Roll: -87.29, 21.76

Heading: 195.86

G: 18.74, -49.53, -1.49 deg/s

A: 1.00, 0.01, 0.05 g

M: 0.48, 0.06, -0.09 gauss

Pitch, Roll: -87.01, 11.93

Heading: 195.54

G: 18.89, -49.48, -1.47 deg/s

A: 1.00, 0.01, 0.06 g

M: 0.48, 0.06, -0.09 gauss

Pitch, Roll: -86.72, 8.47

Heading: 195.34

G: 18.65, -49.46, -1.48 deg/s

A: 1.01, 0.04, 0.08 g

M: 0.48, 0.06, -0.10 gauss

Pitch, Roll: -84.76, 26.07

Heading: 195.68

G: 18.86, -49.45, -1.47 deg/s

A: 0.93, 0.03, 0.35 g

M: 0.48, 0.06, -0.16 gauss

Pitch, Roll: -69.55, 4.72

Heading: 195.64

G: 18.91, -49.49, -1.54 deg/s

A: 0.73, 0.08, 0.57 g

M: 0.46, 0.05, -0.25 gauss

Pitch, Roll: -52.00, 8.10

Heading: 194.63

G: 18.77, -49.46, -1.43 deg/s

A: 0.56, -0.04, 0.98 g

M: 0.40, 0.06, -0.33 gauss

Pitch, Roll: -29.75, -2.24

Heading: 197.63

G: 18.66, -49.60, -1.41 deg/s

A: 0.21, 0.00, 1.02 g

M: 0.33, 0.05, -0.38 gauss

Pitch, Roll: -11.63, 0.13

Heading: 197.72

G: 18.76, -49.40, -1.46 deg/s

A: 0.06, -0.04, 1.05 g

M: 0.30, 0.06, -0.38 gauss

Pitch, Roll: -3.11, -2.11

Heading: 199.48

G: 18.79, -49.40, -1.38 deg/s

A: 0.03, 0.03, 0.98 g

M: 0.29, 0.06, -0.40 gauss

Pitch, Roll: -1.83, 1.69

Heading: 200.53

G: 18.63, -49.46, -1.38 deg/s

A: 0.06, 0.01, 1.01 g

M: 0.29, 0.07, -0.39 gauss

Pitch, Roll: -3.14, 0.66

Heading: 201.34

G: 18.72, -49.54, -1.64 deg/s

A: 0.05, 0.02, 1.00 g

M: 0.29, 0.06, -0.39 gauss

Pitch, Roll: -2.89, 0.90

Heading: 200.92

G: 19.07, -49.25, -1.45 deg/s

A: 0.05, 0.01, 1.00 g

M: 0.29, 0.06, -0.40 gauss

Pitch, Roll: -3.05, 0.86

Heading: 200.72

G: 18.83, -49.67, -1.17 deg/s

A: 0.05, 0.02, 1.00 g

M: 0.29, 0.06, -0.40 gauss

Pitch, Roll: -3.10, 1.00

Heading: 200.71

G: 18.60, -49.23, -1.35 deg/s

A: 0.05, 0.01, 1.00 g

M: 0.29, 0.06, -0.40 gauss

Pitch, Roll: -3.11, 0.61

Heading: 200.43

G: 18.70, -49.50, -1.43 deg/s

A: 0.05, 0.01, 1.00 g

M: 0.29, 0.06, -0.40 gauss

Pitch, Roll: -3.06, 0.85

Heading: 200.72

G: 18.48, -49.60, -1.42 deg/s

A: 0.05, 0.02, 1.00 g

M: 0.28, 0.06, -0.40 gauss

Pitch, Roll: -2.79, 1.02

Heading: 199.79

G: 18.74, -49.40, -1.36 deg/s

A: 0.04, 0.02, 1.00 g

M: 0.29, 0.06, -0.40 gauss

Pitch, Roll: -2.15, 1.10

Heading: 200.71

G: 18.73, -49.46, -1.61 deg/s

A: 0.05, 0.02, 1.00 g

M: 0.29, 0.06, -0.40 gauss

Pitch, Roll: -3.00, 0.99

Heading: 200.53

G: 18.89, -49.38, -1.42 deg/s

A: 0.06, 0.02, 1.01 g

M: 0.29, 0.06, -0.40 gauss

Pitch, Roll: -3.19, 0.93

Heading: 201.08

G: 18.55, -49.47, -1.37 deg/s

A: 0.05, 0.01, 1.00 g

M: 0.29, 0.06, -0.39 gauss

Pitch, Roll: -3.01, 0.83

Heading: 200.59

or might I have overlooked something?

Probably. All magnetometers need to be calibrated to be useful. See this extensive tutorial https://thecavepearlproject.org/2015/05 … r-arduino/

Accelerometers benefit from calibration as well, and all gyros drift, so you need to calculate and subtract the gyro offsets fairly frequently.

Thanks. That kind of information is hard to find. Datasheets and tutorials are everywhere, but they all end too prematurely…

I did overlook something else: the magnetic field at my desk is probably high: there are two speakers nearby. The magnetic sensor functioned elsewhere. Unfortunately, the gyroscope reading is now stuck. Well, that’s another problem.

Thanks again!

OK,

"The 9DoF Sensor Stick is an easy-to-use 9 degrees of freedom IMU. "

"The default values set by this sketch should work for a fresh, out-of-the-box 9DoF Sensor Stick – it assumes both of the address jumpers haven’t been modified. Upload the sketch, then open up your serial monitor, setting the baud rate to 115200. You should see something like this:

All good so far.

Now where is the support documentation that can help trouble shoot a non-functional magnetometer? I don’t see the how to get started with calibrations of the sensors or any mention of how involved that may actually be.

Far from working out of the box.

Read the previous posts for links to the required calibration procedures.

Sparkfun employees don’t seem to understand or use them, which is why you see such misleading comments as “works out of the box”.

jremington:
Read the previous posts for links to the required calibration procedures.

Sparkfun employees don’t seem to understand or use them, which is why you see such misleading comments as “works out of the box”.

I will give it another try but while the procedures seem quite exhaustive, I’m not clear what to do to the code or Library to include the offsets after determining them by following the calibration procedure. I can’t get the unit to produce heading values other than +/- 12 degrees or so from what ever is displayed at start up.

I’ll see it I can figure out how to capture the Mx/My values at various increments of orientation using a precision compass and then compare against the calculated heading values to see if there is something to be learned there.

Yes, some effort on your part is required, if you want to get the most out of your IMU.

All the required code and instructions for calibrating a magnetometer and applying the resulting corrections can be found in this post.

https://forum.pololu.com/t/correcting-t … eter/14315

Will work for accelerometers as well. See also this comprehensive tutorial: https://thecavepearlproject.org/2015/05 … r-arduino/

It really is disappointing that Sparkfun employees don’t care enough about their products to implement them properly, but that is the way with most hobby tech suppliers.

Does the below code (found in the LSM9DS1_Basic_I2C sketch)

float heading;

if (my == 0)

heading = (mx < 0) ? PI : 0;

else

heading = atan2(mx, my);

if (heading > PI) heading -= (2 * PI);

else if (heading < PI) heading += (2 * PI);

heading *= 180.0 / PI; // Convert everything from radians to degrees:

pitch *= 180.0 / PI;

roll *= 180.0 / PI;

Effectively do this (provided by a Honeywell technical article)?

Direction (y>0) = 90 - [arcTAN(x/y)]*180/¹

Direction (y<0) = 270 - [arcTAN(x/y)]*180/¹

Direction (y=0, x<0) = 180.0

Direction (y=0, x>0) = 0.0

I’m not convinced.

To me, both code fragments are nonsense.

jremington:
To me, both code fragments are nonsense.

Then perhaps that is part of the answer as to why it doesn’t seem to work correctly.

One opinion is that the chip is simply defective. I will replace it when more are in stock. The pitch and roll are functional and I should be able to make something work with those two anyway.

Question for the community. If calibration is so critical to proper function of this type device, why is it that how to do so seems to be so elusive? Whay not incorporate an auto-calibrate feature and instructions that come along with the device?

I don’t mind the challenge of researching and learning how to make something work but seems to be a missing part of the puzzle that should be included in the box so to speak.

seems to be a missing part of the puzzle that should be included in the box so to speak.

It is missing from Sparkfun IMU products, because Sparkfun employees either don’t understand the need for it, don’t understand the procedures, or don’t care what their customers do with those particular products. Most of their customers probably don’t care either.

Pololu engineers do a much better job, and include simple axial calibration procedures in their example code, but proper calibration (as described in the links above) requires a rather large program that runs on a PC.

jremington,

Several of the IMU breakout boards indicate several options for “sensitivity” or levels of performance for the sensors. I’m trying to learn how to write to a register to set the individual levels. Any suggestion where to look to get more up to speed with regard to how exactly to “write to a register”

I have both the LSM9DS1 and MPU_9250 hooked up on the same RedBoard and using a combination sketch have both running simultaneously and printing to the Serial monitor and an LCD display so I can compare Mx My Mz and respective calculated values for heading.

Digging into the Datasheets I find I have a lot to learn in addition to the calibration routine you recommend.

SparkFun does have a video that seems to be a start but what else is there that would be a resource for learning how to perform the task of setting these levels with code in my sketch?