Skip to main content

Quick Start

This board measures the magnetic field on three axes. Connect it over I2C, install the library for your environment, and run its basic readings example to see the X, Y and Z field in microtesla (µT) and the sensor's temperature.

You program the controller connected to this breakout. The breakout itself is not flashed.

1. Connect the breakout board​

Plug a Qwiic cable into either Qwiic connector on the breakout and into the Qwiic connector on your controller. The one cable carries power and I2C.

NULA DeepSleepSoldered 3-axis Magnetometer BMM350 Breakout
Qwiic connectorQwiic connector
Wiring diagram: the NULA DeepSleep connected to the Soldered 3-axis Magnetometer BMM350 Breakout with a Qwiic cable

Without Qwiic: breadboard wiring​

Solder the included header pins and wire the 4-pin header to your controller's power and I2C pins:

NULA DeepSleepSoldered 3-axis Magnetometer BMM350 Breakout
GNDGND
3V33V3
IO8SDA
IO9SCL
Wiring diagram: the NULA DeepSleep connected to the Soldered 3-axis Magnetometer BMM350 Breakout: GND to GND, 3V3 to 3V3, IO8 to SDA, IO9 to SCL

The header side works from 2 V to 5 V, through the board's 1.8 V regulator and I2C level shifter. The Qwiic connectors share the same supply, so if you power the header from 5 V, both Qwiic connectors carry 5 V too.

2. Install the library​

Download the Soldered BMM350 Geomagnetic Sensor library from its GitHub repository and add it to the Arduino IDE as a ZIP library.

🔗Soldered BMM350 Geomagnetic Sensor

Verified Arduino library at commit 8ef2cae

→

Tip: downloading from GitHub. On the library's GitHub page, click the green Code button and choose Download ZIP, then add it in Arduino IDE with Sketch → Include Library → Add .ZIP Library....

3. Run the first example​

This is basicReadings.ino, the library's simplest example. It starts the sensor at the default address 0x14 and prints the field on all three axes in µT and the temperature in °C, about 10 times a second. Upload it, then open the Serial Monitor at 115200 baud.

Select Board
basicReadings.ino
/**
**************************************************
*
* @file basicReadings.ino
*
* @brief Example showing how to read compensated magnetometer and
* temperature data from the Soldered BMM350 Geomagnetic
* Sensor breakout over I2C
*
* @link solde.red/333359 : Soldered BMM350 Geomagnetic Sensor breakout
*
* @authors Soldered Electronics
***************************************************/
#include <BMM350-SOLDERED.h>

// Create an instance of the BMM350 sensor
Soldered_BMM350 magSensor;

void setup()
{
// Initialize serial for output
Serial.begin(115200);
Serial.println("BMM350 Example - Basic Readings");

// Initialize I2C bus
Wire.begin();

// Check if sensor is connected and initialize it.
// Address is optional, defaults to 0x14 (ADSEL tied low on this breakout)
while (magSensor.begin() != BMM350_OK)
{
Serial.println("Error: BMM350 not connected, check wiring and I2C address!");
delay(1000);
}

Serial.println("BMM350 connected!");
}

void loop()
{
// Get new measurements from the sensor. This must be called before
// accessing the magX/magY/magZ/temperature data, otherwise it will never update
if (magSensor.getSensorData() == BMM350_OK)
{
Serial.print("X: ");
Serial.print(magSensor.magX, 2);
Serial.print(" uT\t");
Serial.print("Y: ");
Serial.print(magSensor.magY, 2);
Serial.print(" uT\t");
Serial.print("Z: ");
Serial.print(magSensor.magZ, 2);
Serial.print(" uT\t");
Serial.print("Temperature: ");
Serial.print(magSensor.temperature, 2);
Serial.println(" degC");
}

// Print 10x per second
delay(100);
}

4. Check the result​

Once the sensor answers, the Serial Monitor shows the two start lines, then one line per reading, about every 100 ms: the field on X:, Y: and Z: in uT with two decimals, then Temperature: in degC, separated by tabs.

Serial MonitorAutoscrollShow timestampNewline115200 baud
Message (Enter to send message to the board)
BMM350 Example - Basic Readings
BMM350 connected!
X: 12.84 uT Y: -21.37 uT Z: -38.92 uT Temperature: 24.61 degC
X: 12.79 uT Y: -21.42 uT Z: -38.88 uT Temperature: 24.62 degC
X: 12.86 uT Y: -21.35 uT Z: -38.95 uT Temperature: 24.62 degC
X: 12.81 uT Y: -21.40 uT Z: -38.90 uT Temperature: 24.63 degC

If you see Error: BMM350 not connected, check wiring and I2C address! once a second instead, the sensor did not answer at 0x14.

5. If it does not work​

Continue with Troubleshooting and retry this smallest example after each change.