Skip to main content

Class Bme68x

Represents the Bosch BME68x Temperature, Pressure and Humidity Sensor

Assembly: Bme68x.dll
View Source
public abstract class Bme68x : PollingSensorBase<(Temperature? Temperature, RelativeHumidity? Humidity, Pressure? Pressure, Resistance? GasResistance)>, IObservable<IChangeResult<(Temperature? Temperature, RelativeHumidity? Humidity, Pressure? Pressure, Resistance? GasResistance)>>, ISamplingSensor<(Temperature? Temperature, RelativeHumidity? Humidity, Pressure? Pressure, Resistance? GasResistance)>, ISensor<(Temperature? Temperature, RelativeHumidity? Humidity, Pressure? Pressure, Resistance? GasResistance)>, ITemperatureSensor, ISamplingSensor<Temperature>, ISensor<Temperature>, IHumiditySensor, ISamplingSensor<RelativeHumidity>, ISensor<RelativeHumidity>, IBarometricPressureSensor, ISamplingSensor<Pressure>, ISensor<Pressure>, IGasResistanceSensor, ISamplingSensor<Resistance>, ISensor<Resistance>, ISensor, ISamplingSensor, ISpiPeripheral, II2cPeripheral, IDisposable

Inheritance: System.Object -> Meadow.Foundation.ObservableBase<UNIT> -> Meadow.Foundation.SamplingSensorBase<UNIT> -> Meadow.Foundation.PollingSensorBase<UNIT>

Derived:
Meadow.Foundation.Sensors.Atmospheric.Bme680, Meadow.Foundation.Sensors.Atmospheric.Bme688

Implements:

Expand

System.IObservable<Meadow.IChangeResult<System.ValueTuple<System.Nullable<Meadow.Units.Temperature>,System.Nullable<Meadow.Units.RelativeHumidity>,System.Nullable<Meadow.Units.Pressure>,System.Nullable<Meadow.Units.Resistance>>>>, Meadow.Peripherals.Sensors.ISamplingSensor<System.ValueTuple<System.Nullable<Meadow.Units.Temperature>,System.Nullable<Meadow.Units.RelativeHumidity>,System.Nullable<Meadow.Units.Pressure>,System.Nullable<Meadow.Units.Resistance>>>, Meadow.Peripherals.Sensors.ISensor<System.ValueTuple<System.Nullable<Meadow.Units.Temperature>,System.Nullable<Meadow.Units.RelativeHumidity>,System.Nullable<Meadow.Units.Pressure>,System.Nullable<Meadow.Units.Resistance>>>, Meadow.Peripherals.Sensors.ITemperatureSensor, Meadow.Peripherals.Sensors.ISamplingSensor<Meadow.Units.Temperature>, Meadow.Peripherals.Sensors.ISensor<Meadow.Units.Temperature>, Meadow.Peripherals.Sensors.Atmospheric.IHumiditySensor, Meadow.Peripherals.Sensors.ISamplingSensor<Meadow.Units.RelativeHumidity>, Meadow.Peripherals.Sensors.ISensor<Meadow.Units.RelativeHumidity>, Meadow.Peripherals.Sensors.Atmospheric.IBarometricPressureSensor, Meadow.Peripherals.Sensors.ISamplingSensor<Meadow.Units.Pressure>, Meadow.Peripherals.Sensors.ISensor<Meadow.Units.Pressure>, Meadow.Peripherals.Sensors.Environmental.IGasResistanceSensor, Meadow.Peripherals.Sensors.ISamplingSensor<Meadow.Units.Resistance>, Meadow.Peripherals.Sensors.ISensor<Meadow.Units.Resistance>, Meadow.Peripherals.Sensors.ISensor, Meadow.Peripherals.Sensors.ISamplingSensor, Meadow.Hardware.ISpiPeripheral, Meadow.Hardware.II2cPeripheral, System.IDisposable

Properties

TemperatureOversampleMode

The temperature oversampling mode

View Source
public Bme68x.Oversample TemperatureOversampleMode { get; set; }

PressureOversampleMode

The pressure oversampling mode

