Design of posture detection system based on MEMS combined module

Publisher:gamma14Latest update time:2011-06-05 Reading articles on mobile phones Scan QR code
Read articles on your mobile phone anytime, anywhere
Introduction
In the balance control of two-wheeled self-balancing electric vehicles, real-time and accurate measurement of the pitch angle of the vehicle body is the premise of the entire balance control. The traditional mechanical attitude measuring instrument is large in size, slow in response speed, and low in measurement accuracy, which is far from meeting the real-time and accuracy requirements of the balance control of two-wheeled self-balancing electric vehicles. The attitude measuring instrument based on optical principles and image processing technology has high accuracy, but is expensive and requires a large number of complex calculations, which generally require computer assistance to complete, and does not meet the cost and vehicle-mounted requirements of two-wheeled self-balancing electric vehicles. This paper adopts the design scheme of ME-MS combined module to realize the measurement of the pitch angle of the vehicle body. This measurement system not only has the characteristics of small size, fast response and low cost, but also effectively reduces the influence of vibration interference in the environment after data fusion processing, and can meet the accuracy requirements of the system in a vehicle body environment with strong vibration.

1 System composition and working principle
1.1 System composition
This attitude measurement system is mainly composed of a single-chip microcomputer PIC16F877, an accelerometer MMA7260 and a gyroscope ADXRS610. The system structure block diagram is shown in Figure 1. The PIC16F877 chip provided by Microchip is used as the control chip, which is responsible for A/D sampling and subsequent data processing of the accelerometer and gyroscope.

a.JPG


ADXRS610 is a cost-effective single-axis gyroscope launched by ADI. ADXRS610 is an analog output device, whose output is linearly proportional to the angular velocity of rotation around the rotation axis. The angle of rotation can be obtained by integrating the angular velocity. The measurement range of ADXRS610 angular velocity is ±300 rad/s, the sensitivity is 6 mV/(rad·s-1), the zero output voltage is 2.50 V, the nonlinear error is ±0.1% F. S., the -3 dB bandwidth is 40 Hz, and the natural frequency is 14 kHz.
1.2 Mathematical application principle of accelerometer
MMA7260 is a cost-effective three-axis analog output accelerometer. The analog output is linearly related to the acceleration in the direction of its sensitive axis. In this paper, MMA7260 is used to measure the static acceleration value, and then the angle between the measured platform and the horizontal plane is calculated. The so-called measurement of static acceleration refers to measuring the magnitude of the component of gravity acceleration on a certain sensitive axis when the platform is stationary. Since the direction of gravity acceleration is always vertically downward, this provides a natural reference coordinate system for the measurement system. There are two ways to indirectly measure the angle through the mathematical principle of accelerometer.
Method 1 is shown in Figure 2. The gravity acceleration component is measured using a single sensitive axis, where the angle θ, gravity acceleration g and sensitive axis component gx form an inverse cosine relationship:
b.JPG
Method 2 is shown in Figure 3.

c.JPG


The gravity acceleration component is measured using dual sensitive axes, where the angle θ, the Y-sensitive axis component gy, and the X-sensitive axis component gx form an inverse tangent relationship:
d.JPG
Method 1 only requires a single-axis accelerometer to achieve angle measurement, and only a single-channel ADC module is required for data acquisition, which has advantages in hardware cost and software programming difficulty. Method 2 uses two sensitive axes to simultaneously collect gravity acceleration components in two directions, and obtains the angle value through the ratio of the components of the two axes. Since the two sensitive axes are in the same environmental factors, they have a certain inhibitory effect on interference from factors such as vibration and temperature changes. In addition, for changes in the value of the gravity acceleration constant in different geographical locations, method 1 will produce corresponding errors, while method 2 can eliminate such errors in principle. After comparison, the second method is selected. [page]

1.3 Data fusion model
The basic principle of complementary filtering is shown in Figure 4. The idea of ​​complementary filtering is to combine the signals obtained by using different filtering methods for sensors with different output characteristics, thereby overcoming the disadvantage of severe distortion of a single sensor and obtaining more accurate information. The accelerometer signal containing high-frequency noise components is filtered through a low-pass filter, and the gyroscope signal with integral drift effect is filtered through a high-pass filter.

e.JPG


