Same-day dispatch before 2 PM · Free delivery over ₹999 · GST invoices Get the appPrices incl. GST
Geekobot
Snap & SendNEWGeeko AIWhere's myOrder
Log in
Products
  • Projects
    • Component guidesHow parts work, with code you can run
    • Learning pathsFrom your first LED to your first robot
    • Workshops & eventsOnline sessions for makers and classes
    • ElectrolarkFree guided builds, simulator and certificates
    • Students & teachersStudent discount and classroom help
    • CommunityShare builds and ask other makers
    • CalculatorsOhm's law, LED resistor, 555 and 100+ more
    • Circuit builderWire parts and run the circuit, powered by Electrolark
    • Geeko AIAsk what to buy or how to wire it
    • Snap & SendPhotograph a part or list, we find it
    • Part finderAnswer a few questions, get the right part
    • Compatibility checkWill these two parts work together?
    • Compare partsSpecs side by side
    • Business & bulk ordersGST invoices, credit and volume prices
    • Request a quotationSend your list, get a quote
    • Classroom kitsPer-student kits and lab bundles
    • Gift cardsFor students, teams and events
  • Atal Tinkering Lab
BOM to cart
Geekobot

Components, kits and know-how for makers, students, engineers, labs and businesses across India.

Ask Geeko AIOrders, parts and projects, any timeEmail supportReply within 1 working dayGet the Geekobot appAdd it to your home screen, free

Follow us

Shop

  • Boards & SBCs
  • Sensors & Modules
  • IoT & Wireless
  • Drone & FPV
  • 3D Printing
  • Filaments & Resins
  • Motors & Drivers
  • Power & Batteries
  • Semiconductors
  • Passive
  • Displays & LEDs
  • Switches & Relays
  • Wires & Cables
  • Prototyping
  • Tools & Test
  • Robotics
  • STEM Kits
  • Atal Tinkering Lab
  • Mechanical Parts
  • Audio

Orders

  • Track your order
  • Help & support
  • Shipping and delivery
  • Refunds and cancellation
  • Contact us

Learn

  • Projects
  • Geeko AI project assistant
  • Learning paths
  • Guides
  • Calculators
  • Electrolark: free guided builds

Part tools

  • Part finder
  • Compare parts
  • Will it work with my board?

Institutions

  • Classroom kits
  • Atal Tinkering Lab
  • Students & teachers
  • Workshops & Events

Business

  • Business & education
  • Request a quotation
  • BOM bulk upload
  • Quick order by SKU

Company

  • About Geekobot
  • Community
  • Gift cards
  • Terms & conditions
  • Privacy policy
  • Product directory
  • Sitemap

© 2026 Geekobot, a trade name of OLatus Systems Private Limited. All rights reserved.

20, 1st Floor, Neeladri Complex, 10th Cross, Sampige Rd, 2nd Main, Malleshwaram, Bengaluru, Karnataka 560003 · GSTIN 29AACCO0462F1ZM

+91 91810 15607 · connect@geekobot.in · Monday to Saturday, 10 AM to 2 PM IST

UPI · CARDS · NETBANKING · GST INVOICES

ShopProjectsGeeko AIGuides
Compare 0 parts →
Log in

Shop by category

