Component guide · Intermediate · 3 min read
Adafruit MMC5603, SparkFun MMC5983MA, Adafruit TMAG5273 3D Hall

and Digilent Pmod CMPS2 Magnetometers
By Geekobot Learning Team · Updated 29 Oct 2026
On this page
These boards measure magnetic field in three axes. The MEMSIC MMC5603 and MMC5983MA are precise, low-noise compass sensors with a set and reset feature that removes offset. The TI TMAG5273 is a 3D Hall sensor for strong fields from nearby magnets, used for joysticks, knobs and position sensing. The Digilent Pmod CMPS2 is a compass module for FPGA and microcontroller boards.
Key specs at a glance
- Range
- ±30 gauss (MMC5603), ±8 gauss (MMC5983MA), ±133 or 266 mT (TMAG5273)
- Resolution
- Up to 18-bit (MMC5983MA)
- Interface
- I2C (SPI on MMC5983MA)
- Supply
- 3.3 V logic (Qwiic and STEMMA QT boards)
- Data rate
- Up to 1 kHz
- Use
- Compass, magnet position, current sensing
Models in this guide
These are alternatives. Pick the one that fits your project; you only need one.
Option 1Adafruit MMC5603 Triple-Axis Magnetometer Sensor – I2C/SPI Interface, STEMMA QT₹1,009
Option 2SparkFun Micro Magnetometer Breakout – MMC5983MA, Compass Sensor (Qwiic)₹2,566
Option 3Adafruit TMAG5273 (A2) 3D Hall Effect Magnetometer – ±133mT / 266mT – STEMMA QT₹939
Option 4Digilent Pmod CMPS2 3-Axis Digital Compass Module – I2C Interface₹1,189
What the MMC5603, MMC5983MA, TMAG5273 and Pmod CMPS2 magnetometers is
The MEMSIC MMC5603 and MMC5983MA are high-precision 3-axis magnetometers for digital compasses, drones and position sensing, with I2C or SPI.
Compass sensors measure the weak Earth field (about 0.5 gauss), so any nearby steel or magnet shifts the reading. The set and reset pulses on MMC parts cancel the sensor's own offset, but you still need hard and soft iron calibration for your device.
The TMAG5273 is the opposite: it is for strong nearby magnets, such as a magnet on a joystick or rotary knob.
MMC5603, MMC5983MA, TMAG5273 and Pmod CMPS2 magnetometers pinout
The pins on the MMC5603, MMC5983MA, TMAG5273 and Pmod CMPS2 magnetometers and what each one does.
| Pin | Function |
|---|---|
| VIN / 3V3 | Supply |
| GND | Ground |
| SCL / SDA | I2C |
| INT | Interrupt (some boards) |
- VIN / 3V3
- Supply
- GND
- Ground
- SCL / SDA
- I2C
- INT
- Interrupt (some boards)
Wiring the MMC5603, MMC5983MA, TMAG5273 and Pmod CMPS2 magnetometers
STEMMA QT and Qwiic boards plug in with one cable and have level shifting where noted.
| MMC5603, MMC5983MA, TMAG5273 and Pmod CMPS2 magnetometers pin | Arduino Uno | ESP32 |
|---|---|---|
| VCC | 5V (or 3.3V) | 3V3 |
| GND | GND | GND |
| SDA | A4 | GPIO 21 |
| SCL | A5 | GPIO 22 |
- VCC
- Arduino Uno:
- 5V (or 3.3V)
- ESP32:
- 3V3
- GND
- Arduino Uno:
- GND
- ESP32:
- GND
- SDA
- Arduino Uno:
- A4
- ESP32:
- GPIO 21
- SCL
- Arduino Uno:
- A5
- ESP32:
- GPIO 22
Example code
Heading here assumes the board is level; use an accelerometer for tilt compensation. Use SparkFun's MMC5983MA and Adafruit's TMAG5273 libraries for those boards.
#include <Adafruit_MMC56x3.h>
Adafruit_MMC5603 mag(12345);
void setup() {
Serial.begin(115200);
if (!mag.begin(MMC56X3_DEFAULT_ADDRESS, &Wire)) { Serial.println("MMC5603 not found"); while (1); }
}
void loop() {
sensors_event_t e;
mag.getEvent(&e);
float heading = atan2(e.magnetic.y, e.magnetic.x) * 57.3;
if (heading < 0) heading += 360;
Serial.printf("x %.1f y %.1f z %.1f uT heading %.0f\n", e.magnetic.x, e.magnetic.y, e.magnetic.z, heading);
delay(200);
}Setup and tuning
VCC 3.3 V (1.8 V core on some), GND, SDA and SCL or SPI.
use the Adafruit MMC56x3 or SparkFun MMC5983MA library.
use the built-in set/reset pulses to remove offset.
rotate in all directions to find hard-iron offsets.
keep away from motors, magnets and steel.
What you need
Shop this list6 of 7 found in our store · ₹10,687
Adafruit MMC5603 Triple-Axis Magnetometer Sensor – I2C/SPI Interface, STEMMA QT: the part this guide coversAdafruit MMC5603 Triple-Axis Magnetometer Sensor – I2C/SPI Interface, STEMMA QT₹1,009
SparkFun Micro Magnetometer Breakout – MMC5983MA, Compass Sensor (Qwiic): another version this guide coversSparkFun Micro Magnetometer Breakout – MMC5983MA, Compass Sensor (Qwiic)₹2,566
Adafruit TMAG5273 (A2) 3D Hall Effect Magnetometer – ±133mT / 266mT – STEMMA QT: another version this guide coversAdafruit TMAG5273 (A2) 3D Hall Effect Magnetometer – ±133mT / 266mT – STEMMA QT₹939
Digilent Pmod CMPS2 3-Axis Digital Compass Module – I2C Interface: another version this guide coversDigilent Pmod CMPS2 3-Axis Digital Compass Module – I2C Interface₹1,189
ESP32-WROOM-32 38-pin development board: for Wi-Fi logging and dashboardsESP32-WROOM-32 38-Pin Development Board₹389- Uno R3 development board: the controller used in the wiring tableFind this part
Adafruit BNO055 9-DOF fusion breakout: orientation without your own filterAdafruit BNO055 9-DOF Absolute Orientation IMU Fusion Breakout – STEMMA QT / Qwiic₹4,595Closest match, check the specs
Alternatives and when to choose them
- QMC5883L: low-cost GY-271 compass.
- LSM303 e-compass: adds tilt compensation.
- Hall effect sensors: simple magnet switches.
Common mistakes to avoid
- Mounting near motors.
- Skipping calibration.
- Using 5 V logic.
- Ignoring tilt.
Frequently asked questions
Why is my compass heading wrong?
It needs hard-iron calibration; rotate it in all directions away from metal and magnets.
What does SET/RESET do?
It removes sensor offset and restores sensitivity after strong fields.
Can it measure heading when tilted?
Yes, if you combine it with an accelerometer for tilt compensation.
Which is more precise?
The MMC5983MA, with lower noise and 18-bit output, suits precise compasses.
Is it 5 V tolerant?
No. Use 3.3 V power and logic, with level shifting for 5 V boards.
Parts for this guide
Keep learning
Sources
Written by the Geekobot team from manufacturer datasheets. Always check the datasheet for the exact part and variant you buy.

