Class BME68x

java.lang.Object
com.diozero.devices.BME68x
All Implemented Interfaces:
DeviceInterface, BarometerInterface, HygrometerInterface, SensorInterface, ThermometerInterface, AutoCloseable

public class BME68x
extends Object
implements BarometerInterface, ThermometerInterface, HygrometerInterface
  • Field Details

    • MIN_TEMPERATURE_CELSIUS

      public static int MIN_TEMPERATURE_CELSIUS
    • MAX_TEMPERATURE_CELSIUS

      public static int MAX_TEMPERATURE_CELSIUS
    • MIN_PRESSURE_HPA

      public static int MIN_PRESSURE_HPA
    • MAX_PRESSURE_HPA

      public static int MAX_PRESSURE_HPA
    • MIN_HUMIDITY_PERCENT

      public static int MIN_HUMIDITY_PERCENT
    • MAX_HUMIDITY_PERCENT

      public static int MAX_HUMIDITY_PERCENT
    • GAS_WAIT_SHARED_MS

      public static final int GAS_WAIT_SHARED_MS
      See Also:
      Constant Field Values
    • DEVICE_ADDRESS

      public static final int DEVICE_ADDRESS
      See Also:
      Constant Field Values
    • ALT_DEVICE_ADDRESS

      public static final int ALT_DEVICE_ADDRESS
      See Also:
      Constant Field Values
  • Constructor Details

    • BME68x

      public BME68x()
    • BME68x

      public BME68x​(int controller)
      Create a new BME680 sensor driver connected on the given bus.
      Parameters:
      controller - I2C bus the sensor is connected to.
    • BME68x

      public BME68x​(int controller, int address)
      Create a new BME680 sensor driver connected on the given bus and address.
      Parameters:
      controller - I2C bus the sensor is connected to.
      address - I2C address of the sensor.
  • Method Details

    • close

      public void close()
      Close the driver and the underlying device.
      Specified by:
      close in interface AutoCloseable
      Specified by:
      close in interface DeviceInterface
    • initialise

      public void initialise()
      Initialise the device. bme68x_init
    • softReset

      public void softReset()
      Initiate a soft reset. bme68x_soft_reset
    • getChipId

      public byte getChipId()
      Get the chip id. read_chip_id
      Returns:
      chip identifier
    • getVariantId

      public byte getVariantId()
      Get the chip variant id. read_variant_id
      Returns:
      chip variant identifier
    • getUniqueId

      public byte getUniqueId()
      Get the chip's identifier. Note not documented.
      Returns:
      chip unique id
    • getOperatingMode

      public BME68x.OperatingMode getOperatingMode()
      Get the operating mode. bme68x_get_op_mode
      Returns:
      Current operating mode
    • setOperatingMode

      public void setOperatingMode​(BME68x.OperatingMode mode)
      Set the operating mode. bme68x_set_op_mode
      Parameters:
      mode - Target operating mode
    • setConfiguration

      public void setConfiguration​(BME68x.OversamplingMultiplier humidityOversampling, BME68x.OversamplingMultiplier temperatureOversampling, BME68x.OversamplingMultiplier pressureOversampling, BME68x.IirFilterCoefficient filter, BME68x.ODR odr)
      Set the oversampling, filter and odr configuration. bme68x_set_conf
      Parameters:
      humidityOversampling - Humidity oversampling mode
      temperatureOversampling - Temperature oversampling mode
      pressureOversampling - Pressure oversampling mode
      filter - IIR Filter coefficient
      odr - Standby time between sequential mode measurement profiles (BME688 only).
    • getHumidityOversample

      public BME68x.OversamplingMultiplier getHumidityOversample()
      Get humidity oversampling mode
      Returns:
      Current humidity oversampling mode
    • getTemperatureOversample

      public BME68x.OversamplingMultiplier getTemperatureOversample()
      Get temperature oversampling mode
      Returns:
      Current temperature oversampling mode
    • getPressureOversample

      public BME68x.OversamplingMultiplier getPressureOversample()
      Get pressure oversampling mode
      Returns:
      Current pressure oversampling mode
    • getIirFilterConfig

      public BME68x.IirFilterCoefficient getIirFilterConfig()
      Get the IIR filter configuration
      Returns:
      IIR filter configuration
    • getOdr

      public BME68x.ODR getOdr()
    • getRemainingMeasureDuration

      public int getRemainingMeasureDuration​(BME68x.OperatingMode targetOperatingMode)
      Get the remaining duration in microseconds that can be used for heating using the currently configured humidity, temperature and pressure oversampling modes. bme68x_get_meas_dur
      Returns:
      remaining duration in microseconds
    • getSensorData

      public BME68x.Data[] getSensorData()
      Read the pressure, temperature and humidity and gas data from the sensor, compensates the data and store it in the bme68x_data structure instance passed by the user. bme68x_get_data
      Returns:
      Sensor data
    • getSensorData

      public BME68x.Data[] getSensorData​(BME68x.OperatingMode operatingMode)
      Read the pressure, temperature and humidity and gas data from the sensor, compensates the data and store it in the bme68x_data structure instance passed by the user. bme68x_get_data
      Parameters:
      operatingMode - Device operating mode
      Returns:
      Sensor data
    • getTemperature

      public float getTemperature()
      Description copied from interface: ThermometerInterface
      Get temperature in degrees celsius
      Specified by:
      getTemperature in interface ThermometerInterface
      Returns:
      Temperature (deg C)
    • getPressure

      public float getPressure()
      Description copied from interface: BarometerInterface
      Get the pressure in kPa
      Specified by:
      getPressure in interface BarometerInterface
      Returns:
      pressure in kPa
    • getRelativeHumidity

      public float getRelativeHumidity()
      Description copied from interface: HygrometerInterface
      Get the relative humidity in percent.
      Specified by:
      getRelativeHumidity in interface HygrometerInterface
      Returns:
      The relative humidity in percent.
    • getGasResistance

      public float getGasResistance()
    • setHeaterConfiguration

      public void setHeaterConfiguration​(BME68x.OperatingMode targetOpMode, BME68x.HeaterConfig heaterConfig)
      Set the gas configuration of the sensor. bme68x_set_heatr_conf
    • lowGasSelfTestCheck

      public void lowGasSelfTestCheck()
      Self-test of low gas variant of BME68X (i.e. the BME680) bme68x_low_gas_selftest_check