
CIC QMC5883L Breakout - 3-Axis Magnetic MEMS Sensor Breakout
Overview
The QMC5883L is a multi-chip three-axis magnetic sensor. The QMC5883L is based on our state-of-the-art, high resolution, magneto-resistive technology licensed from Honeywell AMR technology. Along with custom-designed 16-bit ADC ASIC, it offers the advantages of low noise, high accuracy, low power consumption, offset cancellation and temperature compensation. QMC5883L enables 1° to 2° compass heading accuracy. The I²C serial bus allows for easy interface.


Features
- 3-Axis Magneto-Resistive Sensors in a 3x3x0.9 mm3 Land Grid Array Package (LGA), guaranteed to operate over an extended temperature range of -40 °C to +85 °C.
- 16 Bit ADC With Low Noise AMR Sensors Achieves 2 Milli-Gauss Field Resolution
- Wide Magnetic Field Range (±8 Gauss)
- Temperature Compensated Data Output and Temperature Output
- I2C Interface with Standard and Fast Modes.
- Wide Range Operation Voltage (2.16V To 3.6V) and Low Power Consumption (75μA)
- Software And Algorithm Support Available
Specifications
- QMC5883L - 3-Axis Magneto-Resistive Sensors
- Headers for I2C Interface
- Qwiic connector x 2, easy to debug & use
- Dimension: 28 x 18 x 5 mm
Hardware

Pin | Description | Note |
---|---|---|
VDD | Power supply voltage: 2.2-3.6V | |
GND | Ground | |
SDA | I2C interface Data bus | Had external pull-up resistor 4K7 |
SCL | I2C interface Clock bus | Had external pull-up resistor 4K7 |
RDY | Data Ready, Interrupt Pin. Default low. Data ready high until data register is read |
Default I2C interface 7 bit device address: 0x0D
User Guide
It is the best choice to develop embedded drivers with embedded rust. Because the driver can be used with MCU like ESP32, also used with ARM64 Linux Application, for example raspberry pi directly.
You can download the QMC5883L rust driver with git, also add your rust project with cargo - cargo add qmc5883l
.
The examples as below use the first one.
git clone https://github.com/xpulabs/qmc5883l-rs/
Examples
Simple Read QMC5883L Raw Data
This example will simply read QMC5883L raw data.
use std::f32::consts::PI;
use linux_embedded_hal::I2cdev;
use qmc5883l_rs::*;
use qmc5883l_rs::Qmc5883l;
fn main() {
let dev = I2cdev::new("/dev/i2c-3").unwrap();
let mut ic = Qmc5883l::new(dev, 0x0D);
let id = ic.id().unwrap();
println!(" Qmc5883l id = 0x{:02x}", id);
std::thread::sleep(std::time::Duration::from_millis(1000));
ic.set_mode(Mode::CONTINOUS).unwrap();
ic.set_data_rate(DataRate::DATARATE_200HZ).unwrap();
ic.set_range(Range::RANGE_8GA).unwrap();
ic.set_samples(Samples::SAMPLES_256).unwrap();
std::thread::sleep(std::time::Duration::from_millis(1000));
// Set declination angle on your location and fix heading
// You can find your declination on: http://magnetic-declination.com/
// (+) Positive or (-) for negative
// For Beijing / China declination angle is -7'41E (negative)
// Formula: (deg + (min / 60.0)) / (180 / PI);
let decl_angle = -(7.0 + (41.0/60.0)) / (180.0/PI);
ic.set_declination_angle(decl_angle);
loop {
if ic.data_is_ready().unwrap() {
ic.get_raw_data().unwrap();
ic.get_heading_degrees();
println!("X: {}", ic.v.x_axis);
println!("Y: {}", ic.v.y_axis);
println!("Z: {}", ic.v.z_axis);
println!("Degree: {:.05}", ic.v.heading_degress);
}
ic.get_temperature().unwrap();
println!("T: {} - {}", ic.v.temp, ic.v.temp_raw);
std::thread::sleep(std::time::Duration::from_millis(100));
}
}
/dev/i2c-3
is a i2c controller of rpi.- The MPU-6050's I2C Device address is 0x34. So we use
new
function to create a instance.Mpu6050::new(i2c)
set_mode
function will set up work modeset_data_rate
function will set up data rateset_range
function will set up the rangeset_samples
function will set up the sample numberset_declination_angle
function will set up the declination angleget_raw_data
function will get raw dataget_heading_degrees
function will get heading degreesget_temperature
function will get temperature
Use the command as below to build and run the app.
cargo build --target aarch64-unknown-linux-gnu -- example linux-qmc5883l
scp -r ./target/aarch64-unknown-linux-gnu/debug/example/linux-qmc5883l rpi@192.168.6.77:
After login the RPI with SSH, we can execute the app directly.
sudo ./linux-qmc5883l
The terminal will print the raw data & degree, temperature.
Buy it Now
Resources
Documents
Codes
3D Drawing
TBD
FAQ
TBD