/
Freescale Semiconductor Document Number AN Application Note Rev Freescale Semiconductor Document Number AN Application Note Rev

Freescale Semiconductor Document Number AN Application Note Rev - PDF document

briana-ranney
briana-ranney . @briana-ranney
Follow
664 views
Uploaded On 2014-12-11

Freescale Semiconductor Document Number AN Application Note Rev - PPT Presentation

6 032013 20072009 20122013 Freescale Semiconductor Inc All rights reserved Contents Tilt Sensing Using a ThreeAxis Accelerometer by Mark Pedley 1 Introduction Accelerometers are sensitive to both linear acceleration and the local gravitational fiel ID: 21977

032013 20072009

Share:

Link:

Embed:

Download Presentation from below link

Download Pdf The PPT/PDF document "Freescale Semiconductor Document Number ..." is the property of its rightful owner. Permission is granted to download and print the materials on this web site for personal, non-commercial use only, and to display it on your personal computer provided you do not modify the materials and that you retain all copyright notices contained in the materials. By downloading content from our website, you accept the terms of this agreement.


Presentation Transcript

Rev. 6, 03/2013 ©2007-2009, 2012-2013 Freescale Semiconductor, Inc. All rights reserved. Contents Tilt Sensing Using a Three-Axis by:Mark Pedley1IntroductionAccelerometers are sensitive and the local gravitational ' user interfaces while the to automatically switch beaccelerometer. The techniques are applicable to both r signal digitization, to analog accelerometers. For cthat the accelerometer is mounted in a smartphone or tablet but the arguments appl accelerometer.1Introduction . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 11.1Key Words. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 21.2Summary. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 22Accelerometer Output Under Gravity and Acceleration. . 33Pitch and Roll Estimation. . . . . . . . . . . . . . . . . . . . . . . . . 64Calculating the Angle Between Two Accelerometer Readings. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 175Calculating the Tilt Angle. . . . . . . . . . . . . . . . . . . . . . . . 196Selecting Portrait and Landscape Modes . . . . . . . . . . . 21 Tilt Sensing Using a Three-AxFreescale Semiconductor, Inc. The following Freescale applicat•AN4399 "High Precision Calibration of a Three Axis Accelerometer" describes how a product containing a consumer grade accelerometer can be re-calibrated after manufacture to achieve a high level of accuracy.•AN4248 "Implementing a Tilt-Cwhere the accelerometer is used to correct•AN4249 "Accuracy of Angle Estimation in eCompass and 3-D Pothe effect of accelerometer sense accuracy and ultimately on the eCompass heading accuracy.1.1Key WordsAccelerometer, Tilt, Roll, Pitch, Portrait, Landscape.1.2Summary1.Accelerometer sensors measure the difference between any linear accelerometer’s reference frame and the earth's gravitational field vector.2.In the absence of linear acceler output is a measurement of the rotated angles.3.The orientation angles are depecommon order is the aerospace sequence of yaw then pitch and finally a roll rotation.4.Accelerometer sensors are insensitive to rotation about the earth's gravitational field vector. The es therefore have mathematical instabilities when rotation axes 5.Simple vector algebra expressi6.The most common application of accelerometers r controlling a tablet PC’s display Tilt Sensing Using a Three-AxFreescale Semiconductor, Inc. 2Accelerometer Output Under Gravity and AccelerationAccelerometers are sensitive to the difference between the linear acceleration of the sensor and the local of these axes willwill, however, result in a negative reading on the accelerometer. This can be understood by looking at an electron MEMS accelerometer. The upper proof mass is suspended by the restoring springs. Both a gravitational field directed to the left and a linear acceleration of the package to the the proof mass to Figure1. Electron Microscope Image of MEMS Accelerometer Proof Mass and Sensing Platesmeasured from the change in capacitance between the fingers of the A simplified transducer model and Figure2 Movable Proof Mass with fingers Restoring springs Sensing plates Tilt Sensing Using a Three-AxFreescale Semiconductor, Inc. Figure2. Simplified Transducer Model and Equivalent Electrical CircuitFigure3•The x-axis•The z-axis•The y-axis axes so that the three axes form a right respectively. Proof MassSimplified ModelEquivalent Circuit Tilt Sensing Using a Three-AxFreescale Semiconductor, Inc. Figure3. Definition of Coordinate System and Rotation Axes the accelerometer output is negated to give value +1g in any axis aligned with the earth's dowWith this assumption, a three-axis accelerometer and undergoing linear acceleration Eqn.1tphone relative to the earth’s x axis RollPitch Yaw    Rga Tilt Sensing Using a Three-AxFreescale Semiconductor, Inc. •The accelerometer has This assumption is needed to solve Equation1acceleration from handshake or other •The initial orientation of the smarWith these additional assumptions, the smartphone accelerometer output Eqn.2roll and pitch angles from the accelerometer reading.3Pitch and Roll EstimationFigure3 in roll, axes respectively, are: Eqn.3Eqn.4Eqn.5rotation matrices do not, however, commute meaning that the composite rotation matrix and to determine their effect on the earth's gravitational field of ar0 RgR=== 100cos 010 sin001 Tilt Sensing Using a Three-AxFreescale Semiconductor, Inc. Eqn.6Eqn.7Eqn.8Eqn.9Eqn.10Eqn.11Eqn.12Eqn.13 xyz coscossinsinsincoscossinsinsinsinsincoscossinsincoscos sincoscos yxz sinsinsinsinsinsincossinsinsinsin sincoscos xzy sinsincoscossinsinsinsinsinsinsin Tilt Sensing Using a Three-AxFreescale Semiconductor, Inc. Eqn.14Eqn.15Eqn.16Eqn.17Eqn.18Eqn.19Eqn.20 sinsincoscossinsinsin yzx coscossinsinsinsincoscossinsinsinsincoscossinsinsin sinsincoscossinsinsin zxy cossinsinsinsinsinsinsincoscoscoscossinsinsincoscos sinsinsincoscos Tilt Sensing Using a Three-AxFreescale Semiconductor, Inc. Eqn.21Eqn.22Eqn.23the measured gravitational vector are all different. A consequence is thatare meaningless without first deter output has three components but, since the vector magnitude must always equal 1g in the absence of linear acceleration, has just two degrees of freedom. The z-axisnwards. All accelerometers are comp zyx coscossinsinsinsinsinsinsinsincoscossinsin sinsincossinsincoscos Tilt Sensing Using a Three-AxFreescale Semiconductor, Inc. Equation8Equation24 relating the roll Eqn.24Equation24and pitch angles are computed Eqn.25Eqn.26EquationsEquation11Eqn.27Equation27are computed according to the rotation sequence Eqn.28Eqn.29 -----------coscos----------------------------------coscos xyz xyzsinG------------------------------------------------------------------------------- ------------------------------------------------------------coscos yxz---------------- yxz Tilt Sensing Using a Three-AxFreescale Semiconductor, Inc. therefore give different resultr, this is a simple consequence of the fact that nd must always be specified when Equation8identities shows that the accelerometer measurement is the same asEqn.30Similarly, evaluating Equation11accelerometer measurement is identical to that resulting from rotations Eqn.31The solution is to restrict either thfor its Windows 8 sensor platform is orientations discussed later. sin sinsincoscos Tilt Sensing Using a Three-AxFreescale Semiconductor, Inc. Worked Example 1 for the reading (in native units of g) below:Eqn.32Substituting the accelerometer reading into Eqn.33Eqn.34Equation34Equation33however, Comparison with Equation24provided that the ATAN2 = ATAN2(). The ATAN2 function automatically returns the angle (in d on the signs of the two arguments.Regions of Instability and angle The inverse tangent function for the aerospace rotation sequence in Equation25 is mathematically defined occurs when the smartphEquation25estimate of the roll angle. The physics is straightforward to understand: when the smartphone is vertical, Equation29 with the exception where both 0.887432–1.006910= xyz------------xyz xyz0.461105–------------------------------------------------------------–= Tilt Sensing Using a Three-AxFreescale Semiconductor, Inc. , in contrast, are always defined and stable when the accelerometer is held in the earth's shows be simultaneously zerangle estimate. When the numerator is zero, Eqn.35Eqn.36 should not, however, be used as alternatives to handshake, linear acceleration, sensorwhere the local gravitational field exceeds that at the original accelerometer calibration site can lead to exceeding 1g and the square root and angle calculation having no real-valued solution.Equation26Equation25 for the roll angle of the square of the accelerometer Eqn.37Eqn.38Equation37 (which is identical to Equation26) is mathematically correct for the aerospace sequence Equation38•It is impossible for both numerator and denominator of Equation38 to be simultaneously zero and •In the absence of any rotation in pitchEquation38Equation25•When the true roll angle is zero, Equation8Equation38Equation38accelerometer reading is only when xyz (Caution: do not use) yxz (Caution: do not use) xyz xyzsignG----------------- Tilt Sensing Using a Three-AxFreescale Semiconductor, Inc. Equation38Equation25Eqn.39Eqn.40and Equation8Equation39Eqn.41Equation41Equation38 gives an accurate estimate except at orientatir rises as its value is forced to zero for stability. 1–----------------------------------1– 1–atan1–1– 1–+–---------------------------------------------------------------1–coscossincos+cos---------------------------------------------------------------------------------------------------------- Tilt Sensing Using a Three-AxFreescale Semiconductor, Inc. Figure4. Roll Angle Error Surface || for Figure5. Roll Angle Error Surface || for = 0.1 Tilt Sensing Using a Three-AxFreescale Semiconductor, Inc. to stabilize Equation29Eqn.42Eqn.43Equation424Calculating the Angle Between Two Accelerometer ovides a means to calculate the angle change between any two accelerometer readings.e triangle cosine theorem to the triaEqn.44Eqn.45The unit vector which is normal to both , and form a right-handed triplet, is Eqn.46Eqn.47 yxzsignG----------------------------------------------------------- --------------- a.baxayaz.bxbybzaxbxaybyazbza=b\tcos++== ------------------------------------------------------------------------------- nˆ nˆ abn ------------------------------------------------------------------------------ Tilt Sensing Using a Three-AxFreescale Semiconductor, Inc. Figure6lationships graphically.Figure6. Definitions of the Scalar and Vector ProductsWorked Example 2Two accelerometer readings are recoEqn.48Eqn.49Note that as a result of Equation45Eqn.50Equation47, the vector is the instantaneous rotation axis aEqn.51 \na b n (into the .b abcos xb =ab sin\n^^ \t\t\t 1.007443= 0.994750= 0.7454390.3935670.0654340.3484430.6745230.8445231.0074430.994750----------------------------------------------------------------------------------------------------------------------------------------------------------------------0.88460627.8cos nˆ sin--------------------------------------------------------------0.179772–0.364070– Tilt Sensing Using a Three-AxFreescale Semiconductor, Inc. Eqn.52provides the vector of the rotation axis normal measurements. Direct ector is orthogonal to both Eqn.53Eqn.545Calculating the Tilt Angle between the gravmeasured by the accelerometerz-axisFigure7. Calculation of the Tilt Angle from Vertical 0.383610–0.776878– nˆ nˆ 0= 0= G (0, 0, 1) Tilt Sensing Using a Three-AxFreescale Semiconductor, Inc. Eqn.55Worked Example 3The measured accel is below. By what angle Eqn.56Eqn.57Equation55, the tilt angle is:Eqn.58 ------------------------------------------------- 0.653423– ++1.000161= ---------------------- Tilt Sensing Using a Three-AxFreescale Semiconductor, Inc. 6Selecting Portrait and Landscape ModesThe first high volume use of accelerometers in consumer products was to switch a display between Figure8text or imagery.Figure8. Portrait and Landscape Screen Orientations for a Tablet PC since a direct display orientation and the accelerometer reading is not ergonomically suitable. Specifically, a user Figure8The solution is a simple state machine in reading leads to ion. Simple state transition rules are listed below.•(|| )op•(|•(|•(| Right LeftTop xy z. Tilt Sensing Using a Three-AxFreescale Semiconductor, Inc. ometer measurement space Figure9Figure9. State Transition Zones for Display Orientation Changes| | = 1g when the tablet is flat). This is orientations to occur. The lack of overlap between Document Number:AN3461Rev. 603/2013Information in this document is provided solely to enable system and software implementers to use Freescale products. There are no express or implied copyright licenses granted hereunder to design or fabricate any integrated circuits based on the information in this document.Freescale reserves the right to make changes without further notice to any products herein. Freescale makes no warranty, representation, or guarantee regarding the suitability of its products for any particular purpose, nor does Freescale assume any liability arising out of the application or use of any product or circuit, and specifically disclaims any and all liability, including without limitation consequential or incidental damages. “Typical” parameters that may be provided in Freescale data sheets and/or specifications can and do vary in different applications, and actual performance may vary over time. All operating parameters, including “typicals,” must be validated for each customer application by customer’s technical experts. Freescale does not convey any license under its patent rights nor the rights of others. Freescale sells products pursuant to standard terms and conditions of sale, which can be found at the following address: freescale.com/salestermsandconditions. How to Reach Us:Home Page: freescale.com Web Support: freescale.com/supportFreescale, the Freescale logo, AltiVec, C-5, CodeTest, CodeWarrior, ColdFire, C-Ware, Energy Efficient Solutions logo, Kinetis, mobileGT, PowerQUICC, Processor Expert, QorIQ, Qorivva, StarCore, Symphony, and VortiQa are trademarks of Freescale Semiconductor, Inc., Reg. U.S. Pat. & Tm. Off. Airfast, BeeKit, BeeStack, ColdFire+, CoreNet, Flexis, MagniV, MXC, Platform in a Package, QorIQ Qonverge, QUICC Engine, Ready Play, SafeAssure, SMARTMOS, TurboLink, Vybrid, and Xtrinsic are trademarks of Freescale Semiconductor, Inc. All other product or service names are the property of their respective owners. © 2013 Freescale Semiconductor, Inc.