社区导航

 
快捷导航
  • 首页
  • 论坛
  • 查看新帖
  • 最新回复
  • 社区活动
  • 联系管理员
  • 消灭零回复
  • E金币兑换
  • 干货
搜索
查看: 269|回复: 7

[工业类传感器] LSM6DSM器件静置在水平上原始数据XYZ三轴跳变

[复制链接]

72

TA的帖子

0

TA的资源

一粒金砂(中级)

Rank: 2

发表于 2017-11-30 10:52:13 | 显示全部楼层 |阅读模式
LSM6DSM这颗传感器放置在水平面上静置不动,串口读出的数据却是跳变的。原始数据如附件。其中xl->data_raw数据是直接从寄存器中读出来的分别是0X28 0X2A 0X2C这上第八位寄存器读出
xl->x,y,z数据是经过计算得出的。这是原始数据出来计算公式#define FROM_FS_2g_TO_mg( lsb )      (int32_t)( ( lsb * 61 )  / 1000)
我用的是2g的量程。
问题是为什么静置的时候XYZ三轴数据会波动如此之大,理论上应该是静止不变的。陀螺仪的数据倒是不变是正常的。


回复

使用道具 举报

72

TA的帖子

0

TA的资源

一粒金砂(中级)

Rank: 2

 楼主| 发表于 2017-11-30 10:54:21 | 显示全部楼层
附件是log

session.log

250.88 KB, 下载次数: 2

点评

你的的数据波动是挺大的我用手里的BlueCoin开发板测了一下LSM6DSM结果如下 如果你还有其它LIS6DSM传感器板子可以再试另一个看下,排除传感器硬件问题 排除传感器问题后可以再看一下代码,是不是哪个地方没有配置好  详情 回复 发表于 2017-11-30 11:49


回复

使用道具 举报

4560

TA的帖子

9

TA的资源

版主

Rank: 6Rank: 6

发表于 2017-11-30 11:49:59 | 显示全部楼层

