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.
Previous article:In-depth use of resistors
Next article:Typical application circuit design of IDT70V9289
- Popular Resources
- Popular amplifiers
- MathWorks and NXP Collaborate to Launch Model-Based Design Toolbox for Battery Management Systems
- STMicroelectronics' advanced galvanically isolated gate driver STGAP3S provides flexible protection for IGBTs and SiC MOSFETs
- New diaphragm-free solid-state lithium battery technology is launched: the distance between the positive and negative electrodes is less than 0.000001 meters
- [“Source” Observe the Autumn Series] Application and testing of the next generation of semiconductor gallium oxide device photodetectors
- 采用自主设计封装,绝缘电阻显著提高!ROHM开发出更高电压xEV系统的SiC肖特基势垒二极管
- Will GaN replace SiC? PI's disruptive 1700V InnoMux2 is here to demonstrate
- From Isolation to the Third and a Half Generation: Understanding Naxinwei's Gate Driver IC in One Article
- The appeal of 48 V technology: importance, benefits and key factors in system-level applications
- Important breakthrough in recycling of used lithium-ion batteries
- Innolux's intelligent steer-by-wire solution makes cars smarter and safer
- 8051 MCU - Parity Check
- How to efficiently balance the sensitivity of tactile sensing interfaces
- What should I do if the servo motor shakes? What causes the servo motor to shake quickly?
- 【Brushless Motor】Analysis of three-phase BLDC motor and sharing of two popular development boards
- Midea Industrial Technology's subsidiaries Clou Electronics and Hekang New Energy jointly appeared at the Munich Battery Energy Storage Exhibition and Solar Energy Exhibition
- Guoxin Sichen | Application of ferroelectric memory PB85RS2MC in power battery management, with a capacity of 2M
- Analysis of common faults of frequency converter
- In a head-on competition with Qualcomm, what kind of cockpit products has Intel come up with?
- Dalian Rongke's all-vanadium liquid flow battery energy storage equipment industrialization project has entered the sprint stage before production
- Allegro MicroSystems Introduces Advanced Magnetic and Inductive Position Sensing Solutions at Electronica 2024
- Car key in the left hand, liveness detection radar in the right hand, UWB is imperative for cars!
- After a decade of rapid development, domestic CIS has entered the market
- Aegis Dagger Battery + Thor EM-i Super Hybrid, Geely New Energy has thrown out two "king bombs"
- A brief discussion on functional safety - fault, error, and failure
- In the smart car 2.0 cycle, these core industry chains are facing major opportunities!
- The United States and Japan are developing new batteries. CATL faces challenges? How should China's new energy battery industry respond?
- Murata launches high-precision 6-axis inertial sensor for automobiles
- Ford patents pre-charge alarm to help save costs and respond to emergencies
- New real-time microcontroller system from Texas Instruments enables smarter processing in automotive and industrial applications
- Someone's Volkswagen chip burned out, come and help him
- Matlab Machine Learning (English and Chinese subtitles)
- 【NXP Rapid IoT Review】+Preparation for Data Download
- 10 common basic knowledge of MCU
- [RT-Thread reading notes] The simplest port to STM32F103CBT6
- I am 31 years old, I have been coding for 10 years, and I will retire tomorrow!
- Evaluation of domestic single-chip networking chips
- [Jihai APM32E103VET6S MINI Development Board Review] Second post PLL and system clock questions
- Ink screen calendar based on AB32 and RT-Thread, open source
- Transistor common emitter amplifier circuit