Magnetometer BMM150
The BMM150 is a compact, ultra-low-power 3-axis digital magnetometer designed for accurate orientation sensing, electronic compass applications, and inertial navigation. Its versatile I²C and SPI interfaces ensure easy integration with popular platforms such as Arduino, ESP32, and Raspberry Pi.
Resource | Link |
---|---|
Github Repository | Github Repository |
Product Brief | Product brief |
Schematic | Schematic |
Key Features
- Axes: 3 (X, Y, Z)
- Measurement Range: ±1300 µT
- Resolution: ~0.3 µT
- Power Consumption: Ultra-low power consumption for battery-operated devices
- Interfaces: I²C and SPI
- Supply Voltage: 3.3 V
- Operating Temperature: Wide operating range suitable for various environments
- Additional Signals:
- DRDY (Data Ready)
- INT (Programmable Interrupt)
- SDO/ADDR (I²C address select / SPI MISO)
Applications
Application | Description |
---|---|
Electronic Compass | Detects Earth’s magnetic field to determine the device orientation. |
Inertial Navigation (INS) | Integrates with accelerometers and gyroscopes to improve position and orientation estimation. |
Augmented Reality (AR) | Dynamically adjusts AR content on smart devices based on precise orientation data. |
Metal Detection / Proximity Sensing | Monitors magnetic field variations to detect metallic objects and machinery anomalies. |
Mobile Robotics and Drones | Provides reliable heading information, essential for indoor navigation and autonomous operation. |
Wearables and Portable Devices | Enhances personal navigation in smartwatches, fitness trackers, and other portable devices. |
Indoor Geolocation | Improves indoor positioning accuracy by compensating for sensor drift and interference. |
Example Code
#include <Wire.h>
#include "DFRobot_BMM150.h"
// Crear un nuevo bus I2C en los pines GPIO 6 (SDA) y 7 (SCL)
TwoWire I2CBMM = TwoWire(1);
// Dirección I2C por defecto del BMM150 (depende del cableado de CS y SDO)
DFRobot_BMM150_I2C bmm150(&I2CBMM, I2C_ADDRESS_4);
void setup() {
Serial.begin(115200);
delay(1000);
// Iniciar el nuevo bus I2C
I2CBMM.begin(6, 7); // SDA = 6, SCL = 7
// Iniciar sensor
while (bmm150.begin()) {
Serial.println("bmm150 init failed, Please try again!");
delay(1000);
}
Serial.println("bmm150 init success!");
bmm150.setOperationMode(BMM150_POWERMODE_NORMAL);
bmm150.setPresetMode(BMM150_PRESETMODE_HIGHACCURACY);
bmm150.setRate(BMM150_DATA_RATE_10HZ);
bmm150.setMeasurementXYZ();
}
void loop() {
sBmm150MagData_t magData = bmm150.getGeomagneticData();
Serial.print("mag x = "); Serial.print(magData.x); Serial.println(" uT");
Serial.print("mag y = "); Serial.print(magData.y); Serial.println(" uT");
Serial.print("mag z = "); Serial.print(magData.z); Serial.println(" uT");
float compassDegree = bmm150.getCompassDegree();
Serial.print("Compass angle (deg): ");
Serial.println(compassDegree);
Serial.println("------------------------------");
delay(200);
}