AnsweredAssumed Answered

Magnetometer difference between LSM9DS0 and LSM9DS1

Question asked by Mark Williams on Apr 11, 2017
Latest reply on Apr 12, 2017 by Miroslav B

We are upgrading our IMU from a LSM9DS0 to LSM9DS1.  However we are having issues with the magnetometer on the LSM9DS1.  Even after min/max calibration it doesn't appear to give correct heading.

 

 

We are aware that the orientation has changed and have taking this into consideration.

 

When using this simple formula, i would expect some usable results (this works perfectly witht he LSM9DS0)... however this is not what we are seeing.

heading = 180 * math.atan2(MAGy,MAGx)/M_PI

 

To rule out our PCB design, we have purchased products which use LSM9DS1 from Adafruit and Sparkfun, and these also have the same issue.

 

 

Below is the code used to initiate the magnetometer

# CTRL_REG1_M (Default value: 0b0001 0000)
# [TEMP_COMP][OM1][OM0][DO2][DO1][DO0][0][ST]
# TEMP_COMP - Temperature compensation
# OM[1:0] - X & Y axes op mode selection
# 00:low-power, 01:medium performance
# 10: high performance, 11:ultra-high performance
# DO[2:0] - Output data rate selection
# ST - Self-test enable
writeMAG(CTRL_REG1_M, 0b01011100)#;


# CTRL_REG2_M (Default value 0x00)
# [0][FS1][FS0][0][REBOOT][SOFT_RST][0][0]
# FS[1:0] - Full-scale configuration
# 00:+/- 4 gauss
# 01:+/- 8 gauss
# 10:+/- 12 gauss
# 11:+/- 16 gauss
# REBOOT - Reboot memory content (0:normal, 1:reboot)
# SOFT_RST - Reset config and user registers (0:default, 1:reset)
writeMAG(CTRL_REG2_M, 0b01000000)#;

# CTRL_REG3_M (Default value: 0x03)
# [I2C_DISABLE][0][LP][0][0][SIM][MD1][MD0]
# I2C_DISABLE - Disable I2C interace (0:enable, 1:disable)
# LP - Low-power mode cofiguration (1:enable)
# SIM - SPI mode selection (0:write-only, 1:read/write enable)
# MD[1:0] - Operating mode
# 00:continuous conversion, 01:single-conversion,
# 10,11: Power-down
writeMAG(CTRL_REG3_M, 0b00000000)#;

# CTRL_REG4_M (Default value: 0x00)
# [0][0][0][0][OMZ1][OMZ0][BLE][0]
# OMZ[1:0] - Z-axis operative mode selection
# 00:low-power mode, 01:medium performance
# 10:high performance, 10:ultra-high performance
# BLE - Big/little endian data
writeMAG(CTRL_REG4_M, 0b00001000)

Outcomes