Shop all components
  • Boards & SBCs1,910 products
    • Alternative Single Board Computers
    • Arduino Ecosystem
    • FPGA & Logic Boards
    • Microcontroller & Wireless Boards
    View all
  • Sensors & Modules4,701 products
    • Biomedical & Heart Rate
    • Current, Voltage & Power
    • Force, Weight & Pressure
    • Gas, Weather & Environmental
    View all
  • IoT & Wireless2,314 products
    • RF Modules
    • RFID & NFC
    • Antennas & RF Accessories
    • Cameras & Smart Vision
    View all
  • Drone & FPV3,558 products
    • Flight Control & Navigation
    • FPV Video & Optics
    • Frames & Structural Parts
    • Motors & Propulsion
    View all
  • 3D Printing2,204 products
    • 3D Printers
    • 3D Scanners & Digitizers
    • Laser Engravers & Cutters
    • Material Management & Upgrades
    View all
  • Filaments & Resins1,472 products
    • Filaments
    • Photopolymer Resins
    View all
  • Motors & Drivers463 products
    • BLDC Motor Drivers
    • DC & Geared Motors
    • DC Motor Drivers
    • Linear Actuators & Solenoids
    View all
  • Power & Batteries557 products
    • Battery Holders & Connectors
    • Breadboard Power
    • Chargers & BMS
    • DC-DC Converters
    View all
  • Semiconductors295 products
    • Diodes & Rectifiers
    • Interface & RF Encoder ICs
    • Logic ICs (74xx)
    • Logic ICs (CD4000)
    View all
  • Passive67 products
    • Capacitors
    • Circuit Protection
    • Crystals & Oscillators
    • Inductors
    View all
  • Displays & LEDs572 products
    • 7-Segment & Dot Matrix
    • Addressable LEDs
    • Character LCDs
    • Graphic LCDs
    View all
  • Switches & Relays184 products
    • Keypads & Touch
    • Push Buttons & Tactile
    • Relay Modules
    • Relays
    View all
  • Wires & Cables233 products
    • Board-to-Wire Connectors
    • Crimp & Splice
    • Headers & Dupont
    • Heat Shrink & Sleeving
    View all
  • Prototyping101 products
    • Breadboards
    • Interface Modules
    • PCBs & Perfboards
    View all
  • Tools & Test717 products
    • Bench Power Supplies
    • Hand Tools
    • Measuring Tools
    • Meters & Testers
    View all
  • Robotics180 products
    • Humanoid & Legged Robots
    • Robot Chassis & Platforms
    • Robotic Arms & Grippers
    • Wheels & Casters
    View all
  • STEM Kits268 products
    • Arduino Learning Kits
    • Coding & IoT Kits
    • Early Coding (Ages 3-8)
    • Invention Kits
    View all
  • Atal Tinkering Lab196 products
    • Package 1: Electronics, Robotics, IoT and Sensors
    • Package 2: Rapid Prototyping Tools
    • Package 3: Mechanical, Electrical and Measurement Tools
    • Package 4: Power Supply, Accessories and Safety Equipment
    View all
  • Mechanical Parts212 products
    • Bearings
    • Brackets & Mounts
    • Couplers
    • Fasteners & Standoffs
    View all
  • Audio109 products
    • Amplifier Modules
    • Buzzers & Sirens
    • Speakers
    View all
  1. Home
  2. ›Guides
  3. ›Sensors
  4. ›BMM150 and BMM350 Magnetometers

Component guide · Intermediate · 4 min read

BMM150 and BMM350 Magnetometers

Compass Wiring and Code

By Geekobot Learning Team · Updated 29 Oct 2026

I'm using
Wiring, code and the Run it panels follow your board.
On this page
Short answerWhat the BMM150 / BMM350 magnetometer isBMM150 / BMM350 magnetometer pinoutWiring the BMM150 / BMM350 magnetometerExample codeSetup and tuningWhat you needAlternatives and when to choose themTry itCommon mistakesFAQsParts and next steps
Short answer

The Bosch BMM150 and newer BMM350 are 3-axis magnetometers that measure the Earth's magnetic field to make a digital compass. They talk over I2C (the BMM350 also I3C) and pair well with a 6-axis IMU such as the BMI323 for full 9-axis orientation. Calibration for nearby metal and magnets is essential, and tilt compensation is needed for a heading when the board is not flat.

Key specs at a glance

Range
±1300 µT (X, Y), ±2500 µT (Z) for BMM150; ±2000 µT for BMM350
Resolution
About 0.3 µT (BMM150), 0.1 µT (BMM350)
Interface
I2C (0x10 to 0x13 for BMM150, 0x14/0x15 for BMM350), SPI on BMM150
Supply
1.62 to 3.6 V (modules 3.3 to 5 V)
Current
About 170 µA (BMM150) at 20 Hz
Package
Tiny WLCSP: use a module

