Labs / Electronic modules

GraftSense - 3-axis Hall Sensor Module Based on MMC5603 (Open Version)

Author: Li Zisheng · Source: FreakStudio open documentation, v1.1 · License: CC BY 4.0 · Driver code (sensors/mmc5603_driver): MIT License

Contents
MMC5603
MMC5603 3 LED1 R3 C3 U2 C1 C2 R2 R1

I. Module Introduction

Tri-axis magnetometer module based on MMC5603, adopts the high-performance tri-axis MMC5603 AMR magnetometer solution from MEMSIC Semiconductor, which can measure the tri-axis magnetic field intensity of X / Y / Z with high precision, output a digital signal up to 20 bits, and realize the azimuth detection of the electronic compass with an accuracy of ±1°;The module is equipped with LDO voltage regulator circuits, power filtering and indicator light circuits, powered by 3.3V and communicating with the main controller via the I²C interface. It has built-in temperature drift compensation and strong magnetic field degaussing functions, with noise as low as 2mG and extremely low power consumption, making it suitable for portable devices, wearable devices, navigation and positioning, and low-power magnetic field sensing scenarios in the Internet of Things.

II. Introduction to Main Chips

MMC5603 is a high-performance, low-power three-axis AMR magnetic sensor that integrates an I²C interface and on-chip temperature compensation, features a measurement range of ±30G and 20-bit resolution, adopts an ultra-compact 0.8×0.8×0.4mm WLP package, and is suitable for smart wearables and portable devices.

2.1 Chip Overview

MMC5603NJ 30 20 20000Hz 0.0625mG 2mG 1 0.8 0.4mm 400kHz

MMC5603NJ is a three-axis AMR magnetic sensor with a measurement range of ±30 gauss, 20-bit resolution, built-in automatic degaussing and temperature compensation, and an ultra-compact wafer-level package measuring 0.8×0.8×0.4mm. I²C interface supports a maximum of 400kHz, with power consumption as low as 1μA, making it suitable for applications such as electronic compasses and position sensing.

2.2 Pin Definition

MMC5603 1 2 A1 B1 A2 B2 0.82 0.03mm 0.40mm
MMC5603 A1 A2 B1 B2 0.82 0.82mm 4

MMC5603 adopts a WLP package measuring 0.82×0.82mm and features only 4 pins: A1 (VSA) for ground, B1 (VDD) for power supply, A2 (SCL) and B2 (SDA) serving as the I²C communication clock and data lines. It also defines the X / Y / Z three-axis measurement directions, making it a three-axis magnetic sensor with a minimalist design.

2.3 Functional Block Diagram

MMC5603

MMC5603 supplies power to the X / Y / Z three-axis magnetic sensing unit via a bridge regulator, acquires signals in a time-division manner through a demultiplexer and a multiplexer; after being amplified and conditioned by the processing path, the signals are stored in the corresponding registers and then output through the I²C interface. Meanwhile, it integrates a clock generator, OTP calibration, SET / RESET degaussing control, a voltage reference and a temperature sensor, realizing stable measurement and digital output of magnetic signals.

2.4 Performance Parameters

MMC5603

MMC5603 features a magnetic field range of ±30G, a supply voltage of 1.62-3.6V, a maximum output rate of 1kHz, 20-bit resolution, typical power consumption of 0.75-3.4mA across different bandwidths, and a current of only 1μA in low-power mode. It also specifies performance parameters including linear error, noise, sensitivity, heading accuracy (typically ±1°) and temperature drift, with clear typical values and ranges under various conditions.

MMC5603 0.5V 5V 55 125 10000G

MMC5603 has an absolute maximum rated power supply voltage range of -0.5V to + 5V, a storage temperature range of -55°C to + 125°C, and a maximum exposed magnetic field of 10000G. It is emphasized that exceeding these values may cause permanent damage, and prolonged exposure to extreme conditions will also affect the reliability of the device.

2.5 Reference Circuit

MMC5603NJ 2.7k 2.2 1.62 3.6V

MMC5603NJ operates on a single power supply of 1.62~3.6V. In the circuit, VDD is connected to the power supply, VSA is grounded, SCL and SDA are connected to the I / O power supply via 2.7kΩ pull-up resistors to enable I²C communication. Meanwhile, a 2.2μF capacitor is connected in parallel at the power terminal for filtering, forming the typical peripheral circuit of this three-axis magnetic sensor.

2.6 Chip Configuration

None.

2.7.1 I2C Communication

MMC5603NJ 5 7 0110000

MMC5603 's I²C slave interface adopts the standard two-wire I²C bus. The SDA / SCL lines realize bidirectional communication via pull-up resistors, and the sensor only responds to read and write commands from the master. This document also provides recommendations for pull-up resistor selection: 2.7kΩ is recommended for short buses (<10cm), and 10kΩ can be used for even shorter buses(<5cm).