View Source
public Bme68x.Oversample PressureOversampleMode { get; set; }

HumidityOversampleMode

The humidity oversampling mode

View Source
public Bme68x.Oversample HumidityOversampleMode { get; set; }

HeaterProfile

Gets / sets the heater profile to be used for measurements

View Source
public Bme68x.HeaterProfileType HeaterProfile { get; set; }

FilterMode

Gets / sets the filtering mode to be used for measurements

View Source
public Bme68x.FilteringMode FilterMode { get; set; }

HeaterIsEnabled

Enable / disable the sensor heater

View Source
public bool HeaterIsEnabled { get; set; }

GasConversionIsEnabled

Enable / disable gas conversions

View Source
public bool GasConversionIsEnabled { get; set; }

DefaultSpiBusSpeed

The default SPI bus speed for the device

View Source
public Frequency DefaultSpiBusSpeed { get; }

SpiBusSpeed

The SPI bus speed for the device

View Source
public Frequency SpiBusSpeed { get; set; }

DefaultSpiBusMode

The default SPI bus mode for the device

View Source
public SpiClockConfiguration.Mode DefaultSpiBusMode { get; }

SpiBusMode

The SPI bus mode for the device

View Source
public SpiClockConfiguration.Mode SpiBusMode { get; set; }

DefaultI2cAddress

The default I2C address for the peripheral

View Source
public byte DefaultI2cAddress { get; }

Temperature

The current temperature

View Source
public Temperature? Temperature { get; }

Pressure

The current pressure

View Source
public Pressure? Pressure { get; }

Humidity

The current humidity, in percent relative humidity

View Source
public RelativeHumidity? Humidity { get; }

GasResistance

The current gas resistance

View Source
public Resistance? GasResistance { get; }

IsDisposed

Is the object disposed

View Source
public bool IsDisposed { get; }

Methods

Initialize()

Initialize the sensor

View Source
protected void Initialize()

Reset()

Perform a complete power-on-reset

View Source
public void Reset()

ConfigureHeatingProfile(HeaterProfileType, Temperature, TimeSpan, Temperature)

Configures a heater profile, making it ready for use.

View Source
public void ConfigureHeatingProfile(Bme68x.HeaterProfileType profile, Temperature targetTemperature, TimeSpan duration, Temperature ambientTemperature)
Parameters
TypeNameDescription
Meadow.Foundation.Sensors.Atmospheric.Bme68x.HeaterProfileTypeprofileThe heater profile to configure
Meadow.Units.TemperaturetargetTemperatureThe target temperature (0-400 C)
System.TimeSpandurationThe measurement duration (0-4032ms)
Meadow.Units.TemperatureambientTemperatureThe ambient temperature

GetPowerMode()

Get the current power mode

View Source
public Bme68x.PowerMode GetPowerMode()
Returns

Meadow.Foundation.Sensors.Atmospheric.Bme68x.PowerMode: The power mode### SetPowerMode(PowerMode) Sets the power mode to the given mode

View Source
public void SetPowerMode(Bme68x.PowerMode powerMode)
Parameters
TypeNameDescription
Meadow.Foundation.Sensors.Atmospheric.Bme68x.PowerModepowerModeThe Meadow.Foundation.Sensors.Atmospheric.Bme68x.PowerMode to set.

GetMeasurementDuration(HeaterProfileType)

Gets the required time in to perform a measurement. The duration of the gas measurement is not considered if Meadow.Foundation.Sensors.Atmospheric.Bme68x.GasConversionIsEnabled is set to false or the chosen Meadow.Foundation.Sensors.Atmospheric.Bme68x.HeaterProfile is not configured. The precision of this duration is within 1ms of the actual measurement time.

View Source
public TimeSpan GetMeasurementDuration(Bme68x.HeaterProfileType profile)
Returns

System.TimeSpan

Parameters
TypeNameDescription
Meadow.Foundation.Sensors.Atmospheric.Bme68x.HeaterProfileTypeprofileThe used Meadow.Foundation.Sensors.Atmospheric.Bme68x.HeaterProfile.

RaiseEventsAndNotify(IChangeResult<(Temperature? Temperature, RelativeHumidity? Humidity, Pressure? Pressure, Resistance? GasResistance)>)

