Attitude Measurement System Based on Multiple MEMS Sensors

Publisher:SparklingMelodyLatest update time:2013-09-09 Source: 21icKeywords:MEMS Reading articles on mobile phones Scan QR code
Read articles on your mobile phone anytime, anywhere

introduction

Traditional attitude measurement uses high-precision attitude sensors such as gyroscopes and accelerometers, which are bulky and expensive. The current MEMS products are known as a major reform of the traditional inertial measurement combination due to their small size, low price and low power consumption, and are increasingly used in attitude measurement applications. In addition, with the rapid development of MEMS technology and its penetration into various disciplines, its performance in various aspects such as accuracy, robustness, dynamic response, etc. has been greatly improved.

With the continuous development of embedded technology, application-centric embedded systems have penetrated into all aspects of our daily lives and have been applied in all walks of life due to their small size, low power consumption, high reliability, good scalability, and high software and hardware integration. The combination of embedded and MEMS enables the attitude measurement system to meet the application requirements of low cost, low power consumption, and miniaturization, bringing great progress to the field of consumer electronics, such as gravity sensors and compasses in smart phones, and also bringing very broad application prospects to the fields of aviation, industry, automobiles, medical care, environmental monitoring, communications, etc.

This paper uses a three-axis MEMS gyroscope, a three-axis MEMS accelerometer, a three-axis MEMS electronic compass, and a Freescale microcontroller MC9S08QE8 to form an embedded attitude measurement system. The gyroscope is used to obtain real-time attitude information due to its good dynamic performance. However, the gyroscope will produce an offset, while the accelerometer and the electronic compass have superior static performance, so they are used to correct the error in the gyroscope attitude calculation process.

1 System composition and structure

This system is mainly composed of a single-axis gyroscope LY530AL, a dual-axis gyroscope LPR530AL, a three-axis MEMS accelerometer ADXL345, a three-axis MEMS electronic compass HMC5843 and a single-chip microcomputer MC9S08QE8. The dual-axis gyroscopes in the X and Y directions and the single-axis gyroscope in the Z-axis direction are combined into a three-axis gyroscope. Their signals are collected by the ADC module of the single-chip microcomputer MC9S08QE8, while the acceleration signal and the electronic compass signal are transmitted to the single-chip microcomputer through the I2C bus. These 9 signals are first processed in the single-chip microcomputer, and then the attitude calculation algorithm program in the single-chip microcomputer obtains 3 attitude angle information. These 3 information are transmitted to the host computer through the serial port module of the single-chip microcomputer MC9S08QE8 for demonstration. The structural block diagram of the embedded attitude measurement system is shown in Figure 1.

Attitude Measurement System Based on Multiple MEMS Sensors

1.1 Three-axis MEMS gyroscope

The three-axis MEMS gyroscope in the system is composed of ST's single-axis Z-direction gyroscope LY530AL and dual-axis X and Y-direction gyroscope LPR530AL. They use the principle of capacitive micromechanical gyroscopes. Since ST uses the tuning fork method and the vibration drive circuit adopts a double closed-loop control structure, the stability and resolution of the gyroscope are significantly improved. The measurement range is ±300°/s, it has a self-test function, and the output end integrates a low-pass filter circuit. The operating voltage is 1.8~3.6 V, and the current in standby mode is less than 1μA.

1.2 Three-axis MEMS accelerometer

The three-axis MEMS accelerometer in the system uses the ADXL345 from ADI. The ADXL345 is a three-axis, digital output accelerometer based on iMEMS technology with a variable measurement range of ±2g, ±4g, ±8g, and ±16g. The 32-level FIFO storage on the chip can cache data, thereby reducing the burden on the processor and reducing system power consumption. The ADXL345 has high resolution and sensitivity, a 3 mm×5 mm×1 mm ultra-small package, 40~145μA ultra-low power consumption, and a standard I2C or SPI digital interface, making it very suitable for mobile device applications.

1.3 Three-axis MEMS electronic compass

The three-axis MEMS electronic compass in the system uses Honeywell's HMC5843, which uses Honeywell's anisotropic magnetoresistive (AMR) technology and consists of Honeywell's high-precision HMC11 8X series magnetoresistive sensors. It has high sensitivity and reliability in low-intensity magnetic field sensors. The low voltage power supply of 2.16 to 3.3 V, the current consumption of 0.66 mA, and the small size of 3mm×3 mm×0.9 mm have obvious advantages in consumer electronic devices and navigation systems.