MMC5603 I2C

MMC5603 adopts I²C data transmission, which is defined by START / STOP conditions: the master sends a 7-bit slave address plus a read/write bit, and the device address is pre-programmed as 0110000 at the factory; the complete measurement process consists of multiple I²C cycles, including writing to the control register to start acquisition, polling the status register to wait for completion, and then reading the data of the X / Y / Z axes, and supports multi-byte continuous read and write operations.

MMC5603 I2C 3 4

MMC5603 continuous measurement mode ( CMM ) and SET / RESET degaussing continuous mode configuration output rate ( ODR ), the sensor will periodically collect data stored in registers, without repeated requests from the host; SET / RESET process through two opposite polarity magnetization measurement ( Output1 =+ H + Offset , Output2 = -H + Offset ), and then calculate H = (Output1-Output2)/2 , can eliminate the bridge offset error caused by temperature, improve measurement accuracy.

MMC5603NJ 27H 28H 29H 80 1EH 1FH 20H 0x000001 1BH

MMC5603NJ On-chip self-test procedure description: The steps include reading the self-test signals from registers 27H to 29H, calculating the threshold as 80% of the obtained value and writing it to 1EH / 1FH / 20H, then writing 1BH to the control register 01000001 to start the test, and finally reading the 18H of the status register Sat_sensor bit; if the bit is 0, it indicates that the self-test is passed.

MMC5603NJ 5ms 1ms 00 6.6ms

MMC5603NJ operating timing defines that a wait of at least 5ms is required for the first operation after the power supply stabilizes, SET / RESET operations must be followed by an interval of at least 1ms before executing other instructions, and it also provides the single measurement time under different bandwidths (BW), ranging from 6.6ms when BW = 00 to 1.2ms when BW = 11, clearly demonstrating the complete timing sequence of the device from initialization to SET / RESET, measurement, and data reading.

2.7.2 Registers

MMC5603 Xout0 Xout2 Yout0 Zout0 Zout2

MMC5603 register mapping table, which includes addresses for three-axis magnetic field data (X / Y / Zout), temperature output, status, output data rate (ODR), control registers, self-test threshold/value, and product ID, clarifies the address and function of each register.

MMC5603 Xout0 Xout1 Xout2 Yout0 Yout1 Yout2 Zout0 Zout1 Zout2

MMC5603 is a three-axis magnetic field data register. The data of the X / Y / Z axes are composed of 3 read-only registers (such as Xout0 / Xout1 / Xout2) respectively, which together form 20-bit raw data; the valid bits vary in different resolution modes, the 16/18/20-bit modes use bits [19:4], [19:2], [19:0] respectively, and the data is in unsigned format.

09H 0.8 1 18H 1AH 1-255Hz 1000Hz 75 125 7

The registers shown in the above figure contain Z -axis data, temperature output (09H, 0.8℃/LSB), Status Register 1 (18H, which contains read-only flags such as measurement completion and self-test status), and Output Data Rate Register (1AH, configurable from 1 to 255Hz with a maximum support of 1000Hz), and also specifies the address, mode, bit definition of each register as well as the correspondence between ODR and bandwidth.

MMC5603 0 1 BW0 BW1

MMC5603 ’s internal control registers 0 (1BH) and 1 (1CH) are both write-only. Control register 0 is used to initiate magnetic/temperature measurement, perform SET / RESET, enable automatic degaussing/self-test and continuous mode; control register 1 allows configuration of measurement bandwidth (BW), masking of X / Y / Z channels, and triggering of self-test, with the measurement time corresponding to different bandwidths also provided.

MMC5603 2 1CH 0

MMC5603 's Control Register 2 (1DH) and self-test related registers: Control Register 2 operates in write-only mode, supporting software reset, enabling continuous measurement mode, configuring periodic SET / RESET, and setting a 1000Hz output rate;1EH / 1FH / 20H are self-test threshold registers for each axis, and 27H / 28H / 29H are self-test setting registers, used for configuring the sensor self-test procedure.

MMC5603 28H 29H 1 39H 00010000

MMC5603 registers, in which ST_Y (28H) and ST_Z (29H) are read-write self-test setting value registers that store the factory-calibrated self-test reference values for the Y axis and Z axis;Product ID 1 (39H) is a read-only register with a reset value of 00010000, used for device identification.

2.8 PCB Routing Notes

None.

III. Circuit Engineering

3.1 Circuit Source Engineering

To obtain the source code of the circuit, please follow the official account [Freak Embedded]

3.2 Module Usage Instructions

The schematic diagram of this module is shown below:

SCH_Schematic1_3-Axis Hall Sensor Module Based on MMC5603_v1.0.0_2026-05-12.pdf 2.1 MB

MMC5603 LED1 R3 C3 U2 C1 C2 R2 R1 C6

