Measuring Tilt with Low-g Accelerometers

Transcription

1 Freescale Semiconductor Application Note Rev 0, 05/2005 Measuring Tilt with Low-g s by: Michelle Clifford and Leticia Gomez Sensor Products, Tempe, AZ INTRODUCTION This application note describes how accelerometers are used to measure the tilt of an object. s can be used for measuring both dynamic and static measurements of acceleration. Tilt is a static measurement where gravity is the acceleration being measured. Therefore, to achieve the highest degree resolution of a tilt measurement, a low-g, highsensitivity accelerometer is required. The Freescale MMA6200Q and MMA7260Q series accelerometers are good solutions for XY and XYZ tilt sensing. These devices provide a sensitivity of 800 mv/g in 3.3 V applications. The MMA2260D and MMA1260D are also good solutions for 5 V applications providing a sensitivity of 1200mV/g for X and Z, respectively. All of these accelerometers will experience acceleration in the range of +1g to -1g as the device is tilted from -90 degrees to +90 degrees. 1g = 9.8 m/s MODULE +1 g A simple tilt application can be implemented using an 8 or 10-bit microcontroller that has 1 or 2 ADC channels to input the analog output voltage of the accelerometers and general purpose I/O pins for displaying the degrees either on a PC through a communication protocol or on an LCD. See Figure 1 for a typical block diagram. Some applications may not require a display at all. These applications may only require an I/O channel to send a signal for turning on or off a device at a determined angle range. LCD Microcontroller with ADC Interface Circuit RS232, USB Device selection depends on the angle of reference and how the device will be mounted in the end application. This will allow you to achieve the highest degree resolution for a given solution due to the nonlinearity of the technology. First, you need to know what the sensing axis is for the accelerometer. See Figure 2 to see where the sensing axes are for the Figure 1. Typical Tilt Application Block Diagram MOUNTING CONSIDERATIONS MMA7260Q. To obtain the most resolution per degree of change, the IC should be mounted with the sensitive axis parallel to the plane of movement where the most sensitivity is desired. For example, if the degree range that an application will be measuring is only 0 to 45 and the PCB will be mounted perpendicular to gravity, then an X-Axis device Freescale Semiconductor, Inc., All rights reserved.

2 would be the best solution. If the degree range was 0 to 45 and the PCB will be mounted perpendicular to gravity, then a Z-Axis device would be the best solution. This is understood more when thinking about the output response signal of the device and the nonlinearity. Z Sensing Axis for Z-Axis X-Axis X-Axis PCB Z-Axis Z-Axis PCB Sensing Axis Sensing Axis for X-Axis X Sensing Axis for Y-Axis Y Sensing Axis 1 g 1g 1g 1 g Gravity MMA7260Q Series Gravity Gravity Figure 2. Sensing Axis for the MMA7260Q With X, Y, and Z-Axis for Sensing Acceleration Figure 3. Gravity Component of a Tilted X-Axis Figure 4. Gravity Component of a Tilted Z-Axis As seen in Figure 5, the typical output of capacitive, micromachined accelerometers is more like a sine function. The figure shows the analog output voltage from the accelerometer for degrees of tilt from -90 to +90. The change in degrees of tilt directly corresponds to a change in the acceleration due to a changing component of gravity acted on the accelerometer. The slope of the curve is actually the sensitivity of the device. NONLINEARITY 3.3 As the device is tilted from 0, the sensitivity decreases. You see this in the graph as the slope of output voltage decreases for an increasing tilt towards 90. Because of this nonlinearity, the degree resolution of the application must be determined at 0 and 90 to ensure the lowest resolution is still within the required application resolution. This will be explained more in the following section Output(V) X-axis Y-axis Z-axis Angle(degree) Figure 5. Typical Nonlinear Output of X, Y, and Z-Axis s 2 Freescale Semiconductor