Since the high-pass and low-pass filtering processes of this system are processed by software using PIC16F877 to simulate the functions of electronic circuits, it is necessary to discretize the continuous filtering model formula. The model formula of the continuous low-pass filter is as follows:
f.JPG
Wherein, uin(t) and uout(t) are the input and output voltages respectively, and RC is the time constant. The discretized digital low-pass filter model is as follows:
g.JPG
Wherein, yi represents the output at time i; xi represents the input at time i; yi-1 represents the output at time (i-1); △T is the sampling period. Based on the idea of ​​complementary filtering and combined with the discrete digital low-pass filter model, the following model is constructed:
i.JPG
Wherein, angle is the final output angle value of the system; gyr is the angular velocity value calculated from the gyroscope data, gyrdt is the angle increment within a sampling period; acc is the angle value calculated from the accelerometer data. When the appropriate time constant RC and sampling period △T are selected, this model can simulate the
complementary combination function of high-pass filtering of the gyroscope and low-pass filtering of the accelerometer. At the same time, the time constant and sampling period also determine the system's confidence in the output signals of the gyroscope and accelerometer. When the system selects a time constant of 0.1 ms and a sampling period of 5 ms, the above model is substituted:
j.JPG

Assume that in the initial state, the system angle estimation value angle, the gyroscope output angular velocity value gyr and the accelerometer output angle value acc are all zero. Table 1 shows the change process of the estimated value angle in 10 consecutive sampling cycles when the accelerometer receives a sudden change signal of 10° value.

k.JPG


It can be seen from the table that when the system sampling period is set to 5 ms, if the frequency of this mutation signal is higher than 200 Hz, that is, the duration of the signal does not exceed one sampling period, then the maximum deviation brought by this signal to the system will not exceed 0.9°. At this time, it can be considered that the system does not trust the high-frequency signal of the accelerometer, but trusts the signal of the gyroscope. If the frequency of this mutation signal is lower than 20 Hz, the duration of the signal will reach more than 10 sampling periods. At the 10th sampling period, the estimated value angle of the system is 9.0°. At this time, it can be considered that the system trusts the low-frequency signal of the accelerometer. It can be seen that this model has the low-pass filtering function for the accelerometer and the high-pass filtering function for the gyroscope. [page]

2 Simulation Verification
The data fusion model constructed in this paper is used to simulate the measured raw data through Matlab tools to verify the effectiveness of this model. The original signal of the accelerometer is shown in Figure 5.

l.JPG


This is a comparison of the original signal output of the accelerometer in dynamic and static conditions. It can be seen that the dynamic output of the accelerometer cannot accurately reflect the true attitude value due to the presence of high-frequency interference. The original signal values ​​of the accelerometer and gyroscope collected when the measured platform tilts are shown in Figure 6. It can be seen that before 1.6 s, the measured platform was not disturbed by vibration, and the output signal amplitude of the accelerometer was small at this time. After 1.6 s, the measured platform was disturbed by vibration, the output signal of the accelerometer was seriously disturbed, and the output signal of the gyroscope was almost not disturbed by vibration.

m.JPG


The data fusion result is shown in Figure 7. The accelerometer curve is the angle value calculated by the original accelerometer signal, which still fluctuates greatly. The gyroscope curve is the angle value obtained by integrating the output angular velocity value of the gyroscope. The data fusion curve is the angle value obtained by solving the data fusion model constructed in this paper.

n.JPG


As can be seen from Figure 7, the angle value obtained by a single accelerometer fluctuates greatly and cannot accurately reflect the true value. Although the angle value obtained by a single gyroscope through integration operation does not fluctuate, the integral cumulative effect will be very serious as time increases. From 0 s to 10 s, the integral cumulative deviation generated by the gyroscope is close to 50°, and it accelerates and expands at an average rate of 5°/s. This is also the reason why the gyroscope cannot be used alone for platform attitude detection. The angle value obtained after data fusion processing not only overcomes the shortcomings of the poor dynamic performance of the accelerometer, but also compensates for the integral drift of the gyroscope.

3 System Implementation
3.1 Hardware Design
At the beginning of the circuit board design, it is necessary to determine the installation position and angle of the sensor according to the sensitive axis direction of the accelerometer and gyroscope. The gyroscope and accelerometer should be installed in a close position to minimize the external environment difference between the two sensors, which is conducive to reducing the error of later data processing. Whether the rigid contact surface of the platform is treated with anti-vibration, such as adding anti-vibration gaskets, has a great impact on the output of the sensor, especially the accelerometer. [page]

