sts1_sensors.edu.BME688¶
Module Contents¶
- class BME688(temperature_osr=8, humidity_osr=2, pressure_osr=4, iir_filter_size=3, temperature_offset=0, enable_gas_measurements=False, gas_heater_temperature=320, gas_heater_duration=150, address=None, bus=None)¶
Pressure, humidity, temperature and gas sensor.
Builds on top of the library bme680.
- Parameters:
temperature_osr (int) – Temperature oversampling rate. Allowed values: [None, 1, 2, 4, 8, 16]. A higher oversampling value means more stable sensor readings with less noise and jitter However each step of oversampling adds about 2ms to the latency, causing a slower response time to fast transients. Defaults to 8.
humidity_osr (int) – Humidity oversampling rate. Allowed values: [None, 1, 2, 4, 8, 16]. A higher oversampling value means more stable sensor readings with less noise and jitter However each step of oversampling adds about 2ms to the latency, causing a slower response time to fast transients. Defaults to 2.
pressure_osr (int) – Pressure oversampling rate. Allowed values: [None, 1, 2, 4, 8, 16]. A higher oversampling value means more stable sensor readings with less noise and jitter However each step of oversampling adds about 2ms to the latency, causing a slower response time to fast transients. Defaults to 4.
iir_filter_size (int) – Number of infinite impulse response filter coefficients. Allowed values: [0, 1, 3, 7, 15, 31, 63, 127]. It removes short term fluctuations from the temperature and pressure readings (not humidity), increasing their resolution but reducing their bandwidth. Defaults to 3.
temperature_offset (int) – Temperature offset, defaults to 0.
enable_gas_measurements (bool) – Enable gas measurements, defaults to False.
gas_heater_temperature (int) – Set temperature of gas sensor heater [°C], between 200 and 400, defaults to 320.
gas_heater_duration (int) – Set duration of gas sensor heater [ms], between 1 and 4032. Approximately 20-30 ms are necessary for the heater to reach the intended target temperature. Defaults to 150.
address (hexadecimal) – Physical address of the sensor on the board (see i2cdetect command). Allowed values: [0x76, 0x77]. If None, the environment variable STS1_SENSOR_ADDRESS_BME688 will be used. If environment variable is not found, 0x76 will be used.
bus (SMBus) – A SMBus object. If None, this class will generate its own, defaults to None.
Example:
sensor = BME688(temperature_osr=8, humidity_osr=2, pressure_osr=4, enable_gas_measurements=True) t = sensor.get_temperature() p = sensor.get_pressure() h = sensor.get_humidity() heat = sensor.get_heat_stable() res = sensor.get_gas_resistance() print(f"{t:.2f} °C, {p:.2f} hPa, {h:.2f} %RH, {heat=}, {res:.2f} Ohms")
- property temperature_osr¶
- property humidity_osr¶
- property pressure_osr¶
- property temperature_offset¶
- property iir_filter_size¶
- property enable_gas_measurements¶
- property gas_heater_temperature¶
- property gas_heater_duration¶
- get_all_data()¶
Returns all sensor data. Calling this method after less than 10 ms will return the same (cached) result.
- get_heat_stable()¶
Indicates whether or not the gas resistance value should be read.
- get_temperature()¶
Temperature in degree celsius.
- get_pressure()¶
Pressure in hPa.
- get_humidity()¶
Humidity in % relative humidity.
- get_gas_resistance()¶
Gas resistance in Ohms.