ST意法半导体
直播中

陈俊

7年用户 227经验值
私信 关注
[问答]

LSM9DS0和LSM9DS1之间的磁强计差异

我们正在将IMU从LSM9DS0升级到LSM9DS1。但是我们在LSM9DS1上遇到了磁力计的问题。即使在最小/最大校准之后,它似乎也没有给出正确的航向。
我们意识到方向已经改变并考虑到了这一点。
当使用这个简单的公式时,我会期待一些可用的结果(这与LSM9DS0完美配合)......但这不是我们所看到的。
heading = 180 * math.atan2(MAGy,MAGx)/ M_PI
为了排除我们的PCB设计,我们购买了使用Adafruit和Sparkfun的LSM9DS1的产品,这些产品也有同样的问题。
以下是用于启动磁力计的代码

以上来自于谷歌翻译


以下为原文




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

  • )

  • â€�â€�â€�â€�â€�â€�â€�â€�â€�â€�â€�â€�â€�â€�â€�â€�â€�â€�â€�â€�â€�â€�â€�â€�â€�â€�â€�â€�â€�â€�â€�â€�â€�â€�â€�â€�â€�â€�â€�â€�â€�â€�â€�â€�â€�â€�â€�â€�â€�â€�â€�â€�â€�â€�â€�â€�â€�â€�â€�â€�â€�â€�â€�â€�â€�â€�â€�â€�â€�â€�â€�â€�â€�â€�â€�â€�â€�â€�â€�â€�â€�â€�â€�â€�â€�â€�â€�â€�â€�â€�â€�â€�â€�â€�â€�â€�â€�â€�â€�â€�â€�â€�â€�â€�â€�â€�â€�â€�â€�â€�â€�â€�â€�â€�â€�â€�â€�

  • â€�

  • â€�

  • â€�

  • â€�

  • â€�

  • â€�

  • â€�

  • â€�

  • â€�

  • â€�

  • â€�

  • â€�

  • â€�

  • â€�

  • â€�

  • â€�

  • â€�

  • â€�

  • â€�

  • â€�

  • â€�

  • â€�

  • â€�

  • â€�

  • â€�

  • â€�

  • â€�

  • â€�

  • â€�

  • â€�

  • â€�

  • â€�

  • â€�

  • â€�

  • â€�

  • â€�

  • â€�

  • â€�

  • â€�

回帖(1)

曾玲娟

2019-6-12 13:18:51
航向计算的原理不依赖于使用的磁力计,因此LSM9DS0和LSM9DS1之间不应有任何区别。
 
只有当传感器处于水平位置时,才能使用您使用的简单公式。任何倾斜都会产生误差。您可以沿Z轴在几圈内记录磁力计X,Y轴数据。如果硬铁补偿正确完成,则应创建圆心,中心位于[0,0]。
可能还会出现软铁错误,因此它将是椭圆形而不是圆形,但如果失真不大,则公式应该仍然有效。
如果你想测量地球磁场的范围是12高斯相当高,我会用4高斯范围代替。

以上来自于谷歌翻译


以下为原文




The principle for heading calculation is not dependent on the used magnetometer, so there should't be any difference between LSM9DS0 and LSM9DS1.

The simple formula which you are using can be used only if the sensor is horizontal position. Any tilt will generate error.Can you please log magnetometer X,Y axis data during several turns along Z axis. If the hard-iron compensation is done properly it should created circle with center in [0,0].
There will be probably also soft iron error so it will be ellipse instead of circle, but if the distortion won't be  big the formula should work anyway.
If you want to measure earth magnetic field the range 12 Gauss is quite high, I would use 4 Gauss range instead.
举报

更多回帖

发帖
×
20
完善资料,
赚取积分