3 CALCULATING DEGREE OF TILT In order to determine the angle of tilt, θ, the A/D values from the accelerometer are sampled by the ADC channel on the microcontroller. The acceleration is compared to the zero g offset to determine if it is a positive or negative acceleration, e.g., if value is greater than the offset then the acceleration is seeing a positive acceleration, so the offset is subtracted from the value and the resulting value is then used with a lookup table to determine the corresponding degree of tilt (See Table1 for a typical 8-bit lookup table), or the value is passed to a tilt algorithm. If the acceleration is negative, then the value is subtracted from the offset to determine the amount of negative acceleration and then passed to the lookup table or algorithm. One solution can measure 0 to 90 of tilt with a single axis accelerometer, or another solution can measure 360 of tilt with two axis configuration (XY, X and Z), or a single axis configuration (e.g. X or Z), where values in two directions are converted to degrees and compared to determine the quadrant that they are in. A tilt solution can be solved by either implementing an arccosine function, an arcsine function, or a look-up table depending on the power of the microcontroller and the accuracy required by the application. For simplicity, we will use the equation: θ = arcsin(x). The arcsin(y) can determine the range from 0 to 180, but it cannot discriminate the angles in range from 0 to 360, e.g. arcsin(45º) = arcsin(135º). However, the sign of x and y can be used to determine which quadrant the angle is in. By this means, we can calculate the angle β in one quadrant (0-90º) using arcsin(y) and then determine θ in the determined quadrant. +90deg [1] where: V OUT = Output in Volts V OFF = 0g Offset V/ g = Sensitivity 1g = Earth s Gravity θ = Angle of Tilt Solving for the angle: [2] V V OUT = V + OFFSET g sinθ g θ V arc OUT V OFFSET = sin V g This equation can be used with the MMA6260Q as an example: V OUT = 1650mV + 800mV sinθ Where the angle can be solved by V OUT 1650mV θ = arc sin mV g From this equation, you can see that at 0 the accelerometer output voltage would be 1650mV and at 90 the accelerometer output would be 2450mV. INTERFACING TO ADC An 8-Bit ADC 180 deg 0-90 degree Quadrant 0 deg An 8-bit ADC cuts 3.3V supply into 255 steps of 12.9mV for each step. Therefore, by taking one ADC reading of the MMA6260Q at 0g (0 of tilt for an x-axis device) and 1g (90 of tilt for an x-axis device), would result in the following: 0 : 1650mV mV = mV, which is 0.92 resolution -90deg Figure 6. The Quadrants of a 360 Degree Rotation 90 : 2450mV+ 12.9mV = mV, which is 6.51 resolution Due to the nonlinearity discussed earlier, you will see that the accelerometer is most sensitive when the sensing axis is closer to 0, and less sensitive when closer to 90. Therefore, the system provides a 0.92 degree resolution at the highest sensitivity point (0 degrees), and a 6.51 degree resolution at the lowest sensitivity point (90 ). Θ 1g A 10-Bit ADC A 10-bit ADC cuts 3.3V supply into 1023 steps of 3.2mV for each step. Therefore, by taking one ADC reading of the MMA6260Q again at 0g (0 of tilt for an x-axis device), would now result in the following: 0 : 1650mV + 3.2mV = mV Figure 7. An Example of Tilt in the First Quadrant mV + 3.2mV = mV Freescale Semiconductor 3

4 This results in a degree resolution at the highest sensitivity point (0 ) and a 3.26 degree resolution at the lowest sensitivity point (90 ). A 12-Bit ADC A 12-bit ADC cuts 3.3V supply into 4095 steps of 0.8mV for each step. Therefore, by taking one ADC reading of the MMA6260Q again at 0g (0 of tilt for an x-axis device), would now result in the following: 0 : 1650mV + 0.8mV = mV 90 : 2450mV + 0.8mV = mV This results in a degree resolution at the highest sensitivity point (0 ) and 1.63 degree resolution at the lowest sensitivity point (90 ). However, for 0.8mV changes, the noise factor becomes the factor to consider during design. How much noise the system has will depend on how much resolution you can get with a higher bit count. TILT APPLICATIONS There are many applications where tilt measurements are required or will enhance its functionality. In the cell phone market and handheld electronics market, tilt applications can be used for controlling menu options, e-compass compensation, image rotation, or function selection in response to different tilt measurements. In the medical markets, tilt is used for making blood pressure monitors more accurate. They can also be used for feedback for tilting hospital beds or chairs. A tilt controller can also be used for an easier way to control this type of equipment. s for tilt measurements can also be designed into a multitude of products, such as game controllers, virtual reality input devices, HDD portable products, computer mouse, cameras, projectors, washing machines, and personal navigation systems. 4 Freescale Semiconductor