Raise events for subscribers and notify of value changes

View Source
protected override void RaiseEventsAndNotify(IChangeResult<(Temperature? Temperature, RelativeHumidity? Humidity, Pressure? Pressure, Resistance? GasResistance)> changeResult)
Parameters
TypeNameDescription
Meadow.IChangeResult<System.ValueTuple<System.Nullable<Meadow.Units.Temperature>,System.Nullable<Meadow.Units.RelativeHumidity>,System.Nullable<Meadow.Units.Pressure>,System.Nullable<Meadow.Units.Resistance>>>changeResultThe updated sensor data

ReadSensor()

Reads data from the sensor

View Source
protected override Task<(Temperature? Temperature, RelativeHumidity? Humidity, Pressure? Pressure, Resistance? GasResistance)> ReadSensor()
Returns

System.Threading.Tasks.Task<System.ValueTuple<System.Nullable<Meadow.Units.Temperature>,System.Nullable<Meadow.Units.RelativeHumidity>,System.Nullable<Meadow.Units.Pressure>,System.Nullable<Meadow.Units.Resistance>>>: The latest sensor reading### CompensateTemperature(int) Compensates the temperature

View Source
protected Temperature CompensateTemperature(int rawTemperature)
Returns

Meadow.Units.Temperature: The temperature

Parameters
TypeNameDescription
System.Int32rawTemperatureThe temperature value read from the device

Dispose()

Performs application-defined tasks associated with freeing, releasing, or resetting unmanaged resources.

View Source
public void Dispose()

Dispose(bool)

Dispose of the object

View Source
protected virtual void Dispose(bool disposing)
Parameters
TypeNameDescription
System.BooleandisposingIs disposing

Implements

  • System.IObservable<Meadow.IChangeResult<System.ValueTuple<System.Nullable<Meadow.Units.Temperature>,System.Nullable<Meadow.Units.RelativeHumidity>,System.Nullable<Meadow.Units.Pressure>,System.Nullable<Meadow.Units.Resistance>>>>
  • Meadow.Peripherals.Sensors.ISamplingSensor<System.ValueTuple<System.Nullable<Meadow.Units.Temperature>,System.Nullable<Meadow.Units.RelativeHumidity>,System.Nullable<Meadow.Units.Pressure>,System.Nullable<Meadow.Units.Resistance>>>
  • Meadow.Peripherals.Sensors.ISensor<System.ValueTuple<System.Nullable<Meadow.Units.Temperature>,System.Nullable<Meadow.Units.RelativeHumidity>,System.Nullable<Meadow.Units.Pressure>,System.Nullable<Meadow.Units.Resistance>>>
  • Meadow.Peripherals.Sensors.ITemperatureSensor
  • Meadow.Peripherals.Sensors.ISamplingSensor<Meadow.Units.Temperature>
  • Meadow.Peripherals.Sensors.ISensor<Meadow.Units.Temperature>
  • Meadow.Peripherals.Sensors.Atmospheric.IHumiditySensor
  • Meadow.Peripherals.Sensors.ISamplingSensor<Meadow.Units.RelativeHumidity>
  • Meadow.Peripherals.Sensors.ISensor<Meadow.Units.RelativeHumidity>
  • Meadow.Peripherals.Sensors.Atmospheric.IBarometricPressureSensor
  • Meadow.Peripherals.Sensors.ISamplingSensor<Meadow.Units.Pressure>
  • Meadow.Peripherals.Sensors.ISensor<Meadow.Units.Pressure>
  • Meadow.Peripherals.Sensors.Environmental.IGasResistanceSensor
  • Meadow.Peripherals.Sensors.ISamplingSensor<Meadow.Units.Resistance>
  • Meadow.Peripherals.Sensors.ISensor<Meadow.Units.Resistance>
  • Meadow.Peripherals.Sensors.ISensor
  • Meadow.Peripherals.Sensors.ISamplingSensor
  • Meadow.Hardware.ISpiPeripheral
  • Meadow.Hardware.II2cPeripheral
  • System.IDisposable