Qwiic Magnetometer (MLX90393) Hookup Guide

Pages
Contributors: Englandsaurus
Favorited Favorite 1

Introduction

The MLX90393 is a tri-axial magnetic sensor capable of sensing very small fields while behaving as one would want and expect during saturation in larger fields (like a nearby magnet). It turns out the favorite HMC5883L and other such sensors that are intended for compass applications have a low dynamic range but also strange and undefined behavior in large fields. Ted Yapo did an incredibly extensive characterization of the sensor over on Hackaday. He published his controlled experiments testing a few sensors and found the MLX90393 to be superior.

The MLX90393 can be used as a compass sensor but also works well as a non-contact controller (joystick), flow meter (with magnetic impeller), or a linear actuator position sensor. The breakout board is also a part of SparkFun's Qwiic system, so you won't have to do any soldering to figure out what the magnetic fields look like.

SparkFun Triple Axis Magnetometer Breakout - MLX90393 (Qwiic)

SparkFun Triple Axis Magnetometer Breakout - MLX90393 (Qwiic)

SEN-14571
$17.50
1

In this hookup guide, we'll get going by getting some basic readings from the sensor, then look at how to configure the sensor on different I2C addresses.

Required Materials

To get started, you'll need a microcontroller to control everything in your project.

SparkFun RedBoard - Programmed with Arduino

SparkFun RedBoard - Programmed with Arduino

DEV-13975
$21.50
50
SparkFun ESP32 Thing

SparkFun ESP32 Thing

DEV-13907
$23.50
69

Particle Photon (Headers)

WRL-13774
32 Retired

Raspberry Pi 3

DEV-13825
92 Retired

Now, to get your microcontroller into the Qwiic ecosystem, the key will be one of the following Qwiic shields to match your preference of microcontroller:

SparkFun Qwiic HAT for Raspberry Pi

SparkFun Qwiic HAT for Raspberry Pi

DEV-14459
$6.50
5
SparkFun Qwiic Shield for Arduino

SparkFun Qwiic Shield for Arduino

DEV-14352
$7.50
9

SparkFun Qwiic Shield for Photon

DEV-14477
Retired

You will also need a Qwiic cable to connect the shield to your magnetometer, choose a length that suits your needs.

Qwiic Cable - 100mm

Qwiic Cable - 100mm

PRT-14427
$1.50
Qwiic Cable - 50mm

Qwiic Cable - 50mm

PRT-14426
$0.95

Qwiic Cable - 200mm

PRT-14428
Retired

Qwiic Cable - 500mm

PRT-14429
1 Retired

Or, here's the wishlist to follow along exactly with this guide:

Suggested Reading

If you aren't familiar with the Qwiic system, we recommend reading here for an overview.

Qwiic Connect System
Qwiic Connect System

We would also recommend taking a look at the hookup guide for the Qwiic Shield if you haven't already. Brushing up on your skills in I2C is also recommended, as all Qwiic sensors are I2C.

I2C

An introduction to I2C, one of the main embedded communications protocols in use today.

Serial Terminal Basics

This tutorial will show you how to communicate with your serial devices using a variety of terminal emulator applications.

Qwiic Shield for Arduino & Photon Hookup Guide

Get started with our Qwiic ecosystem with the Qwiic shield for Arduino or Photon.