Models in this guide

These are alternatives. Pick the one that fits your project; you only need one.

  • Option 1DFRobot Fermion BMM150 Triple Axis Magnetometer Sensor Breakout – I2C/SPI Interface₹819
  • Option 2DFRobot Gravity BMM150 Triple-Axis Magnetometer Sensor – I2C Interface₹1,309
  • Option 3DFRobot Gravity BMM350 Triple-Axis Magnetometer Sensor – I2C/I3C Interface₹1,149
  • Option 4Waveshare BMM150 3-Axis Magnetometer Sensor Module – I2C/SPI Digital Compass₹709
  • Option 5Mikroe GEOMAGNETIC CLICK (Mikroe-2935) – 3-Axis BMM150 Geomagnetic Sensor Board, I²C & SPI, Digital Compass & Magnetic Field Measurement, mikroBUS₹1,509
  • Option 6Bosch BMM150 3-Axis Geomagnetic Magnetometer Sensor, I2C/SPI Digital Output, ±1300 µT (X/Y) & ±2500 µT (Z), –40°C to 85°C₹60
01

What the BMM150 / BMM350 magnetometer is

A magnetometer sees the Earth's field (about 25 to 65 µT) plus the field of everything nearby: steel screws, speakers, motors and current-carrying wires. Calibration removes the constant offsets (hard iron) and the stretching (soft iron).

Heading = atan2(Y, X) only works when the board is level. On a tilted board, use pitch and roll from an accelerometer to correct it, or let a fusion filter do it.

02

BMM150 / BMM350 magnetometer pinout

The pins on the BMM150 / BMM350 magnetometer and what each one does.

PinFunction
VCCSupply (3.3 or 5 V on modules)
GNDGround
SDA / SCLI2C data and clock
SDO / CSBAddress select or SPI pins (BMM150)
INT / DRDYInterrupt and data-ready outputs (optional)
PinFunction
VCC
Supply (3.3 or 5 V on modules)
GND
Ground
SDA / SCL
I2C data and clock
SDO / CSB
Address select or SPI pins (BMM150)
INT / DRDY
Interrupt and data-ready outputs (optional)
03

Wiring the BMM150 / BMM350 magnetometer

Most breakouts have pull-up resistors and a regulator, so they run from 3.3 V or 5 V. Bare sensor ICs are 3.3 V (or 1.8 V) only: solder them to a breakout first and use a level shifter with 5 V boards. Mount the sensor away from motors, speakers and power wires.

BMM150 / BMM350 magnetometer pinArduino UnoESP32
VCC5V (or 3.3V)3V3
GNDGNDGND
SDAA4GPIO 21
SCLA5GPIO 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
04

Example code

To calibrate, rotate the board slowly through all directions, note the minimum and maximum X and Y, and set each offset to (max + min) / 2. For the BMM350 use the DFRobot_BMM350 library.

Simple level compass with calibration offsets (DFRobot_BMM150) · Arduino C++Verify & upload in Electrolark
#include <DFRobot_BMM150.h>

DFRobot_BMM150_I2C bmm(&Wire, I2C_ADDRESS_4);   // 0x13 on DFRobot boards
float offX = 0, offY = 0;                         // fill in after calibration

void setup() {
  Serial.begin(115200);
  while (bmm.begin()) { Serial.println("BMM150 not found"); delay(1000); }
  bmm.setOperationMode(BMM150_POWERMODE_NORMAL);
  bmm.setPresetMode(BMM150_PRESETMODE_HIGHACCURACY);
}

void loop() {
  sBmm150MagData_t m = bmm.getGeomagneticData();
  float heading = atan2(m.y - offY, m.x - offX) * 180.0 / PI;
  if (heading < 0) heading += 360;
  Serial.print("Heading: "); Serial.println(heading, 0);
  delay(200);
}
05

