Introduction
In a previous post I reviewed magnetic navigation and my personal experience using various compasses and magnetometers (Ref.1). In this post I will examine a different magnetometer the Melexis MLX90393. Recent aerial activity of anomalous vehicles suggests that having a method to measure magnetic fields is important. These craft cause all electrical activity to cease when in proximity, which suggests huge magnetic fields. Knowing your normal 3 axis magnetic field, you can determine if significant changes are occurring and trigger an alarm.
Earth’s Magnetic Field Toronto Canada



Figure 1 shows a drawing of the Earth’s magnetic field vector. Figure 2 shows the field at Toronto and Figure 3 shows the declination (Ref.2). Using right angle triangles:
Hhor = sqrt[Hx^2 + Hy^2] = sqrt[18743^2 + 3377^2] = 19045nT
He = sqrt[Hhor^2 + Hz^2] = sqrt[19045^2 + 49632^2] = 53160nT
cos(phi) = Hhor/He, phi = acos(Hhor/He) = 69deg = Inclination
1Tesla = 10^4Gauss
Note that the magnetic field vector has inclination of 90deg or points down at the north magnetic pole and -90deg or pointing up at the south magnetic pole. According to Ref.3 the Earth’s magnetic field varies between 22000nT and 67000nT. In this case the overall 3 axis field is 53.16uT.
MLX90393 Magnetometer


Figure 4 shows a block diagram of the Melexis MLX90393 magnetometer (Ref.4). The magnetometer is available on various development boards and I used the one from SparkFun (Ref.5). Figure 5 lists the specs.
Arduino – MLX90393


In order to test the MLX90393, I used the Arduino Uno as shown in Figure 6 with the latest IDE 2.4.3. I downloaded the Adafruit MLX90393 library using the Arduino Library Manager. After everything was setup, I used standard Arduino I2C to detect the address of the prototype board. Figure 7 shows the result = $0C.


Next I ran the program “compass_calibrated.ino” which is shown in Figure 8. Without any calibration or declination adjustment I pointed the prototype board to approximate North at heading of 6deg. The x axis or magnetic north is indicated on the prototype board and points at right angles to the pin 1 side of the IC. At a heading of 45deg, note the X & Y components are equal = 21.9uT. When a magnetic object comes close to the magnetometer then the 3 axis fields will change and this can be used as a detector. This is demonstrated in the YouTube video.
Please send your comments, questions and suggestions to:
contact:

References
#1. – “Magnetic Navigation”
https://jeremyclark.ca/wp/nav/magnetic-navigation/
#2. – “Magnetic Field Calculator”, UK BGS
http://www.geomag.bgs.ac.uk/data_service/models_compass/wmm_calc.html
#3. – “Earth’s Magnetic Field”
https://en.wikipedia.org/wiki/Earth%27s_magnetic_field
#4. – “Melexis MLX90393 Data Sheet”
https://www.melexis.com/en/product/MLX90393/Triaxis-Micropower-Magnetometer
#5. – “SparkFun Triple Axis Magnetometer”
https://www.sparkfun.com/products/14571