In order to facilitate the adjustment of the sensor installation position and angle, the modular concept is adopted in the hardware design. The accelerometer and gyroscope are designed on a separate small circuit board, and the positive direction of the X-sensitive axis of the accelerometer points to the horizontal forward direction of the measured platform, while the rotation sensitive axis of the gyroscope needs to be installed perpendicular to the X-axis of the accelerometer and parallel to the Y-axis of the accelerometer. The system is connected to an LCD display screen through a reserved data port, and the attitude data can be directly displayed through simple programming. The power supply of the system is provided by a 7.5 V rechargeable battery, and the voltage regulator circuit composed of L7805 converts it into a stable 5 V power supply to power the entire system. A 4 MHz crystal oscillator is used to provide the system clock. The simplified schematic diagram of the system is shown in Figure 8.

o.JPG


3.2 Software Design
The PIC16F877 has a 10-bit precision analog/digital conversion (ADC) module that supports 8 analog conversion channels. For the accelerometer and gyroscope in this system, the resolution of its 10-bit analog/digital conversion module can fully meet the accuracy requirements of the system. According to the system clock frequency and the conversion time of the analog/digital conversion (ADC) module, 1/8 clock frequency is selected as the analog/digital conversion clock, and the analog signals of the accelerometer and gyroscope are collected by channels AN0, AN1, and AN2 respectively. Since the sampling results of the gyroscope need to be integrated in the subsequent signal processing, the sampling interval of each analog/digital conversion module is required to be as equal as possible to ensure the accuracy of subsequent operations. When the CCP2 module in the PIC16F877 is set to the special event trigger mode, in conjunction with timer 1, the timing interrupt enable function of the analog/digital conversion module can be realized. When using special event trigger to start analog/digital conversion, you need to pay attention to several details to get accurate analog/digital conversion results: First, when the analog/digital conversion module is initialized, the ADON position in the ADCONO register needs to be set to 1, otherwise the analog/digital conversion cannot be started even after the special event is triggered; secondly, in the process of sampling the accelerometer and gyroscope by switching between the three analog channels AN0, AN1, and AN2, the ADIF interrupt response is needed to obtain the analog/digital conversion results and switch channels. After the channel is switched, it must be ensured that there is enough sampling time before the next analog/digital conversion module is triggered. Based on the comprehensive analysis of the entire system requirements, the trigger sampling period of CCP2 is set to 5 ms. The interrupt program flow is shown in Figure 9.

p.JPG



4 System Test
The experiment was conducted in an indoor environment at 25°C. First, the attitude measurement system was fixedly installed on the body of the two-wheeled self-balancing electric vehicle, and then the motor of the two-wheeled self-balancing vehicle was powered on to provide a strong vibration interference environment. Table 2 shows the data of the two-wheeled self-balancing vehicle body being fixed at three positions of 0°, 30°, and 45°.

q.JPG


From the measurement results, it can be seen that as the angle increases, the error increases due to the nonlinear factors of the MEMS device, but the error is kept within 50' between 0° and 30°, and the error accuracy can fully meet the control requirements of the two-wheeled self-balancing electric vehicle. The data shows that the values ​​of the measured data are generally larger than the true value. This is because the initial angle of the tested platform is larger than the true zero initial angle. The error will be further reduced after the initial installation position is corrected. In order to achieve higher accuracy, in addition to correcting the initial position during initial installation, more accurate calibration and appropriate temperature compensation of the MEMS device are required.

5 Conclusions
This paper constructs a data fusion model that meets the requirements of this system, verifies the rationality and effectiveness of the model using Matlab tools, and designs the hardware circuit of this attitude measurement system. Experimental tests show that the error accuracy can fully meet the balance control requirements of the two-wheeled self-balancing electric vehicle. In addition to excellent anti-interference performance, this attitude measurement system also has good portability. It can be connected to an LCD display to form an independent attitude measurement system, and can also provide real-time and accurate attitude data for other platforms. Through simple software expansion, it can also provide measurement of attitude parameters such as angular velocity and angular acceleration.

Reference address:Design of posture detection system based on MEMS combined module

Previous article:Design of high-speed data acquisition system for weather radar based on Linux platform
Next article:Design and implementation of phase-mode optical fiber measurement circuit system

Latest Test Measurement 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号