你的的数据波动是挺大的我用手里的BlueCoin开发板测了一下LSM6DSM结果如下
如果你还有其它LIS6DSM传感器板子可以再试另一个看下,排除传感器硬件问题
排除传感器问题后可以再看一下代码,是不是哪个地方没有配置好,
http://www.st.com/content/st_com ... e/stsw-bcnkt01.html
这个官方例程里有LIS6DSM的代码,你可以参考一下
另外传感器数据变化大还和你的测试环境振动有关,可以尽量将传感器放在比较稳定的桌面或者平台上
[C] 纯文本查看 复制代码
Acc_X: -26, Acc_Y: -11, Acc_Z :-1033
Acc_X: -26, Acc_Y: -15, Acc_Z :-1033
Acc_X: -26, Acc_Y: -15, Acc_Z :-1052
Acc_X: -19, Acc_Y: -3, Acc_Z :-1021
Acc_X: -34, Acc_Y: -15, Acc_Z :-1048
Acc_X: -19, Acc_Y: -7, Acc_Z :-1044
Acc_X: -26, Acc_Y: -7, Acc_Z :-1044
Acc_X: -22, Acc_Y: -11, Acc_Z :-1033
Acc_X: -30, Acc_Y: -7, Acc_Z :-1036
Acc_X: -19, Acc_Y: -11, Acc_Z :-1036
Acc_X: -22, Acc_Y: -11, Acc_Z :-1040
Acc_X: -22, Acc_Y: -11, Acc_Z :-1036
Acc_X: -22, Acc_Y: -7, Acc_Z :-1029
Acc_X: -26, Acc_Y: -7, Acc_Z :-1036
Acc_X: -19, Acc_Y: -3, Acc_Z :-1033
Acc_X: -22, Acc_Y: -3, Acc_Z :-1033
Acc_X: -26, Acc_Y: -7, Acc_Z :-1029
Acc_X: -11, Acc_Y: -15, Acc_Z :-1029
Acc_X: -22, Acc_Y: -11, Acc_Z :-1036
Acc_X: -22, Acc_Y: -7, Acc_Z :-1033
Acc_X: -22, Acc_Y: -11, Acc_Z :-1036
Acc_X: -30, Acc_Y: -3, Acc_Z :-1033
Acc_X: -19, Acc_Y: -7, Acc_Z :-1036
Acc_X: -30, Acc_Y: -15, Acc_Z :-1036
Acc_X: -15, Acc_Y: -15, Acc_Z :-1036
Acc_X: -15, Acc_Y: -15, Acc_Z :-1040
Acc_X: -19, Acc_Y: -7, Acc_Z :-1036
Acc_X: -22, Acc_Y: -15, Acc_Z :-1025
Acc_X: -22, Acc_Y: -15, Acc_Z :-1033
Acc_X: -19, Acc_Y: -7, Acc_Z :-1036
Acc_X: -26, Acc_Y: -11, Acc_Z :-1033
Acc_X: -22, Acc_Y: -15, Acc_Z :-1040
Acc_X: -15, Acc_Y: -7, Acc_Z :-1040
Acc_X: -26, Acc_Y: -11, Acc_Z :-1036
Acc_X: -15, Acc_Y: -7, Acc_Z :-1036
Acc_X: -22, Acc_Y: 0, Acc_Z :-1040
Acc_X: -22, Acc_Y: -7, Acc_Z :-1033
Acc_X: -19, Acc_Y: -7, Acc_Z :-1033
Acc_X: -11, Acc_Y: -11, Acc_Z :-1033
Acc_X: -22, Acc_Y: -15, Acc_Z :-1036
Acc_X: -15, Acc_Y: -15, Acc_Z :-1036
Acc_X: -22, Acc_Y: -7, Acc_Z :-1040
Acc_X: -19, Acc_Y: -7, Acc_Z :-1033
Acc_X: -19, Acc_Y: -11, Acc_Z :-1033
Acc_X: -22, Acc_Y: -7, Acc_Z :-1033
Acc_X: -15, Acc_Y: -11, Acc_Z :-1040
Acc_X: -15, Acc_Y: -11, Acc_Z :-1048
Acc_X: -19, Acc_Y: -11, Acc_Z :-1040
Acc_X: -22, Acc_Y: -7, Acc_Z :-1044
Acc_X: -19, Acc_Y: -7, Acc_Z :-1036
Acc_X: -15, Acc_Y: 0, Acc_Z :-1036
Acc_X: -22, Acc_Y: -7, Acc_Z :-1025
Acc_X: -15, Acc_Y: -7, Acc_Z :-1040
Acc_X: -26, Acc_Y: -19, Acc_Z :-1036
Acc_X: -22, Acc_Y: -11, Acc_Z :-1036
Acc_X: -15, Acc_Y: -15, Acc_Z :-1040
Acc_X: -15, Acc_Y: -7, Acc_Z :-1036
Acc_X: -22, Acc_Y: -11, Acc_Z :-1029
Acc_X: -22, Acc_Y: -7, Acc_Z :-1029
Acc_X: -22, Acc_Y: -11, Acc_Z :-1040
Acc_X: -22, Acc_Y: -3, Acc_Z :-1040
Acc_X: -22, Acc_Y: -3, Acc_Z :-1036
Acc_X: -22, Acc_Y: -3, Acc_Z :-1036
Acc_X: -15, Acc_Y: -7, Acc_Z :-1036
Acc_X: -19, Acc_Y: -7, Acc_Z :-1040
Acc_X: -15, Acc_Y: -11, Acc_Z :-1040
Acc_X: -15, Acc_Y: -15, Acc_Z :-1036
Acc_X: -19, Acc_Y: -11, Acc_Z :-1033
Acc_X: -15, Acc_Y: -11, Acc_Z :-1021
Acc_X: -19, Acc_Y: -15, Acc_Z :-1040
Acc_X: -15, Acc_Y: -7, Acc_Z :-1033
Acc_X: -19, Acc_Y: -7, Acc_Z :-1033
Acc_X: -19, Acc_Y: -7, Acc_Z :-1033
Acc_X: -19, Acc_Y: -11, Acc_Z :-1036
Acc_X: -15, Acc_Y: -3, Acc_Z :-1044
Acc_X: -19, Acc_Y: -19, Acc_Z :-1052
Acc_X: -15, Acc_Y: -11, Acc_Z :-1036
Acc_X: -11, Acc_Y: -7, Acc_Z :-1029
Acc_X: -19, Acc_Y: -11, Acc_Z :-1036
Acc_X: -15, Acc_Y: -11, Acc_Z :-1033
Acc_X: -11, Acc_Y: -15, Acc_Z :-1036
Acc_X: -22, Acc_Y: -11, Acc_Z :-1036
Acc_X: -19, Acc_Y: -19, Acc_Z :-1036
Acc_X: -19, Acc_Y: -3, Acc_Z :-1036
Acc_X: -11, Acc_Y: -11, Acc_Z :-1040
Acc_X: -11, Acc_Y: -11, Acc_Z :-1033
Acc_X: -19, Acc_Y: -3, Acc_Z :-1033
Acc_X: -15, Acc_Y: -3, Acc_Z :-1036
Acc_X: -19, Acc_Y: -7, Acc_Z :-1029
Acc_X: -15, Acc_Y: -7, Acc_Z :-1044
Acc_X: -15, Acc_Y: -11, Acc_Z :-1036
Acc_X: -15, Acc_Y: -11, Acc_Z :-1033
Acc_X: -15, Acc_Y: -7, Acc_Z :-1044
Acc_X: -15, Acc_Y: -11, Acc_Z :-1040
Acc_X: -19, Acc_Y: -11, Acc_Z :-1033
Acc_X: -15, Acc_Y: -15, Acc_Z :-1029
Acc_X: -19, Acc_Y: -15, Acc_Z :-1036
Acc_X: -22, Acc_Y: -3, Acc_Z :-1044
Acc_X: -15, Acc_Y: -7, Acc_Z :-1036
Acc_X: -19, Acc_Y: -11, Acc_Z :-1036
Acc_X: -15, Acc_Y: -7, Acc_Z :-1040
Acc_X: -19, Acc_Y: -3, Acc_Z :-1033
Acc_X: -15, Acc_Y: -11, Acc_Z :-1036
Acc_X: -15, Acc_Y: -11, Acc_Z :-1040
Acc_X: -15, Acc_Y: -19, Acc_Z :-1040
Acc_X: -15, Acc_Y: 0, Acc_Z :-1033
Acc_X: -19, Acc_Y: -11, Acc_Z :-1040
Acc_X: -15, Acc_Y: -3, Acc_Z :-1036
Acc_X: -15, Acc_Y: -15, Acc_Z :-1033
Acc_X: -11, Acc_Y: -11, Acc_Z :-1033
Acc_X: -15, Acc_Y: -7, Acc_Z :-1033
Acc_X: -19, Acc_Y: -7, Acc_Z :-1036
Acc_X: -19, Acc_Y: -3, Acc_Z :-1040
Acc_X: -15, Acc_Y: -15, Acc_Z :-1036
Acc_X: -11, Acc_Y: -11, Acc_Z :-1040
Acc_X: -11, Acc_Y: -11, Acc_Z :-1036
Acc_X: -11, Acc_Y: -11, Acc_Z :-1029
Acc_X: -7, Acc_Y: -15, Acc_Z :-1036
Acc_X: -19, Acc_Y: -11, Acc_Z :-1040
Acc_X: -15, Acc_Y: -7, Acc_Z :-1040
Acc_X: -15, Acc_Y: -19, Acc_Z :-1029
Acc_X: -11, Acc_Y: -15, Acc_Z :-1033
Acc_X: -11, Acc_Y: -7, Acc_Z :-1029
Acc_X: -7, Acc_Y: -11, Acc_Z :-1040
Acc_X: -11, Acc_Y: -11, Acc_Z :-1036
Acc_X: -15, Acc_Y: -7, Acc_Z :-1040
Acc_X: -15, Acc_Y: -11, Acc_Z :-1036
Acc_X: -15, Acc_Y: -11, Acc_Z :-1036
Acc_X: -11, Acc_Y: -11, Acc_Z :-1036
Acc_X: -11, Acc_Y: -11, Acc_Z :-1033
Acc_X: -15, Acc_Y: -7, Acc_Z :-1036
Acc_X: -7, Acc_Y: -19, Acc_Z :-1040
Acc_X: -7, Acc_Y: -7, Acc_Z :-1033
Acc_X: -11, Acc_Y: -11, Acc_Z :-1040
Acc_X: -11, Acc_Y: -11, Acc_Z :-1033
Acc_X: -7, Acc_Y: -7, Acc_Z :-1029
Acc_X: -11, Acc_Y: -7, Acc_Z :-1033
Acc_X: -19, Acc_Y: -11, Acc_Z :-1033
Acc_X: -11, Acc_Y: -15, Acc_Z :-1044
Acc_X: -7, Acc_Y: -7, Acc_Z :-1033
Acc_X: -11, Acc_Y: -7, Acc_Z :-1036
Acc_X: -7, Acc_Y: -11, Acc_Z :-1036
Acc_X: -15, Acc_Y: -7, Acc_Z :-1036
Acc_X: -11, Acc_Y: -19, Acc_Z :-1040
Acc_X: -3, Acc_Y: -15, Acc_Z :-1033
Acc_X: -11, Acc_Y: -19, Acc_Z :-1036
Acc_X: -11, Acc_Y: -7, Acc_Z :-1025
Acc_X: -11, Acc_Y: -7, Acc_Z :-1040
Acc_X: 8, Acc_Y: -7, Acc_Z :-1033
Acc_X: -11, Acc_Y: -15, Acc_Z :-1029
Acc_X: -11, Acc_Y: -11, Acc_Z :-1021
Acc_X: -15, Acc_Y: -7, Acc_Z :-1029
Acc_X: -11, Acc_Y: -15, Acc_Z :-1040
Acc_X: -3, Acc_Y: -11, Acc_Z :-1033
Acc_X: -15, Acc_Y: -15, Acc_Z :-1040
Acc_X: -15, Acc_Y: -15, Acc_Z :-1040
Acc_X: -11, Acc_Y: -15, Acc_Z :-1033
Acc_X: -11, Acc_Y: -11, Acc_Z :-1033
Acc_X: -7, Acc_Y: -11, Acc_Z :-1029
Acc_X: -15, Acc_Y: -11, Acc_Z :-1040
Acc_X: -11, Acc_Y: -11, Acc_Z :-1040
Acc_X: -11, Acc_Y: -7, Acc_Z :-1040
Acc_X: -15, Acc_Y: -3, Acc_Z :-1040
Acc_X: -7, Acc_Y: -11, Acc_Z :-1033
Acc_X: -11, Acc_Y: -11, Acc_Z :-1033
Acc_X: -11, Acc_Y: -11, Acc_Z :-1040
Acc_X: -15, Acc_Y: -11, Acc_Z :-1040
Acc_X: -11, Acc_Y: -7, Acc_Z :-1036
Acc_X: -15, Acc_Y: -11, Acc_Z :-1040
Acc_X: -7, Acc_Y: -15, Acc_Z :-1036
Acc_X: -7, Acc_Y: -11, Acc_Z :-1036
Acc_X: -7, Acc_Y: -15, Acc_Z :-1029
Acc_X: -7, Acc_Y: -11, Acc_Z :-1033
Acc_X: -7, Acc_Y: -7, Acc_Z :-1040
Acc_X: -11, Acc_Y: -11, Acc_Z :-1048
Acc_X: -7, Acc_Y: -7, Acc_Z :-1033
Acc_X: -11, Acc_Y: -11, Acc_Z :-1033
Acc_X: -15, Acc_Y: -7, Acc_Z :-1036
Acc_X: -3, Acc_Y: -15, Acc_Z :-1036
Acc_X: -7, Acc_Y: -15, Acc_Z :-1036
Acc_X: -7, Acc_Y: -3, Acc_Z :-1040
Acc_X: -15, Acc_Y: -15, Acc_Z :-1040
Acc_X: -15, Acc_Y: -7, Acc_Z :-1036
Acc_X: -11, Acc_Y: -15, Acc_Z :-1033
Acc_X: -11, Acc_Y: -7, Acc_Z :-1040
Acc_X: -7, Acc_Y: -15, Acc_Z :-1033
Acc_X: -3, Acc_Y: -15, Acc_Z :-1033
Acc_X: -11, Acc_Y: -15, Acc_Z :-1040
Acc_X: -11, Acc_Y: -7, Acc_Z :-1036
Acc_X: -7, Acc_Y: -11, Acc_Z :-1036
Acc_X: -11, Acc_Y: -3, Acc_Z :-1036
Acc_X: -7, Acc_Y: -7, Acc_Z :-1036
Acc_X: -11, Acc_Y: -7, Acc_Z :-1033
Acc_X: -11, Acc_Y: -11, Acc_Z :-1036
Acc_X: -11, Acc_Y: -7, Acc_Z :-1036
Acc_X: -7, Acc_Y: -3, Acc_Z :-1036
Acc_X: -3, Acc_Y: -7, Acc_Z :-1036
Acc_X: -11, Acc_Y: -11, Acc_Z :-1036
Acc_X: -11, Acc_Y: -15, Acc_Z :-1036
Acc_X: -11, Acc_Y: -7, Acc_Z :-1036
Acc_X: -7, Acc_Y: -7, Acc_Z :-1033
Acc_X: -7, Acc_Y: -15, Acc_Z :-1036
Acc_X: -3, Acc_Y: -15, Acc_Z :-1036
Acc_X: -3, Acc_Y: -11, Acc_Z :-1040
Acc_X: -7, Acc_Y: -7, Acc_Z :-1036
Acc_X: -19, Acc_Y: -11, Acc_Z :-1033
Acc_X: -3, Acc_Y: -7, Acc_Z :-1033
Acc_X: -7, Acc_Y: -7, Acc_Z :-1036
Acc_X: 0, Acc_Y: -11, Acc_Z :-1036
Acc_X: -3, Acc_Y: -11, Acc_Z :-1036
Acc_X: -7, Acc_Y: -11, Acc_Z :-1040
Acc_X: -7, Acc_Y: -7, Acc_Z :-1040
Acc_X: -11, Acc_Y: -7, Acc_Z :-1029
Acc_X: -3, Acc_Y: -7, Acc_Z :-1040
Acc_X: -3, Acc_Y: -11, Acc_Z :-1040
Acc_X: -7, Acc_Y: -15, Acc_Z :-1036
Acc_X: -3, Acc_Y: -11, Acc_Z :-1036
Acc_X: -7, Acc_Y: -11, Acc_Z :-1036
Acc_X: -11, Acc_Y: -3, Acc_Z :-1036
Acc_X: 12, Acc_Y: -7, Acc_Z :-1033