8 How to Reach Us: Home Page: USA/Europe or Locations Not Listed: Freescale Semiconductor Technical Information Center, CH N. Alma School Road Chandler, Arizona or Europe, Middle East, and Africa: Freescale Halbleiter Deutschland GmbH Technical Information Center Schatzbogen Muenchen, Germany (English) (English) (German) (French) Japan: Freescale Semiconductor Japan Ltd. Headquarters ARCO Tower 15F 1-8-1, Shimo-Meguro, Meguro-ku, Tokyo Japan or Asia/Pacific: Freescale Semiconductor Hong Kong Ltd. Technical Information Center 2 Dai King Street Tai Po Industrial Estate Tai Po, N.T., Hong Kong For Literature Requests Only: Freescale Semiconductor Literature Distribution Center P.O. Box 5405 Denver, Colorado or Fax: Information in this document is provided solely to enable system and software implementers to use Freescale Semiconductor products. There are no express or implied copyright licenses granted hereunder to design or fabricate any integrated circuits or integrated circuits based on the information in this document. Freescale Semiconductor reserves the right to make changes without further notice to any products herein. Freescale Semiconductor makes no warranty, representation or guarantee regarding the suitability of its products for any particular purpose, nor does Freescale Semiconductor 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 Semiconductor 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 Semiconductor does not convey any license under its patent rights nor the rights of others. Freescale Semiconductor products are not designed, intended, or authorized for use as components in systems intended for surgical implant into the body, or other applications intended to support or sustain life, or for any other application in which the failure of the Freescale Semiconductor product could create a situation where personal injury or death may occur. Should Buyer purchase or use Freescale Semiconductor products for any such unintended or unauthorized application, Buyer shall indemnify and hold Freescale Semiconductor and its officers, employees, subsidiaries, affiliates, and distributors harmless against all claims, costs, damages, and expenses, and reasonable attorney fees arising out of, directly or indirectly, any claim of personal injury or death associated with such unintended or unauthorized use, even if such claim alleges that Freescale Semiconductor was negligent regarding the design or manufacture of the part. Freescale and the Freescale logo are trademarks of Freescale Semiconductor, Inc. All other product or service names are the property of their respective owners. Freescale Semiconductor, Inc All rights reserved. Rev. 0 05/2005

Freescale Semiconductor How to install and run Classic CodeWarrior products on 64-bit Windows 7 PC Classic CodeWarrior products were built and delivered prior to the release of Windows 7 host OS, but it

Laboratory Short Course Exploring Embedded C Programming www.freescale.com/universityprograms Freescale and the Freescale logo are trademarks of Freescale Semiconductor, Inc. All other product or service

Techniques and Tools for Software Analysis Freescale Semiconductor Document Number: CODETESTTECHWP Rev. 0 11/2005 Understanding how software development can be optimized through the use of software analysis

SEMICONDUCTOR TECHNICAL DATA Order this document by MPX5050/D The MPX5050 series piezoresistive transducer is a state of the art monolithic silicon pressure sensor designed for a wide range of applications,

EVERSPIN s New 2mm Exposed Pad DFN Package Meets Both SOIC-8 and DFN8 PCB Layouts This Application Note is to inform Everspin customers that a new, DFN8 package with a 2mm bottom exposed pad has been added

Technical Data RF Power Field Effect Transistor N- Channel Enhancement- Mode Lateral MOSFET Designed for broadband commercial and industrial applications with frequencies up to 00 MHz. The high gain and

nc. Order this document by MC295/D The MC295 is a single modulus prescaler for low power frequency division of a 2.5 GHz high frequency input signal. Motorola s advanced MOSAIC V technology is utilized

Order this document by /D Communications and Advanced Consumer Technologies Group Product Brief Microprocessor INTRODUCTION The is a cost-effective static embedded processor engineered for low-power applications.

QorIQ Advanced Multiprocessing (AMP) Series Delivers More than Moore Freescale s new QorIQ AMP series pushes the compute and energy performance envelope beyond the P4080 processor such that its performance

Introduction to Analog Video Prepared by: Paul Lee ON Semiconductor APPLICATION NOTE Introduction Eventually all video signals being broadcasted or transmitted will be digital, but until then analog video

SEMICONDUCTOR TECHNICAL DATA Order this document by MPX2100/D The MPX2100 series device is a silicon piezoresistive pressure sensor providing a highly accurate and linear voltage output directly proportional

CodeWarrior Development Studio for Microcontrollers V10.x Profiling and Analysis Quick Start This Quick Start explains how to collect trace data after creating, building, and running a project on a target