4226|9

75

帖子

0

TA的资源

一粒金砂(中级)

楼主
 

LSM6DSM器件静置在水平上原始数据XYZ三轴跳变 [复制链接]

 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三轴数据会波动如此之大,理论上应该是静止不变的。陀螺仪的数据倒是不变是正常的。

最新回复

请问一下,如何通过角速度来求角度呢?  详情 回复 发表于 2019-1-17 11:32
点赞 关注
 
 

回复
举报

75

帖子

0

TA的资源

一粒金砂(中级)

沙发
 
附件是log

session.log

250.88 KB, 下载次数: 14

点评

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

回复

9795

帖子

24

TA的资源

版主

板凳
 

你的的数据波动是挺大的我用手里的BlueCoin开发板测了一下LSM6DSM结果如下
如果你还有其它LIS6DSM传感器板子可以再试另一个看下,排除传感器硬件问题
排除传感器问题后可以再看一下代码,是不是哪个地方没有配置好,
http://www.st.com/content/st_com ... e/stsw-bcnkt01.html
这个官方例程里有LIS6DSM的代码,你可以参考一下
另外传感器数据变化大还和你的测试环境振动有关,可以尽量将传感器放在比较稳定的桌面或者平台上
  1. Acc_X: -26, Acc_Y: -11, Acc_Z :-1033
  2. Acc_X: -26, Acc_Y: -15, Acc_Z :-1033
  3. Acc_X: -26, Acc_Y: -15, Acc_Z :-1052
  4. Acc_X: -19, Acc_Y: -3, Acc_Z :-1021
  5. Acc_X: -34, Acc_Y: -15, Acc_Z :-1048
  6. Acc_X: -19, Acc_Y: -7, Acc_Z :-1044
  7. Acc_X: -26, Acc_Y: -7, Acc_Z :-1044
  8. Acc_X: -22, Acc_Y: -11, Acc_Z :-1033
  9. Acc_X: -30, Acc_Y: -7, Acc_Z :-1036
  10. Acc_X: -19, Acc_Y: -11, Acc_Z :-1036
  11. Acc_X: -22, Acc_Y: -11, Acc_Z :-1040
  12. Acc_X: -22, Acc_Y: -11, Acc_Z :-1036
  13. Acc_X: -22, Acc_Y: -7, Acc_Z :-1029
  14. Acc_X: -26, Acc_Y: -7, Acc_Z :-1036
  15. Acc_X: -19, Acc_Y: -3, Acc_Z :-1033
  16. Acc_X: -22, Acc_Y: -3, Acc_Z :-1033
  17. Acc_X: -26, Acc_Y: -7, Acc_Z :-1029
  18. Acc_X: -11, Acc_Y: -15, Acc_Z :-1029
  19. Acc_X: -22, Acc_Y: -11, Acc_Z :-1036
  20. Acc_X: -22, Acc_Y: -7, Acc_Z :-1033
  21. Acc_X: -22, Acc_Y: -11, Acc_Z :-1036
  22. Acc_X: -30, Acc_Y: -3, Acc_Z :-1033
  23. Acc_X: -19, Acc_Y: -7, Acc_Z :-1036
  24. Acc_X: -30, Acc_Y: -15, Acc_Z :-1036
  25. Acc_X: -15, Acc_Y: -15, Acc_Z :-1036
  26. Acc_X: -15, Acc_Y: -15, Acc_Z :-1040
  27. Acc_X: -19, Acc_Y: -7, Acc_Z :-1036
  28. Acc_X: -22, Acc_Y: -15, Acc_Z :-1025
  29. Acc_X: -22, Acc_Y: -15, Acc_Z :-1033
  30. Acc_X: -19, Acc_Y: -7, Acc_Z :-1036
  31. Acc_X: -26, Acc_Y: -11, Acc_Z :-1033
  32. Acc_X: -22, Acc_Y: -15, Acc_Z :-1040
  33. Acc_X: -15, Acc_Y: -7, Acc_Z :-1040
  34. Acc_X: -26, Acc_Y: -11, Acc_Z :-1036
  35. Acc_X: -15, Acc_Y: -7, Acc_Z :-1036
  36. Acc_X: -22, Acc_Y: 0, Acc_Z :-1040
  37. Acc_X: -22, Acc_Y: -7, Acc_Z :-1033
  38. Acc_X: -19, Acc_Y: -7, Acc_Z :-1033
  39. Acc_X: -11, Acc_Y: -11, Acc_Z :-1033
  40. Acc_X: -22, Acc_Y: -15, Acc_Z :-1036
  41. Acc_X: -15, Acc_Y: -15, Acc_Z :-1036
  42. Acc_X: -22, Acc_Y: -7, Acc_Z :-1040
  43. Acc_X: -19, Acc_Y: -7, Acc_Z :-1033
  44. Acc_X: -19, Acc_Y: -11, Acc_Z :-1033
  45. Acc_X: -22, Acc_Y: -7, Acc_Z :-1033
  46. Acc_X: -15, Acc_Y: -11, Acc_Z :-1040
  47. Acc_X: -15, Acc_Y: -11, Acc_Z :-1048
  48. Acc_X: -19, Acc_Y: -11, Acc_Z :-1040
  49. Acc_X: -22, Acc_Y: -7, Acc_Z :-1044
  50. Acc_X: -19, Acc_Y: -7, Acc_Z :-1036
  51. Acc_X: -15, Acc_Y: 0, Acc_Z :-1036
  52. Acc_X: -22, Acc_Y: -7, Acc_Z :-1025
  53. Acc_X: -15, Acc_Y: -7, Acc_Z :-1040
  54. Acc_X: -26, Acc_Y: -19, Acc_Z :-1036
  55. Acc_X: -22, Acc_Y: -11, Acc_Z :-1036
  56. Acc_X: -15, Acc_Y: -15, Acc_Z :-1040
  57. Acc_X: -15, Acc_Y: -7, Acc_Z :-1036
  58. Acc_X: -22, Acc_Y: -11, Acc_Z :-1029
  59. Acc_X: -22, Acc_Y: -7, Acc_Z :-1029
  60. Acc_X: -22, Acc_Y: -11, Acc_Z :-1040
  61. Acc_X: -22, Acc_Y: -3, Acc_Z :-1040
  62. Acc_X: -22, Acc_Y: -3, Acc_Z :-1036
  63. Acc_X: -22, Acc_Y: -3, Acc_Z :-1036
  64. Acc_X: -15, Acc_Y: -7, Acc_Z :-1036
  65. Acc_X: -19, Acc_Y: -7, Acc_Z :-1040
  66. Acc_X: -15, Acc_Y: -11, Acc_Z :-1040
  67. Acc_X: -15, Acc_Y: -15, Acc_Z :-1036
  68. Acc_X: -19, Acc_Y: -11, Acc_Z :-1033
  69. Acc_X: -15, Acc_Y: -11, Acc_Z :-1021
  70. Acc_X: -19, Acc_Y: -15, Acc_Z :-1040
  71. Acc_X: -15, Acc_Y: -7, Acc_Z :-1033
  72. Acc_X: -19, Acc_Y: -7, Acc_Z :-1033
  73. Acc_X: -19, Acc_Y: -7, Acc_Z :-1033
  74. Acc_X: -19, Acc_Y: -11, Acc_Z :-1036
  75. Acc_X: -15, Acc_Y: -3, Acc_Z :-1044
  76. Acc_X: -19, Acc_Y: -19, Acc_Z :-1052
  77. Acc_X: -15, Acc_Y: -11, Acc_Z :-1036
  78. Acc_X: -11, Acc_Y: -7, Acc_Z :-1029
  79. Acc_X: -19, Acc_Y: -11, Acc_Z :-1036
  80. Acc_X: -15, Acc_Y: -11, Acc_Z :-1033
  81. Acc_X: -11, Acc_Y: -15, Acc_Z :-1036
  82. Acc_X: -22, Acc_Y: -11, Acc_Z :-1036
  83. Acc_X: -19, Acc_Y: -19, Acc_Z :-1036
  84. Acc_X: -19, Acc_Y: -3, Acc_Z :-1036
  85. Acc_X: -11, Acc_Y: -11, Acc_Z :-1040
  86. Acc_X: -11, Acc_Y: -11, Acc_Z :-1033
  87. Acc_X: -19, Acc_Y: -3, Acc_Z :-1033
  88. Acc_X: -15, Acc_Y: -3, Acc_Z :-1036
  89. Acc_X: -19, Acc_Y: -7, Acc_Z :-1029
  90. Acc_X: -15, Acc_Y: -7, Acc_Z :-1044
  91. Acc_X: -15, Acc_Y: -11, Acc_Z :-1036
  92. Acc_X: -15, Acc_Y: -11, Acc_Z :-1033
  93. Acc_X: -15, Acc_Y: -7, Acc_Z :-1044
  94. Acc_X: -15, Acc_Y: -11, Acc_Z :-1040
  95. Acc_X: -19, Acc_Y: -11, Acc_Z :-1033
  96. Acc_X: -15, Acc_Y: -15, Acc_Z :-1029
  97. Acc_X: -19, Acc_Y: -15, Acc_Z :-1036
  98. Acc_X: -22, Acc_Y: -3, Acc_Z :-1044
  99. Acc_X: -15, Acc_Y: -7, Acc_Z :-1036
  100. Acc_X: -19, Acc_Y: -11, Acc_Z :-1036
  101. Acc_X: -15, Acc_Y: -7, Acc_Z :-1040
  102. Acc_X: -19, Acc_Y: -3, Acc_Z :-1033
  103. Acc_X: -15, Acc_Y: -11, Acc_Z :-1036
  104. Acc_X: -15, Acc_Y: -11, Acc_Z :-1040
  105. Acc_X: -15, Acc_Y: -19, Acc_Z :-1040
  106. Acc_X: -15, Acc_Y: 0, Acc_Z :-1033
  107. Acc_X: -19, Acc_Y: -11, Acc_Z :-1040
  108. Acc_X: -15, Acc_Y: -3, Acc_Z :-1036
  109. Acc_X: -15, Acc_Y: -15, Acc_Z :-1033
  110. Acc_X: -11, Acc_Y: -11, Acc_Z :-1033
  111. Acc_X: -15, Acc_Y: -7, Acc_Z :-1033
  112. Acc_X: -19, Acc_Y: -7, Acc_Z :-1036
  113. Acc_X: -19, Acc_Y: -3, Acc_Z :-1040
  114. Acc_X: -15, Acc_Y: -15, Acc_Z :-1036
  115. Acc_X: -11, Acc_Y: -11, Acc_Z :-1040
  116. Acc_X: -11, Acc_Y: -11, Acc_Z :-1036
  117. Acc_X: -11, Acc_Y: -11, Acc_Z :-1029
  118. Acc_X: -7, Acc_Y: -15, Acc_Z :-1036
  119. Acc_X: -19, Acc_Y: -11, Acc_Z :-1040
  120. Acc_X: -15, Acc_Y: -7, Acc_Z :-1040
  121. Acc_X: -15, Acc_Y: -19, Acc_Z :-1029
  122. Acc_X: -11, Acc_Y: -15, Acc_Z :-1033
  123. Acc_X: -11, Acc_Y: -7, Acc_Z :-1029
  124. Acc_X: -7, Acc_Y: -11, Acc_Z :-1040
  125. Acc_X: -11, Acc_Y: -11, Acc_Z :-1036
  126. Acc_X: -15, Acc_Y: -7, Acc_Z :-1040
  127. Acc_X: -15, Acc_Y: -11, Acc_Z :-1036
  128. Acc_X: -15, Acc_Y: -11, Acc_Z :-1036
  129. Acc_X: -11, Acc_Y: -11, Acc_Z :-1036
  130. Acc_X: -11, Acc_Y: -11, Acc_Z :-1033
  131. Acc_X: -15, Acc_Y: -7, Acc_Z :-1036
  132. Acc_X: -7, Acc_Y: -19, Acc_Z :-1040
  133. Acc_X: -7, Acc_Y: -7, Acc_Z :-1033
  134. Acc_X: -11, Acc_Y: -11, Acc_Z :-1040
  135. Acc_X: -11, Acc_Y: -11, Acc_Z :-1033
  136. Acc_X: -7, Acc_Y: -7, Acc_Z :-1029
  137. Acc_X: -11, Acc_Y: -7, Acc_Z :-1033
  138. Acc_X: -19, Acc_Y: -11, Acc_Z :-1033
  139. Acc_X: -11, Acc_Y: -15, Acc_Z :-1044
  140. Acc_X: -7, Acc_Y: -7, Acc_Z :-1033
  141. Acc_X: -11, Acc_Y: -7, Acc_Z :-1036
  142. Acc_X: -7, Acc_Y: -11, Acc_Z :-1036
  143. Acc_X: -15, Acc_Y: -7, Acc_Z :-1036
  144. Acc_X: -11, Acc_Y: -19, Acc_Z :-1040
  145. Acc_X: -3, Acc_Y: -15, Acc_Z :-1033
  146. Acc_X: -11, Acc_Y: -19, Acc_Z :-1036
  147. Acc_X: -11, Acc_Y: -7, Acc_Z :-1025
  148. Acc_X: -11, Acc_Y: -7, Acc_Z :-1040
  149. Acc_X: 8, Acc_Y: -7, Acc_Z :-1033
  150. Acc_X: -11, Acc_Y: -15, Acc_Z :-1029
  151. Acc_X: -11, Acc_Y: -11, Acc_Z :-1021
  152. Acc_X: -15, Acc_Y: -7, Acc_Z :-1029
  153. Acc_X: -11, Acc_Y: -15, Acc_Z :-1040
  154. Acc_X: -3, Acc_Y: -11, Acc_Z :-1033
  155. Acc_X: -15, Acc_Y: -15, Acc_Z :-1040
  156. Acc_X: -15, Acc_Y: -15, Acc_Z :-1040
  157. Acc_X: -11, Acc_Y: -15, Acc_Z :-1033
  158. Acc_X: -11, Acc_Y: -11, Acc_Z :-1033
  159. Acc_X: -7, Acc_Y: -11, Acc_Z :-1029
  160. Acc_X: -15, Acc_Y: -11, Acc_Z :-1040
  161. Acc_X: -11, Acc_Y: -11, Acc_Z :-1040
  162. Acc_X: -11, Acc_Y: -7, Acc_Z :-1040
  163. Acc_X: -15, Acc_Y: -3, Acc_Z :-1040
  164. Acc_X: -7, Acc_Y: -11, Acc_Z :-1033
  165. Acc_X: -11, Acc_Y: -11, Acc_Z :-1033
  166. Acc_X: -11, Acc_Y: -11, Acc_Z :-1040
  167. Acc_X: -15, Acc_Y: -11, Acc_Z :-1040
  168. Acc_X: -11, Acc_Y: -7, Acc_Z :-1036
  169. Acc_X: -15, Acc_Y: -11, Acc_Z :-1040
  170. Acc_X: -7, Acc_Y: -15, Acc_Z :-1036
  171. Acc_X: -7, Acc_Y: -11, Acc_Z :-1036
  172. Acc_X: -7, Acc_Y: -15, Acc_Z :-1029
  173. Acc_X: -7, Acc_Y: -11, Acc_Z :-1033
  174. Acc_X: -7, Acc_Y: -7, Acc_Z :-1040
  175. Acc_X: -11, Acc_Y: -11, Acc_Z :-1048
  176. Acc_X: -7, Acc_Y: -7, Acc_Z :-1033
  177. Acc_X: -11, Acc_Y: -11, Acc_Z :-1033
  178. Acc_X: -15, Acc_Y: -7, Acc_Z :-1036
  179. Acc_X: -3, Acc_Y: -15, Acc_Z :-1036
  180. Acc_X: -7, Acc_Y: -15, Acc_Z :-1036
  181. Acc_X: -7, Acc_Y: -3, Acc_Z :-1040
  182. Acc_X: -15, Acc_Y: -15, Acc_Z :-1040
  183. Acc_X: -15, Acc_Y: -7, Acc_Z :-1036
  184. Acc_X: -11, Acc_Y: -15, Acc_Z :-1033
  185. Acc_X: -11, Acc_Y: -7, Acc_Z :-1040
  186. Acc_X: -7, Acc_Y: -15, Acc_Z :-1033
  187. Acc_X: -3, Acc_Y: -15, Acc_Z :-1033
  188. Acc_X: -11, Acc_Y: -15, Acc_Z :-1040
  189. Acc_X: -11, Acc_Y: -7, Acc_Z :-1036
  190. Acc_X: -7, Acc_Y: -11, Acc_Z :-1036
  191. Acc_X: -11, Acc_Y: -3, Acc_Z :-1036
  192. Acc_X: -7, Acc_Y: -7, Acc_Z :-1036
  193. Acc_X: -11, Acc_Y: -7, Acc_Z :-1033
  194. Acc_X: -11, Acc_Y: -11, Acc_Z :-1036
  195. Acc_X: -11, Acc_Y: -7, Acc_Z :-1036
  196. Acc_X: -7, Acc_Y: -3, Acc_Z :-1036
  197. Acc_X: -3, Acc_Y: -7, Acc_Z :-1036
  198. Acc_X: -11, Acc_Y: -11, Acc_Z :-1036
  199. Acc_X: -11, Acc_Y: -15, Acc_Z :-1036
  200. Acc_X: -11, Acc_Y: -7, Acc_Z :-1036
  201. Acc_X: -7, Acc_Y: -7, Acc_Z :-1033
  202. Acc_X: -7, Acc_Y: -15, Acc_Z :-1036
  203. Acc_X: -3, Acc_Y: -15, Acc_Z :-1036
  204. Acc_X: -3, Acc_Y: -11, Acc_Z :-1040
  205. Acc_X: -7, Acc_Y: -7, Acc_Z :-1036
  206. Acc_X: -19, Acc_Y: -11, Acc_Z :-1033
  207. Acc_X: -3, Acc_Y: -7, Acc_Z :-1033
  208. Acc_X: -7, Acc_Y: -7, Acc_Z :-1036
  209. Acc_X: 0, Acc_Y: -11, Acc_Z :-1036
  210. Acc_X: -3, Acc_Y: -11, Acc_Z :-1036
  211. Acc_X: -7, Acc_Y: -11, Acc_Z :-1040
  212. Acc_X: -7, Acc_Y: -7, Acc_Z :-1040
  213. Acc_X: -11, Acc_Y: -7, Acc_Z :-1029
  214. Acc_X: -3, Acc_Y: -7, Acc_Z :-1040
  215. Acc_X: -3, Acc_Y: -11, Acc_Z :-1040
  216. Acc_X: -7, Acc_Y: -15, Acc_Z :-1036
  217. Acc_X: -3, Acc_Y: -11, Acc_Z :-1036
  218. Acc_X: -7, Acc_Y: -11, Acc_Z :-1036
  219. Acc_X: -11, Acc_Y: -3, Acc_Z :-1036
  220. Acc_X: 12, Acc_Y: -7, Acc_Z :-1033