点评

全是负值,是传感器面向桌面吗?加速度合力的算法是R=SQRT(x^2+y^2+z^2)吗?所以如果有负值的算法也是这个公式吗  详情 回复 发表于 2017-11-30 16:33
虾扯蛋


回复

使用道具 举报

72

TA的帖子

0

TA的资源

一粒金砂(中级)

Rank: 2

 楼主| 发表于 2017-11-30 16:33:08 | 显示全部楼层
littleshrimp 发表于 2017-11-30 11:49
你的的数据波动是挺大的我用手里的BlueCoin开发板测了一下LSM6DSM结果如下
如果你还有其它LIS6DSM传感器 ...

全是负值,是传感器面向桌面吗?加速度合力的算法是R=SQRT(x^2+y^2+z^2)吗?所以如果有负值的算法也是这个公式吗

点评

有负值是正常的  详情 回复 发表于 2017-11-30 17:32


回复

使用道具 举报

4560

TA的帖子

9

TA的资源

版主

Rank: 6Rank: 6

发表于 2017-11-30 17:32:07 来自手机 | 显示全部楼层
xieyj 发表于 2017-11-30 16:33
全是负值,是传感器面向桌面吗?加速度合力的算法是R=SQRT(x^2+y^2+z^2)吗?所以如果有负值的算法也是这 ...

