Sense the magnetic fields that surround us with this handy triple-axis magnetometer (compass) module. Magnetometers can sense where the strongest magnetic force is coming from, generally used to detect magnetic north, but can also be used for measuring magnetic fields. This sensor tends to be paired with a 6-DoF (degree of freedom) accelerometer/gyroscope to create a 9-DoF inertial measurement unit that can detect its orientation in real-space, thanks to Earth's stable magnetic field.
We based this breakout on the QMC5883P, a magnetometer we see used in many Quadcopter and robotic builds. This compact sensor uses I2C to communicate, and it's very easy to use. Simply download our library and connect the SCL pin to your I2C clock pin, and SDA pin to your I2C data pin and upload our test program to read out magnetic field data.
This sensor can sense ranges from +-2 Gauss (+- 200 uTesla) up to +-30 gauss (+- 3000 uT or 3.0 mT). With 16-bit ADC and settings for over-sampling and downsampling, you can set it up to get just the right range and precision.
To make life easier so you can focus on your important work, we've taken the QMC5883P and put it onto a breakout PCB along with support circuitry to let you use this little wonder with 3.3V (Feather/Raspberry Pi) or 5V (Arduino/ Metro328) logic levels. Additionally, since it speaks I2C, you can easily connect it up with two wires (plus power and ground!).
We've even included SparkFun qwiic compatible STEMMA QT connectors for the I2C bus so you don't even need to solder! Just wire it up to your favorite micro and you can use our CircuitPython/Python or Arduino drivers to easily interface with the QMC5883P and get magnetic measurements ASAP. QT Cable is not included, but we have a variety in the shop.
It's fully assembled and tested. Comes with a bit of 0.1" standard header in case you want to use it with a breadboard or perfboard. Four 2.5mm (0.1") mounting holes for easy attachment.
Page last edited August 11, 2025
Text editor powered by tinymce.