High Precision 3-Axis Magnetic Field Sensor Module
🔍 What this sensor is
The SmartElex LIS2MDL Triple-Axis Magnetometer is a 3-axis magnetic field sensor used to detect:
🧭 Direction (like a compass)
🧲 Magnetic field strength
📐 Orientation relative to Earth’s magnetic field
👉 In simple terms:
➡️ It acts like a digital compass module
🧠 Core Concept (VERY IMPORTANT)
This sensor measures magnetic field in 3 directions:
X-axis
Y-axis
Z-axis
➡️ Output = vector (3D magnetic field data)
👉 Using this, you can calculate:
Heading (North direction)
Orientation in space
⚙️ Key Specifications
Sensor IC: LIS2MDL (by STMicroelectronics)
Interface: I²C / SPI
Operating Voltage: ~3.3V–5V
Magnetic Range: ±50 gauss (±5000 µT)
Resolution: 16-bit output
Data Rate: up to ~100–150 Hz
Power Consumption: very low (~50–200 µA typical)
I2C Address: typically 0x1E
⚡ Working Principle (simple)
Earth has a magnetic field (like a giant magnet)
Sensor measures magnetic strength in 3 axes
Microcontroller calculates direction (heading)
👉 Result:
➡️ You get compass direction (0°–360°)
🧠 What it can do
This sensor enables:
🧭 Digital compass
📐 Orientation detection
🧲 Magnetic field measurement
🧭 Navigation systems
🕹️ Motion tracking (with IMU)
🔌 Pinout (Typical)
VCC → 3.3V / 5V
GND → GND
SDA → I2C Data
SCL → I2C Clock
DRDY / INT → Optional interrupt
💡 Applications
🧭 Electronic compass (very common)
🤖 Robotics navigation
🚁 Drones (heading control)
📱 Motion tracking devices
🕶️ AR/VR orientation
🧠 9DOF IMU systems
🔥 Special Use (IMPORTANT)
👉 This sensor is often combined with:
Accelerometer
Gyroscope
➡️ Example:
Your previous sensor: LSM6DSO (6DOF)
Add this → becomes 9DOF IMU
✔️ Now you get:
Pitch
Roll
Yaw (true orientation)
⚠️ Important Notes (VERY IMPORTANT)
❗ 1. Needs calibration
👉 Raw readings are NOT accurate direction
You must calibrate:
Hard iron offset
Soft iron distortion
👉 Without calibration → wrong compass readings
❗ 2. Sensitive to interference
Nearby metal
Motors
Wires
➡️ Can disturb readings
❗ 3. Not standalone orientation sensor
👉 Alone = gives magnetic data
👉 Needs math + fusion for full orientation
🆚 LIS2MDL vs Other Magnetometers
| Sensor | Accuracy | Complexity | Use |
|---|---|---|---|
| LIS2MDL | Good | Medium | General compass |
| HMC5883L | Older | Easy | Basic projects |
| MLX90393 | High | Medium | Precision sensing |
| BNO055 | Very high | Easy | Full IMU (auto fusion) |
👍 When to use this
Use LIS2MDL if you want:
Digital compass
Robotics navigation
IMU system (with accel + gyro)
Magnetic field sensing
👎 When NOT to use
Avoid if:
You want plug-and-play orientation → use BNO055
You are a complete beginner (needs calibration math)
🧠 Final Understanding
👉 This sensor = “electronic compass + magnetic field detector”
👉 Powerful when combined with IMU sensors