Setup and tuning

Calibrate in place

do it with the sensor mounted in the final case, near its battery and motors.

Declination

add your local magnetic declination (about 0 to 2 degrees in India) for true north.

Tilt compensation

use accelerometer pitch and roll when the board is not level.

Keep away from currents

a wire carrying 1 A a few centimetres away shifts the reading noticeably.

06

What you need

Shop this list11 of 12 found in our store · ₹8,154

  • DFRobot Fermion BMM150 Triple Axis Magnetometer Sensor Breakout – I2C/SPI Interface: the part this guide coversDFRobot Fermion BMM150 Triple Axis Magnetometer Sensor Breakout – I2C/SPI Interface₹819
  • DFRobot Gravity BMM150 Triple-Axis Magnetometer Sensor – I2C Interface: another version this guide coversDFRobot Gravity BMM150 Triple-Axis Magnetometer Sensor – I2C Interface₹1,309
  • DFRobot Gravity BMM350 Triple-Axis Magnetometer Sensor – I2C/I3C Interface: another version this guide coversDFRobot Gravity BMM350 Triple-Axis Magnetometer Sensor – I2C/I3C Interface₹1,149
  • Waveshare BMM150 3-Axis Magnetometer Sensor Module – I2C/SPI Digital Compass: another version this guide coversWaveshare BMM150 3-Axis Magnetometer Sensor Module – I2C/SPI Digital Compass₹709
  • Mikroe GEOMAGNETIC CLICK (Mikroe-2935) – 3-Axis BMM150 Geomagnetic Sensor Board, I²C & SPI, Digital Compass & Magnetic Field Measurement, mikroBUS: another version this guide coversMikroe GEOMAGNETIC CLICK (Mikroe-2935) – 3-Axis BMM150 Geomagnetic Sensor Board, I²C & SPI, Digital Compass & Magnetic Field Measurement, mikroBUS₹1,509
  • Bosch BMM150 3-Axis Geomagnetic Magnetometer Sensor, I2C/SPI Digital Output, ±1300 µT (X/Y) & ±2500 µT (Z), –40°C to 85°C: another version this guide coversBosch BMM150 3-Axis Geomagnetic Magnetometer Sensor, I2C/SPI Digital Output, ±1300 µT (X/Y) & ±2500 µT (Z), –40°C to 85°C₹60
  • Bosch BMM150 3-Axis Digital Geomagnetic Sensor (Magnetometer), ±1300 µT, WJCSP-12 Package: another version this guide coversBosch BMM150 3-Axis Digital Geomagnetic Sensor (Magnetometer), ±1300 µT, WJCSP-12 Package₹203
  • 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
  • DFRobot BMI323 6DOF IMU: for tilt compensation and 9-axis fusionDFRobot Gravity BMI323 6DOF IMU Sensor Module – I2C/UART, Plug & Play₹1,819Closest match, check the specs
  • 0.96 inch OLED display 128x64: to show readings without a computer0.96" OLED Display 128x64₹139Closest match, check the specs
  • Dupont jumper wires: for the connectionsDupont Jumper Wires (40 pcs)₹49Closest match, check the specs
07

Alternatives and when to choose them

  • ✓QMC5883L compass: the common GY-271 module.
  • ✓HMC5883L compass: the original, now rare.
  • ✓Magnetometers and 9-axis IMUs: fused orientation options such as the BNO085.
08

Try it: I2c pullup calculator

Change the values and the diagram and results update as you type.

09

Common mistakes to avoid

  • !Skipping calibration and getting headings that are tens of degrees off.
  • !Mounting it beside a motor, speaker or steel screw.
  • !Using atan2 heading while the board is tilted.
  • !Confusing the BMM150 and BMM350 libraries and addresses.
10

Frequently asked questions

BMM150 or BMM350?

BMM350 for lower noise and better stability; BMM150 has more examples.

Why is my heading wrong?