有负值是正常的

点评

你读的这个是寄存器是高八位还是第八位?就是说读的是0X28 0X2A 0X2C还是高八位的0x29 0X2B 0X2C寄存器的值?  详情 回复 发表于 2017-12-1 10:41
这个加速度合加速度计算是不是这个公式啊  详情 回复 发表于 2017-11-30 18:16


回复

使用道具 举报

72

TA的帖子

0

TA的资源

一粒金砂(中级)

Rank: 2

 楼主| 发表于 2017-11-30 18:16:48 | 显示全部楼层

这个加速度合加速度计算是不是这个公式啊


回复

使用道具 举报

72

TA的帖子

0

TA的资源

一粒金砂(中级)

Rank: 2

 楼主| 发表于 2017-12-1 10:41:48 | 显示全部楼层

你读的这个是寄存器是高八位还是第八位?就是说读的是0X28 0X2A 0X2C还是高八位的0x29 0X2B 0X2C寄存器的值?


回复

使用道具 举报

72

TA的帖子

0

TA的资源

一粒金砂(中级)

Rank: 2

 楼主| 发表于 2017-12-1 11:20:26 | 显示全部楼层
我已经解决这个问题了,多谢!


回复

使用道具 举报

您需要登录后才可以回帖 登录 | 注册

本版积分规则

  • 论坛活动 E手掌握

    扫码关注
    EEWORLD 官方微信

  • EE福利  唾手可得

    扫码关注
    EE福利 唾手可得

小黑屋|手机版|Archiver|电子工程世界 ( 京ICP证 060456

GMT+8, 2017-12-12 12:43 , Processed in 0.326432 second(s), 16 queries , Redis On.

快速回复 返回顶部 返回列表