Barometer

Select MbientLab boards are equipped with Bosch environmental sensors, either the BMP280 or the BME280. These devices measure absolute barometeric pressure and can also measure temperature.

For pressuring sensing both devices have similar configuration parameters with the exception of slightly different available standby times. Developer’s can use either the IBarometerBmp280 or IBarometerBme280 subclasses to configure the device with their respective standby enum values, or use the IBarometerBosch base class for barometer agnostic apps.

using MbientLab.MetaWear.Sensor;

IBarometerBosch baroBosch = metawear.GetModule<IBarometerBosch>();

Configuration

There are 3 parameters working in conjunction to control the noise, output resolution, and sampling rate:

  • Oversampling
  • Infinite impulse filter (iir) coefficient
  • Standby time

The datasheets for the BMP280 (table 14 and 15) and BME280 (section 5.5) have recommended settings for different use cases.

using MbientLab.MetaWear.Sensor.BarometerBosch;

// configure the barometer with suggested values for
// indoor navigation
barometer.Configure(os = Oversampling.UltraHigh, coeff: IirFilerCoeff._16, standbyTime: 0.5f);

Pressure Data

Pressure data reported by the firmware is in Pascals (pa) and interpreted as a float value by the app side.

await barometer.Pressure.AddRouteAsync(source =>
    source.Stream(data => Console.WriteLine("Pressure (Pa) = " + data.Value<float>()))
);

Altitude Data

Altitude data reported by the firmware is in meters (m) and interpreted as a float value by the app side.

await barometer.Altitude.AddRouteAsync(source =>
    source.Stream(data => Console.WriteLine("Altitude (m) = " + data.Value<float>()))
);