1.4 MCU MC9S08QE8

The single-chip microcomputer in the system adopts Freescale's MC9S08QE8. MC9S08QE8 adopts many new technologies, such as battery life extension technology, enhanced low-power performance and advanced operation capability under ultra-low voltage. At the same time, it has a very high degree of integration and integrates many system-level functions, such as 12-bit high-precision A/D converter, timer, SPI, I2C, SCI and other common modules, which is very suitable for low-power and low-cost applications.

2 Application Circuit Design

2.1 Power Module

The power supply voltage regulator circuit of this system supplies power to all devices in the entire system. Considering that the system involves digital and analog sensors, a low-noise, low-drift, 3.3 V linear voltage regulator chip MIC5205 is used. The schematic diagram of the power supply voltage regulator circuit is shown in Figure 2. Among them, C1 is a capacitor connecting the internal voltage reference source of the chip and GND to reduce the noise of the output voltage, and C2 is a capacitor between the output and GND to prevent the circuit from oscillating. The capacitance of C2 is related to C1, but when C1 is 470 nF, C2 is generally 2.2μF. D1 is the indicator light of the power supply.

Attitude Measurement System Based on Multiple MEMS Sensors

2.2 Gyroscope and ADC module

The ADC module in the MC9S08QE8 microcontroller is based on a successive approximation 12-bit analog-to-digital converter. It provides 10 input channels, can be configured to use time conversion speed and power consumption, and can set preset comparisons to ensure that some data that does not meet the requirements does not need to be saved. The most high-performance feature is the ability to set the continuous sequence conversion mode. In this mode, the ADC hardware can automatically realize the continuous conversion of several set channels and store the conversion results in the corresponding data register without program loops. This simplifies program design, reduces conversion power consumption, and reduces the burden on MC9S08QE8.

Attitude Measurement System Based on Multiple MEMS Sensors

The interface between the gyroscope and the ADC module of the microcontroller is shown in Figure 3. In the figure, ST, HP, and PD are used as three pins for self-test, energy control, and high-pass filtering. They are connected to the general I/O interface of MC9S08 QE8 respectively. Generally, they are connected to pull-down resistors and are in normal working mode by default. If the corresponding working mode needs to be changed, the level of the corresponding MC9S08QE8 I/O port must be changed to a high level. The output signals (4xOTUX, 4xOTUY, and 4xOTUZ pins) and the output reference voltage (Vref pin) of LY530AL and LPR530AL are connected to the corresponding channels of the ADC module of MC9S08QE8 respectively. It is particularly important to note that LPR530AL has two output modes: one is the output after internal amplification by 4 times, and the other is the normal output. When the nonlinear amplification output mode is used, the 5th and 9th pins of LPR530AL should be connected to GND; if the amplification output mode is used and there is no external extended bypass filter, the 4th and 5th pins, and the 9th and 10th pins should be short-circuited respectively. In Figure 3, the working principle of LY530AL is similar to that of LPR530AL. [page]

2.3 Accelerometer, electronic compass and I2C interface

The high-speed I2C module in MC9S08QE8 has the characteristics of multi-master operation, programmable slave address, interrupt-driven byte-by-byte data transmission, support for broadcast mode and 10-bit addressing, etc. The bus can reach a speed of 100kbps under maximum load. In the system, the interface between the accelerometer, electronic compass chip and MC9S08QE8 I2C module is shown in Figure 4. In the figure, the CS pin of ADXL345 is used to control the selection of I2C or SPI communication protocol. The high level indicates the use of I2C protocol, and the SDA and SCL pins are connected to the I2C bus pins of MC9S08QE8 respectively. The electronic compass HMC5843 supports dual voltage operation, where the pin VDD represents the core voltage and the pin VDDIO represents the external I/O voltage. The single voltage mode is adopted in this system, that is, the core voltage is the same as the external I/O voltage.