This module provides an IIC communication interface: it supports standard I2C communication rates, is compatible with 3.3V logic level, and can stably transmit the up-to-20-bit digital signals of triaxial (X / Y / Z) magnetic field intensity collected by the MMC5603. It is suitable for scenarios including portable devices, wearable devices, navigation and positioning, and low-power magnetic field sensing for the Internet of Things, providing the system with reliable high-precision electronic compass and orientation perception data interaction capabilities.

3.3 Application Experiment

Here, we use the GraftPort-RP2040 development board for testing. The MMC5603-based three-axis Hall sensor module uses the I2C interface to communicate with the main controller.

Here, we first use the HY2.0-4P connection cable to connect the module to the GraftPort-RP2040 development board's I2C0 interface:

Development Board Pins

Module Pins

Description

Pin 4

SDA

I2C data transmission line, corresponding to I2C0 's SDA

Pin 5

SCL

I2C clock signal line, corresponding to the I2C0 SCL

Here, we need to search for the relevant driver packages on uPyPI: https://upypi.net/zh/

106

Enter mmc5603_driver to search, and the following will be displayed:

mmc5603_driver 1.0.8 mmc5603 2026 01 29

Click to copy the local installation command:

mmc5603_driver MMC5603 2026 5 29 1.0.0

Import the module driver library code via the mip tool. Below are the usage commands for the mpremote tool:

mpremote mip install https://upypi.net/pkgs/mmc5603_driver/1.0.0

Import the MicroPython driver code for the MMC5603-based 3-axis Hall sensor module, then copy the following main.py code into our project:

# Python env   : MicroPython v1.23.0
# -*- coding: utf-8 -*-
# @Time    : 2026/4/15 3:30 PM
# @Author  : hogeiha
# @File    : main.py
# @Description : MMC5603 magnetometer data reading

# ======================================== Import Modules =========================================

import time
from machine import Pin, SoftI2C
from micropython_mmc5603 import mmc5603

# ======================================== Global Variables ============================================

# Target sensor address list (MMC5603 default address 0x30)
TARGET_SENSOR_ADDRS = [0x30]

# I2C bus pin and frequency configuration
I2C_SDA_PIN = 4
I2C_SCL_PIN = 5
I2C_FREQ = 400000

# ======================================== Functions ============================================

# ======================================== Custom Classes ============================================

# ======================================== Initialization configuration ===========================================

# Wait for the system to stabilize
time.sleep(3)
print("FreakStudio: MMC5603 magnetometer initialization and I2C scanner")

# Initialize the I2C bus (using SoftI2C for RP2040 compatibility)
i2c_bus = SoftI2C(sda=Pin(I2C_SDA_PIN), scl=Pin(I2C_SCL_PIN), freq=I2C_FREQ)

# Start scanning for devices on the I2C bus
devices_list: list[int] = i2c_bus.scan()
print("START I2C SCANNER")

# Check the I2C device scan result
if len(devices_list) == 0:
    print("No i2c device !")
    raise SystemExit("I2C scan found no devices, program exited")
else:
    print("i2c devices found:", len(devices_list))

# Iterate over the address list to initialize the target sensor
sensor = None
for device in devices_list:
    if device in TARGET_SENSOR_ADDRS:
        print("I2c hexadecimal address:", hex(device))
        try:
            # Automatically identify and initialize the corresponding sensor
            sensor = mmc5603.MMC5603(i2c=i2c_bus)
            print("Sensor initialization successful")
            break
        except Exception as e:
            print(f"Sensor Initialization failed: {e}")
            continue
else:
    # Target device not found, raise an exception
    raise Exception("No target sensor device found in I2C bus")

# ========================================  Main Program  ============================================

# Main loop: read and print magnetic field and temperature data every second
while True:
    mag_x, mag_y, mag_z = sensor.magnetic
    print(f"X:{mag_x:.2f}, Y:{mag_y:.2f}, Z:{mag_z:.2f} uT")
    temp = sensor.temperature
    print(f"Temperature: {temp:.2f}°C")
    print()
    time.sleep(1.0)

Burn the code, open the terminal, and the output is as follows:

MMC5603 I2C 0xc 22.84 80.53 36.78

The MMC5603 magnetometer features normal I2C communication and initialization, can stably output three-axis magnetic field data, the values are updated in real time as the sensor attitude changes, and its working response is normal.

IV. Drivers

mmc5603_driver-1.0.0.zip 15 KB

None.

6. Revision History

Document Version

Date of Revision

Modifier

Modified Content

v1.0

2026-05-12

Ling Gaoxing

Initialize the document

v1.1

2026-06-05

Xin Ruili

Create an open version of the document, based on the internal document version v1.1.

VII. Relevant Materials

7.1 Chip Datasheet

MMC5603NJ.pdf 322 KB

7.2 Unique Icons for PCB Silk Screen

MMC5603 7.2