IUM使用指南 2.doc_第1页
IUM使用指南 2.doc_第2页
IUM使用指南 2.doc_第3页
IUM使用指南 2.doc_第4页
IUM使用指南 2.doc_第5页
已阅读5页,还剩3页未读 继续免费阅读

下载本文档

版权说明:本文档由用户提供并上传,收益归属内容提供方,若内容存在侵权,请进行举报或认领

文档简介

A Guide To using IMU (Accelerometer and Gyroscope Devices) in Embedded Applications.在嵌入式应用中使用IMU(加速度计和陀螺仪的设备)指南。(翻译部分)Part 1. Accelerometer第一部分 加速度计To understand this unit well start with the accelerometer. When thinking about accelerometers it is often useful to image a box in shape of a cube with a ball inside it.You may imagine something else like a cookie or a donut , but Ill imagine a ball:要了解这个模块我们先从加速度计开始。当我们在想象一个加速度计的时候我们可以把它想作一个圆球在一个方盒子中。你可能会把它想作一个饼干或者甜圈,但我就把它当做一个球好了:If we take this box in a place with no gravitation fields or for that matter with no other fields that might affect the balls position the ball will simply float in the middle of the box. You can imagine the box is in outer-space far-far away from any cosmic bodies, or if such a place is hard to find imagine at least a space craft orbiting around theplanet where everything is in weightless state . From the picture above you can see that we assign to each axis a pair of walls (we removed the wall Y+ so we can look inside the box). Imagine that each wall is pressure sensitive. If we move suddenly the box to the left (we accelerate it with acceleration 1g = 9.8m/s2), the ball will hit the wall X-. We then measure the pressure force that the ball applies to the wall and output a value of-1g on the X axis.我们假定这个盒子不在重力场中或者其他任何会影响球的位置的场中,球处于盒子的正中央。你可以想象盒子在外太空中,远离任何天体,如果很难想象,那就当做盒子在航天飞机中,一切东西都处于无重力状态。在上面的图中你可以看到我们给每个轴分配了一对墙(我们移除了Y+以此来观察里面的情况)。设想每面墙都能感测压力。如果我们突然把盒子向左移动(加速度为1g=9.8m/s2),那么球会撞上X-墙。然后我们检测球撞击墙面产生的压力,X轴输出值为-1g。Please note that the accelerometer will actually detect a force that is directed in the opposite direction from the acceleration vector. This force is often called Inertial Force or Fictitious Force . One thing you should learn from this is that an accelerometer measures acceleration indirectly through a force that is applied to one of its walls(according to our model, it might be a spring or something else in real life accelerometers). This force can be caused by the acceleration , but as well see in the next example it is not always caused by acceleration.If we take our model and put it on Earth the ball will fall on the Z- wall and will apply a force of 1g on the bottom wall, as shown in the picture below:请注意加速度计检测到得力的方向与它本身加速度的方向是相反的。这种力量通常被称为惯性力或假想力 。在这个模型中你你应该学到加速度计是通过间接测量力对一个墙面的作用来测量加速度的,在实际应用中,可能通过弹簧等装置来测量力。这个力可以是加速度引起的,但在下面的例子中,我们会发现它不一定是加速度引起的。如果我们把模型放在地球上,球会落在Z-墙面上并对其施加一个1g的力,见下图:In this case the box isnt moving but we still get a reading of -1g on the Z axis. The pressure that the ball has applied on the wall was caused by a gravitation force. In theory it could be a different type of force for example, if you imagine that our ball is metallic, placing a magnet next to the box could move the ball so it hits another wall. This was said just to prove that in essence accelerometer measures force not acceleration.It just happens that acceleration causes an inertial force that is captured by the force detection mechanism of the accelerometer. While this model is not exactly how a MEMS sensor is constructed it is often useful in solving accelerometer related problems. There are actually similar sensors that havemetallic balls inside, they are called tilt switches, however they are more primitive and usually they can only tell if the device is inclined within some range or not, not the extent of inclination. So far we have analyzed the accelerometer output on a single axis and this is all youll get with a single axis accelerometers. The real value of triaxial accelerometers comesfrom the fact that they can detect inertial forces on all three axes. Lets go back to our box model, and lets rotate the box 45 degrees to the right. The ball will touch 2 walls now: Z- and X- as shown in the picture below:在这种情况下盒子没有移动但我们任然读取到Z轴有-1g的值。球在墙壁上施加的压力是由引力造成的。在理论上,它可以是不同类型的力量 - 例如,你可以想象我们的球是铁质的,将一个磁铁放在盒子旁边那球就会撞上另一面墙。引用这个例子只是为了说明加速度计的本质是检测力而非加速度。只是加速度所引起的惯性力正好能被加速度计的检测装置所捕获。虽然这个模型并非一个MEMS传感器的真实构造,但它用来解决与加速度计相关的问题相当有效。实际上有些类似传感器中有金属小球,它们称作倾角开关,但是它们的功能更弱,只能检测设备是否在一定程度内倾斜,却不能得到倾斜的程度。到目前为止,我们已经分析了单轴的加速度计输出,这是使用单轴加速度计所能得到的。三轴加速度计的真正价值在于它们能够检测全部三个轴的惯性力。让我们回到盒子模型,并将盒子向右旋转45度。现在球会与两个面接触:Z-和X-,见下图:The values of 0.71 are not arbitrary, they are actually an approximation for SQRT(1/2).This will become more clear as we introduce our next model for the accelerometer.In the previous model we have fixed the gravitation force and rotated our imaginary box.In last 2 examples we have analyzed the output in 2 different box positions, while the force vector remained constant. While this was useful in understanding how the accelerometer interacts with outside forces, it is more practical to perform calculations if we fix the coordinate system to the axes of the accelerometer and imagine that the force vector rotates around us.0.71g这个值是不是任意的,它们实际上是1/2的平方根的近似值。我们介绍加速度计的下一个模型时这一点会更清楚。在上一个模型中我们引入了重力并旋转了盒子。在最后的两个例子中我们分析了盒子在两种情况下的输出值,力矢量保持不变。虽然这有助于理解加速度计是怎么和外部力相互作用的,但如果我们将坐标系换为加速度的三个轴并想象矢量力在周围旋转,这会更方便计算。Please have a look at the model above, I preserved the colors of the axes so you can make a mental transition from the previous model to the new one. Just imagine that each axis in the new model is perpendicular to the respective faces of the box in the previous model. The vector R is the force vector that the accelerometer is measuring (it could be eitherthe gravitation force or the inertial force from the examples above or a combination of both). Rx, Ry, Rz are projection of the R vector on the X,Y,Z axes. Please notice the following relation:R2 = Rx2 + Ry2 + Rz2 (Eq. 1)which is basically the equivalent of the Pythagorean theorem in 3D.Remember that a little bit earlier I told you that the values of SQRT(1/2) 0.71 are not random. If you plug them in the formula above, after recalling that our gravitation force was 1 g we can verify that:12 = (-SQRT(1/2) )2 + 0 2 + (-SQRT(1/2)2simply by substituting R=1, Rx = -SQRT(1/2), Ry = 0 , Rz = -SQRT(1/2) in Eq.1 After a long preamble of theory were getting closer to real life accelerometers. The values Rx, Ry, Rz are actually linearly related to the values that your real-life accelerometer will output and that you can use for performing various calculations.Before we get there lets talk a little about the way accelerometers will deliver this information to us. Most accelerometers will fall in two categories: digital and analog.Digital accelerometers will give you information using a serial protocol like I2C , SPI or USART, while analog accelerometers will output a voltage level within a predefined range that you have to convert to a digital value using an ADC (analog to digital converter) module. I will not go into much detail about how ADC works, partly because it is such an extensive topic and partly because it is different from one platform to another. Somemicrocontroller will have a built-in ADC modules some of them will need external components in order to perform the ADC conversions. No matter what type of ADC module you use youll end up with a value in a certain range. For example a 10-bit ADC module will output a value in the range of 0.1023, note that 1023 = 210 -1. A 12-bit ADC module will output a value in the range of 0.4095, note that 4095 = 212-1. Lets move on by considering a simple example, suppose our 10bit ADC module gave us thefollowing values for the three accelerometer channels (axes):AdcRx = 586AdcRy = 630AdcRz = 561Each ADC module will have a reference voltage, lets assume in our example it is 3.3V. To convert a 10bit adc value to voltage we use the following formula:VoltsRx = AdcRx * Vref / 1023A quick note here: that for 8bit ADC the last divider would be 255 = 2 8 -1 , and for12bit ADC last divider would be 4095 = 212 -1.Applying this formula to all 3 channels we get:VoltsRx = 586 * 3.3V / 1023 = 1.89V (we round all results to 2 decimal points)VoltsRy = 630 * 3.3V / 1023 = 2.03VVoltsRz = 561 * 3.3V / 1023 = 1.81VEach accelerometer has a zero-g voltage level, you can find it in specs, this is the voltage that corresponds to 0g. To get a signed voltage value we need to calculate the shift from this level. Lets say our 0g voltage level is VzeroG = 1.65V. We calculate thevoltage shifts from zero-g voltage as follows:DeltaVoltsRx = 1.89V 1.65V = 0.24VDeltaVoltsRy = 2.03V 1.65V = 0.38VDeltaVoltsRz = 1.81V 1.65V = 0.16VWe now have our accelerometer readings in Volts , its still not in g (9.8 m/s2), to do the final conversion we apply the accelerometer sensitivity, usually expressed in mV/g. Lets say our Sensitivity = 478.5mV/g = 0.4785V/g. Sensitivity values can be found in accelerometer specifications. To get the final force values expressed in g we use thefollowing formula:Rx = DeltaVoltsRx / SensitivityRx = 0.24V / 0.4785V/g = 0.5gRy = 0.38V / 0.4785V/g = 0.79gRz = 0.16V / 0.4785V/g = 0.33gWe could of course combine all steps in one formula, but I went through all the steps to make it clear how you go from ADC readings to a force vector component expressed in g.Rx = (AdcRx * Vref / 1023 VzeroG) / Sensitivity (Eq.2)Ry = (AdcRy * Vref / 1023 VzeroG) / SensitivityRz = (AdcRz * Vref / 1023 VzeroG) / Sensitivity请看看在上面的模型,我保留了轴的颜色,以便你的思维能更好的从上一个模型转到新的模型中。想象新模型中每个轴都分别垂直于原模型中各自的墙面。矢量R是加速度计所检测的矢量(它可能是重力或上面例子中惯性力的合成)。RX,RY,RZ是矢量R在X,Y,Z上的投影。请注意下列关系:,R 2 = RX 2 + RY 2 + RZ 2(公式1)此公式等价于三维空间勾股定理。还记得我刚才说的1/2的平方根0.71不是个随机值吧。如果你把它们代回上式,回顾一下重力加速度是1g,那我们就能验证:1 2 =(SQRT(1/2) 2 + 0 2 +(SQRT(1/2) 2在公式1中简单的取代: R=1, Rx = -SQRT(1/2), Ry = 0 , Rz = -SQRT(1/2)经过一大段的理论序言后,我们和实际的加速度计很靠近了。RX,RY,RZ值是实际中加速度计输出的线性相关值,你可以用它们进行各种计算。在我们运用它之前我们先讨论一点获取加速度计数据的方法。大多数加速度计可归为两类:数字和模拟。数字加速度计可通过I2C,SPI或USART方式获取信息,而模拟加速度计的输出是一个在预定范围内的电压值,你需要用ADC(模拟量转数字量)模块将其转换为数字值。我将不会详细介绍ADC是怎么工作的,部分原因是这是个很广的话题,另一个原因是不同平台的ADC都会有差别。有些MCU具有内置ADC模块,而有些则需要外部电路进行ADC转换。不管使用什么类型的ADC模块,你都会得到一个在一定范围内的数值。例如一个10位ADC模块的输出值范围在0 . 1023间,请注意,1023 = 2 10 -1。一个12位ADC模块的输出值范围在0 . 4095内,注意,4095 =

温馨提示

  • 1. 本站所有资源如无特殊说明,都需要本地电脑安装OFFICE2007和PDF阅读器。图纸软件为CAD,CAXA,PROE,UG,SolidWorks等.压缩文件请下载最新的WinRAR软件解压。
  • 2. 本站的文档不包含任何第三方提供的附件图纸等,如果需要附件,请联系上传者。文件的所有权益归上传用户所有。
  • 3. 本站RAR压缩包中若带图纸,网页内容里面会有图纸预览,若没有图纸预览就没有图纸。
  • 4. 未经权益所有人同意不得将文件中的内容挪作商业或盈利用途。
  • 5. 人人文库网仅提供信息存储空间,仅对用户上传内容的表现方式做保护处理,对用户上传分享的文档内容本身不做任何修改或编辑,并不能对任何下载内容负责。
  • 6. 下载文件中如有侵权或不适当内容,请与我们联系,我们立即纠正。
  • 7. 本站不保证下载资源的准确性、安全性和完整性, 同时也不承担用户因使用这些下载资源对自己和他人造成任何形式的伤害或损失。

评论

0/150

提交评论