完善资料让更多小伙伴认识你,还能领取20积分哦, 立即完善>
我一直在努力理解如何解释和格式化我从加速度计获得的数据。首先,我的设置:
低功耗,5.376KHz ODR,16G满量程,正常分辨率模式,ZHIE启用,ZLOW禁用,THS设置为30 (首先,我需要了解如何使用上述配置解释和格式化数据,然后我可以为我的应用程序调整内容)。 我正在使用Arduino连接到IIS2DH并在INT1上获得AOI中断。所有这些都在我的Arduino和代码中工作。 这是用于3D打印机的Z探头,因此当探头(加速度计)撞击固体表面时,它会为Z轴事件生成中断(X和Y未启用)。这一切都有效。我得到了中断,然后将OUT_Z_L和OUT_Z_H寄存器取为8位整数。从这里开始,我需要帮助理解我得到的东西以及如何解释它。 当我运行测试时,我可以将输出打印到控制台以查看发生了什么。当我这样做时,对于典型的探测'命中',我看到,二进制: Z_H = b00001000 Z_L = b00001010 我确实看到从探针点到探针点的微小差异 - 在典型的运行中有13个探针,所以我看到13对值。这是Z_H / Z_L顺序的完整集: 00001000/0000100100001001/0000101000001001/0000100100001001/0000101000001000/0000101000000111/0000011100000110/0000100000000110/0000100100001000/0000100100000111/0000100000000101/0000011100001001/0000100100001011/00001001这有意义吗?它不适合我。我从未在低字节或高字节的高4位中看到数据。我认为数据是左对齐的,并且我的正常分辨率(10位,正确吗?)我希望在低字节的低6位中看不到任何内容。我是否检索了合理的数据?如果是,我如何将其重建为一个值? 提前致谢! #iis2dh 以上来自于谷歌翻译 以下为原文 I've been trying to understand how to interpret and format the data I'm getting from the accelerometer. First, my setup: Low power, 5.376KHz ODR, 16G full scale, normal resolution mode, ZHIE enabled, ZLOW disabled, THS set to 30 (First I need to understand how to interpret and format the data with the above configuration, then I can work on tuning things for my application). I am using an Arduino to interface to the IIS2DH and getting AOI interrupts on INT1. All of this is working in my Arduino and code. This is a Z probe for a 3D printer, so when the probe (accelerometer) strikes a solid surface, it generates an interrupt for the Z axis event (X and Y are not enabled). This all works. I get the interrupt and then fetch the OUT_Z_L and OUT_Z_H registers as 8 bit integers. It is from here that I need help understanding what I am getting and how to interpret it. When I run my tests, I can print the output to the console to see what's going on. When I do this, for a typical probe 'hit', I see, in binary: Z_H = b00001000 Z_L = b00001010 I do see small differences from probe point to probe point - there are 13 probes in a typical run so I see 13 pairs of values. Here's a full set in Z_H / Z_L order:
Thanks in advance! #iis2dh |
|
相关推荐
15个回答
|
|
好的,我忽略了低功耗模式是8位数据输出的数据表。但这仍然无法解释为什么数据没有保持一致?
另外,这是我完整的配置以进行健全性检查: //设置CTRL_REG1 accelerometer_write(CTRL_REG1,0b10011100); // LPMode中的ODR 5.376kHz [7-4]低功率使能[3] Z使能[2] //设置CTRL_REG2 accelerometer_write(CTRL_REG2,0b00110001); // //设置CTRL_REG3 accelerometer_write(CTRL_REG3,0b01000000); // INT1 en [6]上的AOI(和/或中断)//设置CTRL_REG6 accelerometer_write(CTRL_REG6,0b00000000); // //设置CTRL_REG4 accelerometer_write(CTRL_REG4,0b00110000); //全面选择16G [5-4] //设置CTRL_REG5 accelerometer_write(CTRL_REG5,0b01001010); // FIFO使能[6]锁存INT1 [3] //设置INT1_CFG accelerometer_write(INT1_CFG,0b00100000); // ZHIE启用[5] //设置INT1_THS accelerometer_write(INT1_THS,Z_PROBE_SENSITIVITY); // 40 //设置INT1_DURATION accelerometer_write(INT1_DURATION,0); 以上来自于谷歌翻译 以下为原文 Ok, I overlooked the data sheet that Low Power mode is 8-bit data output. But that still does not explain why the data is not left aligned? Also, here is my complete configuration to sanity check: // setup CTRL_REG1 accelerometer_write(CTRL_REG1, 0b10011100); // ODR 5.376kHz in LPMode [7-4] Low power enable [3] Z enable [2]// setup CTRL_REG2 accelerometer_write(CTRL_REG2, 0b00110001); // // setup CTRL_REG3 accelerometer_write(CTRL_REG3, 0b01000000); // AOI (And Or Interrupt) on INT1 en [6]// setup CTRL_REG6 accelerometer_write(CTRL_REG6, 0b00000000); // // setup CTRL_REG4 accelerometer_write(CTRL_REG4, 0b00110000); // Full-scale selection 16G [5-4]// setup CTRL_REG5 accelerometer_write(CTRL_REG5, 0b01001010); // FIFO enable [6] Latch INT1 [3]// setup INT1_CFG accelerometer_write(INT1_CFG, 0b00100000); // ZHIE enabled [5]// setup INT1_THS accelerometer_write(INT1_THS, Z_PROBE_SENSITIVITY); // 40// setup INT1_DURATION accelerometer_write(INT1_DURATION, 0); |
|
|
|
是的,Z_H的所有8位都有效。
是的,如果您需要16位值,您可以按照您的提及进行操作。是的,您的解释是正确的。 所有配置的灵敏度都可以在表3中找到。抱歉由于混淆208mg / LSB是灵敏度的最大值,我查看了错误的列。您应该使用188.68mg / LSB的典型值。 在8,10,12位分辨率下,您始终使用适当数量的最高有效位。 10位模式...((256 * OUT_Z_H)+ OUT_Z_L)>> 6 12位模式......((256 * OUT_Z_H)+ OUT_Z_L)GT;→4 以上来自于谷歌翻译 以下为原文 Yes, all 8 bits of Z_H are valid. Yes, if you need 16 bit value you can do it as you mentioned.Yes, your interpretation is corrent. The sensitivity for all configuration can be found in Table 3. Sorry for the confusion the 208mg/LSB is maximum value of the sensitivity, I looked at the wrong column. You should use typical value which is 188.68mg/LSB. In 8, 10, 12 bit resolution you always use the appropriate number of most significant bits. 10 bit mode ... ((256*OUT_Z_H)+OUT_Z_L)>>6 12 bit mode ... ((256* OUT_Z_H)+ OUT_Z_L)>>4 |
|
|
|
在低功耗模式下,输出仅为8位,因此您应该忽略它
Z_L字节。中的数据 Z_L字节无效。 如果你更多地击中传感器,你应该在Z_H的高4位中看到一些值。例如,如果配置为FS = 16g,低功耗模式则LSB = 208mg,因此要查看0b00010000输出值,则必须生成加速度3328mg。 以上来自于谷歌翻译 以下为原文 In Low Power mode the output is only 8-bit, so you should simply ignore the Z_L byte. The data in Z_L byte are not valid. If you hit the sensor more, you should see also some values in high 4 bits of Z_H. For example if the configuration is FS=16g, Low Power mode the LSB=208mg, so to see 0b00010000 output value, you have to generate acceleration 3328mg. |
|
|
|
谢谢。这是否意味着对于FS = 16g和8位输出,Z_H的所有8位都有效?从中获取16位值。我向左移动8个位置并用0填充右边8个位置?
查看上面的探测点1数据: 00001000/00001001你说的是低字节(00001001)应该被忽略。那么,实际测量的加速度是多少,是:00001000(实际上是00000000 00001000,如果是16位)还是其他什么? 所以在这种情况下:8 * 208mg = 1664mg或1.664g这是有道理的,所以也许这是正确的解释方式? 你在哪里得到208毫克的LSB在FS = 16克?在数据表中看起来它应该是表57中的186毫克?所以8 * 208mg = 1.488g。它是否正确? 假设我上面的解释是正确的 - 我可以按原样使用Z_H字节,数据如何以10位和12位分辨率模式排列? 以上来自于谷歌翻译 以下为原文 Thank you. Does this mean that with FS=16g and 8-bit output that all 8 bits of Z_H are valid? To make a 16 bit value from it. do I shift left 8 places and fill the right 8 places with 0? Looking at my data above for probe point 1:
So in this case: 8 * 208mg = 1664mg or 1.664g This makes some sense so perhaps it is the correct way to interpret? And where did you get the 208mg for the LSB in FS=16g? In the datasheet it looks like it should be 186mg from table 57? So 8 * 208mg = 1.488g. Is this correct? Assuming my interpretation above is correct - that I can just use Z_H byte as-is, how is the data arranged in 10 and 12 bit resolution modes? |
|
|
|
因此,基于这种更好的理解,我更新了我的代码并设置FS = 4g。因此,1 LSB应为32mg。我将阈值设置为'60',即1920mg(1.92g)。但是,当我探测时,我看到虚假命中甚至探测点本身都低于阈值:
& sharp1 1.57g & sharp2 1.95g & sharp3 1.22g & sharp4 0.32g & sharp5 1.82g & sharp6 0.58g & sharp20 1.73g 粗体数据是实际的13个探测点,其他都是错误的触发点。我的阈值在8位分辨率下设置为60,FS = 4G(我的CTRL_REG4设置为0b00010000。所以我不应该只看到大于60 * 32mg = 1.92g的加速度? 以上来自于谷歌翻译 以下为原文 So based on this better understanding, I updated my code and set FS=4g. So, 1 LSB should be 32mg. I set my threshold to '60', which is 1920mg (1.92g). However, when I probe I am seeing false hits and even probe points themselves that are less than the threshold: &sharp1 1.57g &sharp2 1.95g &sharp3 1.22g &sharp4 0.32g &sharp5 1.82g &sharp6 0.58g &sharp20 1.73g The data in bold are the actual 13 probe points, the others are all false triggers. My threshold is set to 60 at 8-bit resolution and FS=4G (my CTRL_REG4 is set to 0b00010000. So shouldn't I only see accelerations greater than 60 * 32mg = 1.92g? |
|
|
|
我猜你没有读取与触发中断完全相同的样本。 ODR
5.376KHz是非常快的,你的微控制器处理闯入和传感器读取数据之间有一个dalay。所以你可能在击中之后读取后期值,它可以低于阈值。可能还会有一些弹跳。 以上来自于谷歌翻译 以下为原文 My guess it that you are not reading the exact same sample as triggered the interrupt. The ODR 5.376KHz is quite fast and there is a dalay between your microcontroller process the intterupt and read data from the sensor. So you are probably reading late value, after the hit, which can be lower then the treshold. There will be probably also some bouncing. |
|
|
|
有没有办法读取产生中断的实际值?
以上来自于谷歌翻译 以下为原文 Is there a way to read the actual value that generated the interrupt? |
|
|
|
是的,有办法怎么做。您需要使用FIFO,更具体地说是Stream-to-FIFO模式。在此模式下,您可以分析生成的历史记录
打断。 FIFO中的最后一个样本将触发中断。 以上来自于谷歌翻译 以下为原文 Yes, there is a way how to do it. You need to use the FIFO, to be more specific the Stream-to-FIFO mode. In this mode you can analyze the history that generates an interrupt. The last sample in the FIFO will the one which triggered the interrupt. |
|
|
|
再次感谢。我已经实现了Stream-to-FIFO并且有两个问题:
1)一旦触发中断(在我的情况下为INT1),除了复位INT1之外,我还需要做任何重置吗? 2)你说'FIFO中的最后一个样本'是触发INT1的那个样本。我只是想确保我理解这一点,因为它是一个FIFO。你是说我需要读取32个值来获取'最后一个样本',或者它是否是在生成INT1之后的第一个读取? 谢谢! 注意:原始帖子包含大量线程对话,只能迁移到第9级 以上来自于谷歌翻译 以下为原文 Thanks again. I've implemented the Stream-to-FIFO and have 2 questions: 1) Once the interrupt is triggered (INT1 in my case) do I need to do anything to reset other than reset the INT1? 2) you say 'last sample in the FIFO' is the one that triggered the INT1. I just want to make sure I understand this since it is a FIFO. Are you saying that I need to read 32 values to get to the 'last sample' or will if it be the first read after the INT1 is generated? thanks! Note: the original post contained a large number of threaded conversations and was only able to be migrated to the 9th level |
|
|
|
米罗斯拉夫,我正在取得进步!感谢您的帮助。我想我现在对加速度计有了更好的理解,但还有更多的学习要做。我实现了Stream-to-FIFO模式,并在每个INT1之后打印32字节的数据。结果是合乎逻辑的,它们应该允许我开始调整系统。以下是单个探针接触的数据:
& sharp1 - 时间:22.68s - 自上次:22.68s 加速度数据(FIFO): 0:0.74g 1:0.74g 2:0.70g 3:0.80g 4:0.86g 5:0.99g 6:1.15g 7:1.18g 8:1.31g 9:1.34克 11:1.86克 12:0.38g 13:1.92g 14:1.60克 15:0.13g 16:1.02g 17:1.44克 18:1.12g 19:1.18g 20:1.66g 21:1.28g 22:1.09g 23:1.22g 24:1.28g 25:1.34克 26:0.99g 27:0.64g 28:0.77克 29:1.02g 30:0.86g 31:0.86克 注意点&sharp10。我在所有13个探头触点中都看到了完全相同的模式。 9个探头触点的值为4.06g,但有几个点低至3.26g。这可能是由于硬塑料表面或与打印机机械方面有关的其他因素。该数据采用FS = 4g和低功率8位数据模式收集,阈值设置为95(3.04g)。没有高通滤波器。 我接下来需要了解高通滤波器以及如何使用它。 我还需要通过调整探头速度等来试验是否可以降低接触冲击力。 您如何看待这些数据?它是否能为您提供有关如何最好地调整系统的任何想法? 注意:原始帖子包含大量线程对话,只能迁移到第9级 以上来自于谷歌翻译 以下为原文 Miroslav, I am making progress! Thank you for your help. I think I have a much better understanding of the accelerometer now but have some more learning to do. I implemented the Stream-to-FIFO mode and print the 32 bytes of data after each INT1. The results are logical and they should allow me to start to tune the system. Here are the data for a single probe contact: &sharp1 - Time: 22.68s - Since Last: 22.68s acceleration data (FIFO): 0: 0.74g 1: 0.74g 2: 0.70g 3: 0.80g 4: 0.86g 5: 0.99g 6: 1.15g 7: 1.18g 8: 1.31g 9: 1.34g 11: 1.86g 12: 0.38g 13: 1.92g 14: 1.60g 15: 0.13g 16: 1.02g 17: 1.44g 18: 1.12g 19: 1.18g 20: 1.66g 21: 1.28g 22: 1.09g 23: 1.22g 24: 1.28g 25: 1.34g 26: 0.99g 27: 0.64g 28: 0.77g 29: 1.02g 30: 0.86g 31: 0.86g Note point &sharp10. I see exactly this same pattern in all 13 probe contacts. The value is 4.06g for 9 of the probe contacts but there are a few points as low as 3.26g. This may be due to the hard plastic surface or other factors related to the mechanical aspects of the printer. This data was collected with FS=4g and low power 8-bit data mode with threshold value set to 95 (3.04g) . No high pass filter. I next need to understand high pass filter and how to use it. I also need to experiment to see if I can make the contact impact lower by adjusting the probe speed, etc. What do you think about this data? Does it give you any ideas on how best to tune the system now? Note: the original post contained a large number of threaded conversations and was only able to be migrated to the 9th level |
|
|
|
你好,
我是这款加速计传感器的新手。我已经将Interrupt 2配置为适用于我的应用程序,它最终运行良好。但是,我只是不明白你们是如何决定申请的FS和THS价值的?我不得不做试验和错误的方法,这是一项繁琐的工作。我对这个问题的目标是理解这个概念,这样我就不必再为不同的应用程序重复这种试错法。 请帮帮我。 以上来自于谷歌翻译 以下为原文 Hello, I am new to this accelerometer sensor. I have configured the Interrupt 2 to work for my application and it finally is working great. But, I just don't understand how did you guys decide on the FS and THS value for your application? I had to do trial and error method and it was a tedious work. My goal for this question is to understand this concept so that I do not have to do this trial and error method all over again for different applications as well. Please help me. |
|
|
|
我取决于你的目标。
- 你可以做一些理论分析。例如,对于倾斜检测,您知道重力是1g,您可以使用三角函数来计算特定角度的值。 - 您可以在某些想要检测或分析的运动过程中记录加速度数据,然后在计算机中离线处理它们,检查激励期间值的最大值和最小值以及水平。这为您提供了您应该使用的FS和阈值的信息。 - 有时也使用试验和错误的方法 以上来自于谷歌翻译 以下为原文 I depends what is your objective. - You can do some teoretical analysis. For example for tilt detection, you know the gravity is 1g and the you can use trigonometric functions to calculate the value for certain angle. - You can record acceleration data during some movement which you want to detect or analyze and then you process them offline in you computer, check the maximu and minuimum values and levels which the value raech during stimulation. This give you the information what FS and threshold you should use. - Trial and error is sometimes also used approach |
|
|
|
你好,
感谢您的建议并教我如何为不同的应用更好地配置加速度计。但是,我对THS寄存器有另一个疑问。根据数据表,当我在FS8配置加速度计时,'1 LSb为62 mg'。那么,这究竟意味着什么? 例如,当我将THS寄存器设置为0x10且INT1_CFG = 0x02(XHIE)时。那么当中断何时被启用时,THS寄存器的值的阈值是多少?如果我含糊不清,我很抱歉?我不确定门槛值是多少? 另外,你说倾斜它必须是1克。当它倾斜而不是振动时,我可以“仅”启用中断吗?如果是这样,您将如何配置整个中断和加速度计? (考虑倾斜是在正常的地方) 以上来自于谷歌翻译 以下为原文 Hello, Thank you for the advice and teaching me the method to arrive at better configuration of the accelerometer for different application. However, I have an another doubt regarding the THS register. According to the datasheet when I have configured my accelerometer at FS8, '1 LSb is 62 mg'. So, what does that exactly mean ? For example, when I have THS register set at 0x10 with INT1_CFG = 0x02(XHIE). So when exactly does the interrupt get enabled and what is the value of Threshold for that value of THS register ? I am sorry if I am being vague? I am not sure what will be the threshold value ? Also, you said for tilt it has to be 1g. Can I make the interrupt enabled 'only' when its tilted and not vibration ? If so, how would you configure the interrupt and accelerometer in whole? (Consider the tilting is at a normal place) |
|
|
|
在特定情况下,如果INT1_THS = 0x10且INT1_CFG = 0x02(XHIE)且满量程8g,则表示如果X轴上的加速度绝对值高于16 * 62 mg = 992mg,将触发中断。
为避免噪声或随机峰值触发中断,您可以设置INT1_DURATION。加速度高于/低于阈值超过DURATION寄存器定义的时间段然后将触发中断。 以上来自于谷歌翻译 以下为原文 In your particular case if INT1_THS = 0x10 and INT1_CFG = 0x02(XHIE) with Full Scale 8g, it means the interrupt will be triggered if the absolute value of acceleration in X axis is higher then 16 * 62 mg = 992mg. To avoid interrupt triggering by noise or random peaks you can set the INT1_DURATION. It the acceleration is above/bellow threshold for more then the time period defined by the DURATION register then interrupt will be triggered. |
|
|
|
谢谢你,先生。现在,我了解如何为不同的应用程序配置Accelerometer中断。
问候 兰芝斯 以上来自于谷歌翻译 以下为原文 Thank you sir. Now, I understand how to configure the Accelerometer interrupt for different applications. Regards Ranjith |
|
|
|
只有小组成员才能发言,加入小组>>
请教:在使用UDE STK时,单片机使用SPC560D30L1,在配置文件怎么设置或选择?里面只有SPC560D40的选项
2655 浏览 1 评论
3216 浏览 1 评论
请问是否有通过UART连接的两个微处理器之间实现双向值交换的方法?
1790 浏览 1 评论
3619 浏览 6 评论
5997 浏览 21 评论
946浏览 4评论
1319浏览 4评论
在Linux上安装Atollic TRUEStudio的步骤有哪些呢?
591浏览 3评论
使用DMA激活某些外设会以导致外设无法工作的方式生成代码是怎么回事
1309浏览 3评论
1369浏览 3评论
小黑屋| 手机版| Archiver| 电子发烧友 ( 湘ICP备2023018690号 )
GMT+8, 2024-11-29 13:15 , Processed in 1.535000 second(s), Total 105, Slave 89 queries .
Powered by 电子发烧友网
© 2015 bbs.elecfans.com
关注我们的微信
下载发烧友APP
电子发烧友观察
版权所有 © 湖南华秋数字科技有限公司
电子发烧友 (电路图) 湘公网安备 43011202000918 号 电信与信息服务业务经营许可证:合字B2-20210191 工商网监 湘ICP备2023018690号