.. highlight:: csharp 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 :doc:`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(); 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().ToString())) );