Usually calibration, nearby metal, or tilt. Calibrate in place and add tilt compensation.

What is the I2C address?

0x10 to 0x13 for the BMM150 (set by pins), 0x14 or 0x15 for the BMM350.

Can it detect magnets?

Yes, it reads any magnetic field, so it also works as a magnet sensor.

Do I need an accelerometer?

Only if the board will not stay level.

Parts for this guide

  • DFRobot Fermion BMM150 Triple Axis Magnetometer Sensor Breakout – I2C/SPI Interface
    ₹819View
  • DFRobot Gravity BMM150 Triple-Axis Magnetometer Sensor – I2C Interface
    ₹1,309View
  • DFRobot Gravity BMM350 Triple-Axis Magnetometer Sensor – I2C/I3C Interface
    ₹1,149View
  • Waveshare BMM150 3-Axis Magnetometer Sensor Module – I2C/SPI Digital Compass
    ₹709View
  • Mikroe GEOMAGNETIC CLICK (Mikroe-2935) – 3-Axis BMM150 Geomagnetic Sensor Board, I²C & SPI, Digital Compass & Magnetic Field Measurement, mikroBUS
    ₹1,509View
  • Bosch BMM150 3-Axis Geomagnetic Magnetometer Sensor, I2C/SPI Digital Output, ±1300 µT (X/Y) & ±2500 µT (Z), –40°C to 85°C
    ₹60View
  • Bosch BMM150 3-Axis Digital Geomagnetic Sensor (Magnetometer), ±1300 µT, WJCSP-12 Package
    ₹203View
  • ESP32-WROOM-32 38-Pin Development Board
    ₹389View
  • Uno R3 Development Board (No Cable)
    ₹359View
  • DFRobot Fermion BMI323 6DOF IMU Sensor (I2C, Breakout)
    ₹1,043View
  • 0.96" OLED Display 128x64
    ₹139View
  • Dupont Jumper Wires (40 pcs)
    ₹49View
Shop Motion, Position & DistanceShop Accelerometers, Gyroscopes & IMUs

Calculators

I2c pullup calculator

Keep learning

Component guideIntermediateMagnetometers and 9-Axis IMUsA 9-axis IMU adds a magnetometer to a gyroscope and accelerometer so it can give a stable heading as well as roll and pitch.3 min read · SensorsComponent guideIntermediateQMC5883L Compass Module (GY-271)The QMC5883L is a 3-axis magnetometer that measures the Earth's magnetic field to give a compass heading.3 min read · SensorsConcept explainerIntermediateI2C ExplainedI2C is a two-wire bus that lets one microcontroller talk to many sensors and displays using a data line (SDA) and a clock line (SCL).4 min read · Electronics Fundamentals

Sources

  • Bosch Sensortec BMM150 datasheet
  • Bosch Sensortec BMM350 datasheet
  • DFRobot BMM150 and BMM350 wiki

Written by the Geekobot team from manufacturer datasheets. Always check the datasheet for the exact part and variant you buy.

On this page
Short answerWhat the BMM150 / BMM350 magnetometer isBMM150 / BMM350 magnetometer pinoutWiring the BMM150 / BMM350 magnetometerExample codeSetup and tuningWhat you needAlternatives and when to choose themTry itCommon mistakesFAQsParts and next steps
Need a hand?Ask Geeko AI which part fits your project, or talk to the Geekobot team.Ask Geeko AIHelp & support

Parts for this guide (Arduino Uno)2 items · ₹1,023

DFRobot Fermion BMM150 Triple Axis Magnetometer Sensor Breakout – I2C/SPI Interface · Uno R3 CH340G ATmega328p Compatible Development Board

Run itChange the inputs and watch the output

Hold the board flat. Heading is degrees from magnetic north, before any offset calibration.

Compass 45°
Serial monitor115200 baud
Heading: 44

A simulation of the sketch above, so you know what to expect. Real readings vary with your parts and wiring.

Ask the Community

Ask a question