3 Software Design and Testing
The software design of the system is an important part of the whole system. According to the design principle and functional requirements of the above hardware circuit, the software must first complete the initialization of MC9S08QE8 and set the working mode of various MEMS sensors; then obtain the real-time signals of the three-axis gyroscope, accelerometer, and electronic compass, and calculate the attitude angle according to the attitude calculation algorithm, and finally transmit the attitude angle information to the host computer through the serial port for testing and demonstration. The software flow of the embedded attitude measurement system is shown in Figure 5.
3.1 MC9S08QE8 initialization
The initialization function of MC9S08QE8 mainly implements the initialization of the system clock, ports and various functional modules used, such as ADC module, SCI module, and I2C module. The initialization function Sys_init_fun(void) is as follows:
3.2 Setting the sensor working mode
In the setting of various MEMS sensor working modes, the gyroscope involves analog signals, and there is no need to set its specific working mode. The rich functions of the accelerometer ADXL345 are realized by configuring the corresponding registers. Through the corresponding registers, you can select the data format, FIFO working mode, digital communication mode, power saving mode, interrupt enable, and correction of axis deviations. The POWER_CTL register is used to set the power supply mode. In conjunction with the BW_RATE register, the data transmission rate can be set. If you want to further reduce power consumption, you can set the LOW_POWER bit in the BW_RATE register to enter low power mode. The DATA_FORMAT register is used to set the data format and the range of the accelerometer, and the FIFO_CTL register is used to set the specific working mode of the buffer, such as Bypass, FIFO, Stream, and Trigger. Finally, OFSX, OFSY, and OFSZ are used to store the offsets of the X, Y, and Z axes calibrated during initialization in order to correct the data.
The configuration of the electronic compass HMC5843 is relatively simple. It mainly has three registers. The data transmission rate and measurement mode can be set by configuring register A. Register B is used to set the gain of the device, and the mode register is used to set the working mode of the device.
3.3 Posture Calculation
Typical attitude solution methods include direction cosine matrix solution method, quaternion method, rotation vector method, etc. This system adopts the DCM algorithm of William Premerlani and Paul Bizard, and the DCM algorithm block diagram is shown in Figure 6. The input signal of the three-axis gyroscope is used to calculate the direction cosine matrix through the kinematic equation, and the three-axis accelerometer signal and the three-axis electronic compass signal are combined with PI feedback control to correct the gyroscope signal.
The algorithm is implemented by the kinematics_and_normalization(t_vector*gyro, t_matrix*dcm) function:
The real-time attitude angle data calculated above is transmitted to the host computer through the serial port. The host computer tracks and displays the motion attitude of the attitude measurement module of the lower computer through the python demonstration program written in the host computer. The demonstration effect is shown in Figure 7. Each picture contains 3 parts: the red, green and blue pointers in the first part (upper left corner) represent the size of the roll angle (roll), pitch angle (pitch) and heading angle (yaw), the second part (lower left corner) displays the real-time motion attitude of the module, and the third part (right) is used to display the attitude angle information. The left picture shows the demonstration effect when the object is stationary, and the right picture shows the attitude motion effect of the object during the motion process. By comparing and analyzing the two pictures and the effects of the three parts corresponding to each picture, it can be shown that this design has achieved good results and can measure the attitude information of the object more accurately.
Conclusion
At present, various consumer electronic devices generally contain triaxial accelerometers and electronic compasses, such as smartphones and tablets. However, the dynamic performance of accelerometers is much inferior to that of gyroscopes. The addition of gyroscopes can improve the overall dynamic and static performance of the system. The embedded attitude measurement system designed in this paper adopts a combination of multiple MEMS sensors, which expands the application range of MEMS sensors and also extends the application field of attitude measurement systems. The experimental demonstration shows that the system performance and usability are relatively good, and it can be applied to attitude measurement and object stability control applications in consumer electronics and general industry.
Keywords:MEMS Reference address:Attitude Measurement System Based on Multiple MEMS Sensors

Previous article:A few simple comparisons between ARM and x86
Next article:Minimum technical requirements for an electronic engineer

Latest Microcontroller Articles
Change More Related Popular Components

EEWorld
subscription
account

EEWorld
service
account

Automotive
development
circle

About Us Customer Service Contact Information Datasheet Sitemap LatestNews


Room 1530, 15th Floor, Building B, No.18 Zhongguancun Street, Haidian District, Beijing, Postal Code: 100190 China Telephone: 008610 8235 0740

Copyright © 2005-2024 EEWORLD.com.cn, Inc. All rights reserved 京ICP证060456号 京ICP备10001474号-1 电信业务审批[2006]字第258号函 京公网安备 11010802033920号