Design of analog electronic compass function based on integrated sensor

Publisher:火箭飞人Latest update time:2011-12-16 Source: 互联网 Reading articles on mobile phones Scan QR code
Read articles on your mobile phone anytime, anywhere

The electronic compass is an important navigation tool that can provide the heading and attitude of moving objects in real time. With the advancement of semiconductor technology and the development of mobile phone operating systems, smartphones that integrate more and more sensors have become more powerful, and many mobile phones have implemented the function of electronic compasses. Applications based on electronic compasses (such as Skymap for Android) have also become popular on various software platforms.

To realize the electronic compass function, a three-axis magnetic sensor for detecting magnetic fields and a three-axis acceleration sensor are required. With the maturity of micro-mechanical technology, STMicroelectronics has launched the LSM303DLH, a two-in-one sensor module that integrates a three-axis magnetometer and a three-axis accelerometer in one package, making it easy for users to design a low-cost, high-performance electronic compass in a short time. This article takes LSM303DLH as an example to discuss the working principle, technical parameters and implementation method of the electronic compass.

1. Background knowledge of the geomagnetic field and heading angle

As shown in Figure 1, the Earth's magnetic field points from the magnetic south pole to the magnetic north pole like a bar magnet. At the magnetic pole, the magnetic field is perpendicular to the local horizontal plane, and at the equator, the magnetic field is parallel to the local horizontal plane, so the magnetic field in the northern hemisphere is tilted toward the ground. The unit used to measure the intensity of magnetic induction is Tesla or Gauss (1 Tesla = 10000 Gauss). Depending on the geographical location, the strength of the geomagnetic field is usually 0.4-0.6 Gauss. It should be noted that the magnetic north pole and the geographical north pole do not coincide, and there is usually an angle of about 11 degrees between them.

Figure 1. Distribution of the Earth's magnetic field

The geomagnetic field is a vector. For a fixed location, this vector can be decomposed into two components parallel to the local horizontal plane and one component perpendicular to the local horizontal plane. If the electronic compass is kept parallel to the local horizontal plane, the three axes of the magnetometer in the compass correspond to these three components, as shown in Figure 2.

Figure 2 Schematic diagram of geomagnetic field vector decomposition

In fact, for the two components in the horizontal direction, their vector sum always points to the magnetic north. The heading angle (Azimuth) in the compass is the angle between the current direction and the magnetic north. Since the compass remains horizontal, only the detection data of the two horizontal axes (usually the X-axis and the Y-axis) of the magnetometer can be used to calculate the heading angle using Formula 1. When the compass rotates horizontally, the heading angle changes between 0º-360º.

2. ST integrated magnetometer and accelerometer sensor module LSM303DLH

2.1 Working Principle of Magnetometer

In the LSM303DLH, the magnetometer uses anisotropic magnetoresistance (Anisotropic Magneto-Resistance) material to detect the magnitude of magnetic induction intensity in space. This alloy material with a crystal structure is very sensitive to the external magnetic field, and changes in the strength of the magnetic field will cause changes in the resistance value of the AMR itself.

During the manufacturing process, a strong magnetic field is applied to the AMR to magnetize it in a certain direction, establishing a main magnetic domain. The axis perpendicular to the main magnetic domain is called the sensitive axis of the AMR, as shown in Figure 3. In order to make the measurement result change in a linear manner, the metal wires on the AMR material are arranged at a 45° angle, and the current flows through these wires, as shown in Figure 4. The main magnetic domain established on the AMR material by the initial strong magnetic field has a 45° angle with the direction of the current.

When there is an external magnetic field Ha, the direction of the main magnetic domain on the AMR will change and will no longer be the initial direction, so the angle θ between the magnetic field direction and the current will also change, as shown in Figure 5. For AMR materials, the change in angle θ will cause the change in the resistance of the AMR itself, and the relationship is linear, as shown in Figure 6.

ST uses a Wheatstone bridge to detect the change in AMR resistance, as shown in Figure 7. R1/R2/R3/R4 are AMR resistors with the same initial state, but R1/R2 and R3/R4 have opposite magnetization characteristics. When an external magnetic field is detected, the resistance of R1/R2 increases by ?R and that of R3/R4 decreases by ?R. In this way, when there is no external magnetic field, the output of the bridge is zero; when there is an external magnetic field, the output of the bridge is a small voltage of ?V.

Figure 7 Wheatstone bridge

When R1=R2=R3=R4=R, when the resistance changes to ?R under the action of the external magnetic field, the bridge output ?V is proportional to ?R. This is the working principle of the magnetometer.

2.2 Set/Reset Circuit

Due to the influence of the external environment, the direction of the main magnetic domain on the AMR in the LSM303DLH will not remain unchanged permanently. The LSM303DLH has a built-in set/reset circuit that periodically generates current pulses through the internal metal coil to restore the initial main magnetic domain, as shown in Figure 8. It should be noted that the effect of the set pulse and the reset pulse is the same, but the direction is different.

Figure 8 LSM303DLH set/reset circuit

The set/reset circuit brings many advantages to the LSM303DLH:

1) Even if there is interference from a strong external magnetic field, the LSM303DLH can resume normal operation after the interference disappears without the need for the user to calibrate again.

2) Even when working for a long time, the initial magnetization direction can be maintained to achieve accurate measurement, and the measurement accuracy will not be affected by changes in chip temperature or increased internal noise.

3) Eliminate bridge deviation caused by temperature drift.

2.3 Performance parameters of LSM303DLH

LSM303DLH integrates a three-axis magnetometer and a three-axis accelerometer with a digital interface. The measurement range of the magnetometer is from 1.3 Gauss to 8.1 Gauss, divided into 7 levels, and users can choose freely. And it can maintain consistent measurement results and the same sensitivity in a magnetic field environment within 20 Gauss. Its resolution can reach 8 mGauss and a 12-bit ADC is used internally to ensure accurate measurement of magnetic field strength. Compared with magnetometers using the Hall effect principle, LSM303DLH has low power consumption, high accuracy, good linearity, and does not require temperature compensation.


LSM303DLH has an automatic detection function. When the control register A is set, the self-test circuit inside the chip will generate an excitation signal of approximately the magnitude of the geomagnetic field and output it. Users can use the output data to determine whether the chip is working properly.

As a highly integrated sensor module, LSM303DLH integrates a high-performance accelerometer in addition to the magnetometer. The accelerometer also uses a 12-bit ADC, which can achieve a measurement accuracy of 1mg. The accelerometer can run in low-power mode and has a sleep/wake-up function, which can greatly reduce power consumption. At the same time, the accelerometer also integrates 6-axis direction detection and two programmable interrupt interfaces.

Reference address:Design of analog electronic compass function based on integrated sensor

Previous article:In-depth use of resistors
Next article:Typical application circuit design of IDT70V9289

Latest Power Management 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号