完善资料让更多小伙伴认识你,还能领取20积分哦, 立即完善>
我正在使用LIS3MDL传感器,我不明白其单位为LSB / Gauss的灵敏度。
在x-cube-mems1库中,计算以下内容: &amp; sharpdefine LIS3MDL_MAG_SENSItiVITY_FOR_FS_4G 0.14 / **&lt; 4高斯满量程的灵敏度值[mgauss / LSB] * / &amp; sharpdefine LIS3MDL_MAG_SENSITIVITY_FOR_FS_8G 0.29 / **&lt; 8高斯满量程的灵敏度值[mgauss / LSB] * / &amp; sharpdefine LIS3MDL_MAG_SENSITIVITY_FOR_FS_12G 0.43 / **&lt; 12高斯满量程的灵敏度值[mgauss / LSB] * / &amp; sharpdefine LIS3MDL_MAG_SENSITIVITY_FOR_FS_16G 0.58 / **&lt; 16高斯满量程的灵敏度值[mgauss / LSB] * /和数据表: 我的问题是他们是如何计算上述代码中的灵敏度的?以及LSB / Gauss是什么意思? 提前致谢。 #l***s / gauss#lis3mdl 以上来自于谷歌翻译 以下为原文 I am using LIS3MDL sensor and I do not understand the sensitivity which its unit is LSB/Gauss. In x-cube-mems1 library, the following is calculated: &sharpdefine LIS3MDL_MAG_SENSITIVITY_FOR_FS_4G 0.14 /**< Sensitivity value for 4 gauss full scale [mgauss/LSB] */ &sharpdefine LIS3MDL_MAG_SENSITIVITY_FOR_FS_8G 0.29 /**< Sensitivity value for 8 gauss full scale [mgauss/LSB] */ &sharpdefine LIS3MDL_MAG_SENSITIVITY_FOR_FS_12G 0.43 /**< Sensitivity value for 12 gauss full scale [mgauss/LSB] */ &sharpdefine LIS3MDL_MAG_SENSITIVITY_FOR_FS_16G 0.58 /**< Sensitivity value for 16 gauss full scale [mgauss/LSB] */and in the datasheet: My question is how did they calculate the sensitivity in the above code? and also what does LSB/Gauss mean? Thanks in advance. #l***/gauss #lis3mdl |
|
相关推荐
6个回答
|
|
你好,
看看之前的讨论,我之前有过同样的问题: https://community.st.com/0D50X00009XkXwiSAF 大卫 注意:原始帖子包含大量线程对话,只能迁移到第9级 以上来自于谷歌翻译 以下为原文 Hello, have a look at this earlier discussion, I had the same question before: https://community.st.com/0D50X00009XkXwiSAF David Note: the original post contained a large number of threaded conversations and was only able to be migrated to the 9th level |
|
|
|
关于多维数据集库中提到的代码中的值:
对于+/- 4高斯,灵敏度为6 842 LSB / gauss,意味着6 842 = 1高斯,12 964 = 2高斯,19 806 = 3高斯等... 但是,解释数据的一种方法是读取原始值并显示为miligauss。 如果1高斯= 6 842,那么1 000 mgauss = 6 842,意味着1 000 mgauss / 6 842 = 0,146156 mgauss / LSB。这同样适用于其他范围。它只是对相同数据的不同看法。 我个人更喜欢保持精度并尽可能在微控制器中使用整数数学,这就是为什么我编写自己的“驱动程序”来读取,计算和显示传感器的值。 以上来自于谷歌翻译 以下为原文 Regarding the values in the code mentioned in the cube library: For +/- 4 gauss, the sensitivity is 6 842 LSB / gauss, meaning 6 842 = 1 gauss, 12 964 = 2 gauss, 19 806 = 3 gauss, etc... However, one way to interpret the data is to read the raw value and display as miligauss. If 1 gauss = 6 842, then 1 000 mgauss = 6 842, meaning 1 000 mgauss / 6 842 = 0,146156 mgauss / LSB.The same applies to the other ranges. It is just a different look at the same data. I personally prefer to keep the precision and use integer math as much as possible in microcontrollers, which is why I wrote my own 'driver' to read, compute and display the values from the sensor. |
|
|
|
谢谢
Koudela.David.001 for你的回复。它给了我很多帮助。我仍然没有得到它100%。 原始等式是: magnetic_intensity(高斯)= raw_data / sensitivity 因此,对于此等式,灵敏度是数据表中表格中的值(6842或2281 ......等) 我在这里纠正吗? 现在,关于LSB /高斯。我的理解是 6842 LSB = 1高斯, 6842 LSB = 1000 mgauss 因此,灵敏度= 6842/1000 = 6.842。 我的问题是你为什么以这种方式计算它? (1000 mgauss / 6842 LSB = 0.14) 最后,在立方体库中,他们使用以下等式:mgauss =原始数据*灵敏度。 我们不应该使用这个(magnetic_intensity(高斯)= raw_data / sensitivity)? 我再次非常感谢你的帮助。 注意:原始帖子包含大量线程对话,只能迁移到第9级 以上来自于谷歌翻译 以下为原文 Thanks Koudela.David.001 ‌ for your reply. It helped me alot.I still did not get it 100%. The original equation is: magnetic_intensity (in gauss) = raw_data / sensitivity So, for this equation the sensitivity is a value from the table in the datasheet(6842 or 2281...etc) Am I correct here? Now, regarding LSB/gauss. What I understand is 6842 LSB = 1 gauss, 6842 LSB = 1000 mgauss So, sensitivity = 6842/1000 = 6.842. My question is why did you calculate it in that way? (1000 mgauss / 6842 LSB = 0.14) Last thing, in the cube library, they use this equation: mgauss = raw data * sensitivity. Should not we use this one (magnetic_intensity (in gauss) = raw_data / sensitivity)? Again, I really appreciate your help. Note: the original post contained a large number of threaded conversations and was only able to be migrated to the 9th level |
|
|
|
你好
khaledaljehani99 â€大江 Khaled Aljehani写道: 原始等式是: magnetic_intensity(高斯)= raw_data / sensitivity 因此,对于此等式,灵敏度是数据表中表格中的值(6842或2281 ......等) 我在这里纠正吗? 是的,你是。 现在,关于LSB /高斯。我的理解是 6842 LSB = 1高斯, 6842 LSB = 1000 mgauss 因此,灵敏度= 6842/1000 = 6.842。 我的问题是你为什么以这种方式计算它? (1000 mgauss / 6842 LSB = 0.14) 最后,在立方体库中,他们使用以下等式:mgauss =原始数据*灵敏度。 我们不应该使用这个(magnetic_intensity(高斯)= raw_data / sensitivity)? 如果您知道每1高斯(= 1 000 mgauss)的灵敏度为6 842 LSB,则至少有两种计算输出值的方法,传感器为您提供输出 - 32,768至32,767。 1) magnetic_intensity = raw_data / sensitivity 以下单位: [gauss] = [LSB] / [LSB / gauss] 所以灵敏度在这里表示为 这与数据表中印刷的值有关,并在链接的讨论中进行了讨论。 2) magnetic_intensity = raw_data *灵敏度 以下单位: [gauss] = [LSB] * [gauss / LSB] 所以灵敏度在这里表示为 无论您使用高斯还是高压计数都不会影响等式,只影响灵敏度系数(和/或结果)。 这与Cube库中的值有关。 0.14&lt; 4高斯满量程的灵敏度值[mgauss / LSB](= 0,000 14高斯/ LSB) 0.29&lt; 8高斯满量程的灵敏度值[mgauss / LSB](= 0,000 29高斯/ LSB) 0.43&lt; 12高斯满量程的灵敏度值[mgauss / LSB](= 0,000 43高斯/ LSB) 0.58&lt; 16高斯满量程的灵敏度值[mgauss / LSB] (= 0,000 58高斯/ LSB) ----- ST选择了第2版,但是,我更喜欢版本1。版本1可以更快,使用更少的资源,而且具有更高的精度! 如果在两种情况下灵敏度都是一个整数,它将执行相同的操作,但在这种情况下不是。 例1: 如果传感器给出6 842的输出,方法1将告诉您输出为1高斯。方法2将告诉您输出为957 mgauss(差异约为4%)。 (这也来自于这一事实 0,146156 mgauss / LSB舍入到0,14,而不是我预期的0,15。 您可能会说方法1只输出高斯中的整数值,并且您希望输出miligauss。没有问题,只需将raw_data与1000相乘就可以得到1000倍的更大结果(这就是你需要的,因为1 gauss = 1000 mgauss)。 例2,原始数据= 10 000: 方法1: magnetic_intensity [mgauss] =(raw_data * 1 000)/灵敏度 磁场强度[mgauss] = 10 000 000/6 842 = 1 461 mgauss(= 1,461高斯) 方法2: magnetic_intensity [mgauss] = raw_data *灵敏度 magnetic_intensity [mgauss] = 10 000 * 0,14 = 1 400 mgauss(= 1,400 gauss)=再次,约4%的误差 但是,方法1有一个缺点 - 如果您将输出值乘以(在此示例中为1 000),请确保您的数据类型将处理此问题。 在这种情况下,传感器raw_data是-32,768到32,767,乘以1 000得到-32 768 000到32 767 000,这很容易适合签名的int32,其中包括2,147,483,648到2,147,483,647。 您可以自己编写方法1的代码,只需使用raw_data作为signed int16作为参数调用下面的方法。 &amp; sharpdefine DECIMAL_3DIGIT_FACTOR 1000u // 3小数点乘法 &amp; sharpdefine COUNT_TO_GAUSS_4G_SCALE 6842; //每1高斯测量数据计数,满量程+/- 4 g &amp; sharpdefine COUNT_TO_GAUSS_8G_SCALE 3421; //每1高斯测量数据计数,满量程+/- 8 g &amp; sharpdefine COUNT_TO_GAUSS_12G_SCALE 2281; //每1高斯测量数据计数,满量程+/- 12克 &amp; sharpdefine COUNT_TO_GAUSS_16G_SCALE 1711; //每1高斯测量数据计数,满量程+/- 16 g //将磁力计数据(十六进制)转换为高斯单位 int32_t MM_Convert_To_Gauss(int16_t magnetometerData){ int32_t mgaussData; mgaussData =(magnetometerData * DECIMAL_3DIGIT_FACTOR); mgaussData / = COUNT_TO_GAUSS_4G_SCALE; return gaussData; } 注意:原始帖子包含大量线程对话,只能迁移到第9级 以上来自于谷歌翻译 以下为原文 Hello khaledaljehani99 ‌, Khaled Aljehani wrote: The original equation is: magnetic_intensity (in gauss) = raw_data / sensitivity So, for this equation the sensitivity is a value from the table in the datasheet(6842 or 2281...etc) Am I correct here? Yes, you are. Now, regarding LSB/gauss. What I understand is 6842 LSB = 1 gauss, 6842 LSB = 1000 mgauss So, sensitivity = 6842/1000 = 6.842. My question is why did you calculate it in that way? (1000 mgauss / 6842 LSB = 0.14) Last thing, in the cube library, they use this equation: mgauss = raw data * sensitivity. Should not we use this one (magnetic_intensity (in gauss) = raw_data / sensitivity)? There are at least two ways of calculating the output value, if you know that the sensitivity is 6 842 LSB per 1 gauss (=1 000 mgauss) and the sensor gives you output of –32,768 to 32,767. 1) magnetic_intensity = raw_data / sensitivity with the following units: [gauss] = [LSB] / [LSB/gauss] so sensitivity is represented here as This relates to the values printed in the datasheet and discussed in the linked discussion. 2) magnetic_intensity = raw_data * sensitivity with the following units: [gauss] = [LSB] * [gauss/LSB] so sensitivity is represented here as The fact whether you count with gauss or miligauss doesn't affect the equation, just the sensitivity coefficients (and/or the result). This relates to the values in the Cube library. 0.14 < Sensitivity value for 4 gauss full scale [mgauss/LSB] (= 0,000 14 gauss/ LSB) 0.29 < Sensitivity value for 8 gauss full scale [mgauss/LSB] (= 0,000 29 gauss / LSB) 0.43 < Sensitivity value for 12 gauss full scale [mgauss/LSB] (= 0,000 43 gauss / LSB) 0.58 < Sensitivity value for 16 gauss full scale [mgauss/LSB] (= 0,000 58 gauss / LSB) ----- ST chose version 2, however, I like version 1 more. Version 1 can be faster and use less resources, moreover, with a higher precision! If the sensitivity was a round number in both cases, it would perform the same, but it is not in this case. Example 1: If the sensor gives you an output of 6 842, method 1 will tell you that the output is 1 gauss. Method 2 will tell you that the output is 957 mgauss (about 4 % difference). (This also comes from the fact that 0,146156 mgauss / LSB was rounded to 0,14, not 0,15 as I would expect). You might say that method 1 output only an integer value in gauss and that you want output in miligauss. There is no problem with that, just multiply the raw_data with a 1000 and you get a 1000 x bigger result (which is what you need, because 1 gauss = 1000 mgauss). Example 2, raw data = 10 000: Method 1: magnetic_intensity [mgauss] = ( raw_data * 1 000) / sensitivity magnetic intensity [mgauss] = 10 000 000 / 6 842 = 1 461 mgauss (=1,461 gauss) Method 2: magnetic_intensity [mgauss] = raw_data * sensitivity magnetic_intensity [mgauss] = 10 000 * 0,14 = 1 400 mgauss ( = 1,400 gauss) = again, about 4 % error However, method 1 has a downside - if you multiply an output value (by a 1 000 in this example), make sure your data type will handle this. In this case sensor raw_data is –32,768 to 32,767 , multiplied by 1 000 gives us -32 768 000 to 32 767 000 and this easily fits into a signed int32 with –2,147,483,648 to 2,147,483,647 range. You can the code of method 1 on your own, just call the method below with raw_data as signed int16 as a parameter. &sharpdefine DECIMAL_3DIGIT_FACTOR 1000u // 3 decimal points multiplication &sharpdefine COUNT_TO_GAUSS_4G_SCALE 6842; // measured data count per 1 Gauss, full scale +/- 4 g &sharpdefine COUNT_TO_GAUSS_8G_SCALE 3421; // measured data count per 1 Gauss, full scale +/- 8 g &sharpdefine COUNT_TO_GAUSS_12G_SCALE 2281; // measured data count per 1 Gauss, full scale +/- 12 g &sharpdefine COUNT_TO_GAUSS_16G_SCALE 1711; // measured data count per 1 Gauss, full scale +/- 16 g // converts magnetometer data (hex) to Gauss unit int32_t MM_Convert_To_Gauss (int16_t magnetometerData) { int32_t mgaussData; mgaussData = (magnetometerData * DECIMAL_3DIGIT_FACTOR); mgaussData /= COUNT_TO_GAUSS_4G_SCALE; return gaussData; } Note: the original post contained a large number of threaded conversations and was only able to be migrated to the 9th level |
|
|
|
好解释
Koudela.David.001 “你真的帮助了我很多方程式。 我真的不明白为什么在数据表和应用说明中都没有添加这样的信息。 我想问一下,是否有计算输出值的参考?因为我搜索了很多,没有找到任何东西。 再次感谢您对我的努力。 注意:原始帖子包含大量线程对话,只能迁移到第9级 以上来自于谷歌翻译 以下为原文 Well explained Koudela.David.001 ‌You really helped me a lot with the equations. I really do not understand why such an information is not added in either datasheet nor application note. I want to ask, is there a reference for calculating the output values? Because I searched a lot and did not find any thing. Again, thanks for your effort with me. Note: the original post contained a large number of threaded conversations and was only able to be migrated to the 9th level |
|
|
|
我很高兴你发现这些信息很有用。
正如你在前面的讨论中所看到的那样,同样的惊喜发生在我身上。我还认为这些简单的解释应该添加到数据表和/或相关的应用笔记中。 计算输出值的方法用于许多其他传感器(如果不是全部) - 加速度计,陀螺仪,压力传感器...... 以上来自于谷歌翻译 以下为原文 I am glad you find the information useful. The same suprise happened to me, as you could see in the earlier discussion. I also think these simple explanations should be added to datasheet and/or the related application note. The same way of computing output values is used for a lot of other sensors (if not all) - accelerometers, gyroscopes, pressure sensors... |
|
|
|
只有小组成员才能发言,加入小组>>
请教:在使用UDE STK时,单片机使用SPC560D30L1,在配置文件怎么设置或选择?里面只有SPC560D40的选项
2780 浏览 1 评论
3251 浏览 1 评论
请问是否有通过UART连接的两个微处理器之间实现双向值交换的方法?
1825 浏览 1 评论
3667 浏览 6 评论
6063 浏览 21 评论
1348浏览 4评论
对H747I-DISCO写程序时将CN2的st-link复用为usart1,再次烧录时无法检测到stlink怎么解决?
373浏览 2评论
STM32G474RE芯片只是串口发个数据就发烫严重是怎么回事?
468浏览 2评论
STM32处理增量式编码器Z信号如何判断中断是正转的还是反向转的?
292浏览 2评论
使用STM32F407VET6的USB2.0功能,发现ctl后芯片无数据返回,是什么原因可能导致的呢?
215浏览 2评论
小黑屋| 手机版| Archiver| 电子发烧友 ( 湘ICP备2023018690号 )
GMT+8, 2025-1-11 21:15 , Processed in 1.094723 second(s), Total 56, Slave 50 queries .
Powered by 电子发烧友网
© 2015 bbs.elecfans.com
关注我们的微信
下载发烧友APP
电子发烧友观察
版权所有 © 湖南华秋数字科技有限公司
电子发烧友 (电路图) 湘公网安备 43011202000918 号 电信与信息服务业务经营许可证:合字B2-20210191 工商网监 湘ICP备2023018690号