Magnetometer¶
A magnetometer measures magnetic field strength, typically of the Earth’s magnetic field, using the Hall Effect. The data from this sensor can be combined with the BMI160 data to provide 9 degrees of freedom for a Sensor Fusion algorithm.
A few select boards, namely the CPro and MetaMotion boards, have the BMM150 geomagnetic sensor, represented by the IMagnetometerBmm150 interface.
using MbientLab.MetaWear.Sensor;
IMagnetometerBmm150 magnetometer = metawear.GetModule<IMagnetometerBmm150>();
Configuration¶
Bosch provides 4 recommended configurations for the BMM150 chip that control the data rate, current, and noise.
Preset | ODR | Average Current | Noise |
---|---|---|---|
LOW_POWER | 10Hz | 170µA | 1.0µT (xy axis), 1.4µT (z axis) |
REGULAR | 10Hz | 0.5mA | 0.6µT |
ENHANCED_REGULAR | 10Hz | 0.8mA | 0.5µT |
HIGH_ACCURACY | 20Hz | 4.9mA | 0.3µT |
using MbientLab.MetaWear.Sensor.MagnetometerBmm150;
// use the regular preset configuration
magnetometer.Configure(Preset.Regular);
The Configure
is overload to allow advanced useres the ability manually configure each of the sensor parameters.
Magnetic Field Data¶
The BMM150 measures magnetic field strength in Tesla (T) and its data is represented by the MagneticField class.
await magnetometer.MagneticField.AddRouteAsync(source =>
source.Stream(data => Console.WriteLine(data.Value<MagneticField>().ToString()))
);