Date of Award


Degree Name

MS in Mechanical Engineering


Mechanical Engineering


Charles Birdsong


The goal of this work was to compensate for the effects of the Earth’s magnetic field in a vector field magnetic sensor. The magnetic sensor is a part of a low-cost crash avoidance system by Stephane Roussel where the magnetic sensor was used to detect cars passing when it was mounted to a test vehicle. However, the magnetic sensor’s output voltage varied when it changed orientation with respect to the Earth’s magnetic field. This limited the previous work to only analyze detection rates when the test vehicle travelled a single heading. Since one of the goals of this system is to be low-cost, the proposed solution for geomagnetic compensation will only use a single magnetic sensor and a consumer-grade GPS. Other solutions exist for geomagnetic compensation but use extra sensors and can become costly.

In order to progress the development of this project into a commercial project, three separate geomagnetic compensation algorithms and a calibration procedure were developed. The calibration procedure compensated for the local magnetic field when the magnetic sensor was mounted to the test vehicle and allowed for consistent magnetic sensor voltage output regardless of the type of test vehicle.

The first algorithm, Compensation Scheme 1 (CS1), characterized the local geomagnetic field with a mathematical function from field calibration data. The GPS heading was used as the input and the output is the voltage level of the Earth’s magnetic field. The second algorithm, Compensation Scheme 1.5, used a mathematical model of the Earth’s magnetic field using the International Geomagnetic Reference Field. An algorithm was developed to take GPS coordinates as an input and output the voltage contributed by the mathematical representation of the Earth’s magnetic field. The output voltages from CS1 and CS1.5 were subtracted from the calibrated magnetic sensor data. The third algorithm, Compensation Scheme 2 (CS2), used a high pass filter to compensate for changes of orientation of the magnetic sensor. All three algorithms were successful in compensating for the geomagnetic field and vehicle detection in multiple car headings was possible.

Since the goal of the magnetic sensor is to detect vehicles, vehicle detection rates were used to evaluate the effectiveness of the algorithms. The individual algorithms had limitations when used to detect passing cars. Through testing, it was found that CS1 and CS1.5 algorithms were suitable to detect vehicles while stopped in traffic while the CS2 algorithm was suitable vehicle detection while the test vehicle is moving.

In order to compensate for the limitations of the individual algorithms, a fused algorithm was developed that used a combination of CS1 and CS2 or CS1.5 and CS2. The vehicle speed was used in order to determine which algorithm to use in order to detect cars. Although the goal of this project is not vehicle detection, the rate of successful vehicle detection was used in order to evaluate the algorithms.

The evaluation of the fused algorithm demonstrated the value of using CS1 and CS1.5 to detect vehicles when stopped in traffic, which CS2 algorithm cannot do. For a study conducted in traffic, using the fused algorithm increased vehicle detection rates by 51%-62% from using the CS2 algorithm alone.

Since this work successfully compensated for geomagnetic effects of the magnetic sensor, the low-cost crash avoidance system can be further developed since it is no longer limited to driving in a single direction. Other projects that experience unwanted geomagnetic effects in their projects can also implement the knowledge and solutions used in this work.

complete matlab (1806 kB)
MATLAB Post Processing Programs