复制代码

点评

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

回复

75

帖子

0

TA的资源

一粒金砂(中级)

4
 
littleshrimp 发表于 2017-11-30 11:49
你的的数据波动是挺大的我用手里的BlueCoin开发板测了一下LSM6DSM结果如下
如果你还有其它LIS6DSM传感器 ...

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

点评

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

回复

9795

帖子

24

TA的资源

版主

5
 
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
 
 
 

回复

75

帖子

0

TA的资源

一粒金砂(中级)

6
 

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

回复

75

帖子

0

TA的资源

一粒金砂(中级)

7
 

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

回复

75

帖子

0

TA的资源

一粒金砂(中级)

8
 
我已经解决这个问题了,多谢!
 
 
 

回复

75

帖子

0

TA的资源

一粒金砂(中级)

9
 
我也来回复这个问题解决办法:我读出的数据其实是第八位,但是这个数据其实是16位的有高八位和第八位。将这两个位相加组成16位才对。acceleration_data = ((int16_t)acceleration_rawx[1]<<8) + (int16_t)acceleration_rawx[0];
留给遇到同样的问题的童鞋们,希望对你们有帮助
 
 
 

回复

12

帖子

0

TA的资源

一粒金砂(中级)

10
 
请问一下,如何通过角速度来求角度呢?
 
 
 

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

随便看看
查找数据手册?

EEWorld Datasheet 技术支持

相关文章 更多>>
关闭
站长推荐上一条 1/7 下一条

 
EEWorld订阅号

 
EEWorld服务号

 
汽车开发圈

About Us 关于我们 客户服务 联系方式 器件索引 网站地图 最新更新 手机版

站点相关: 国产芯 安防电子 汽车电子 手机便携 工业控制 家用电子 医疗电子 测试测量 网络通信 物联网

北京市海淀区中关村大街18号B座15层1530室 电话:(010)82350740 邮编:100190

电子工程世界版权所有 京B2-20211791 京ICP备10001474号-1 电信业务审批[2006]字第258号函 京公网安备 11010802033920号 Copyright © 2005-2025 EEWORLD.com.cn, Inc. All rights reserved
快速回复 返回顶部 返回列表