3.3.4 IIR filter
The environmental pressure is subject to many short-term changes, caused external disturbances. To suppress disturbances
(e.g. slamming of door or wind blowing into the sensor) in the output data without causing additional interface traffic and
processor work load, the BME680 features an internal IIR filter (see Section 5.3.2.4). It effectively reduces the bandwidth of
the temperature and pressure output signals and increases the resolution of the output data to 20 bit, noting that the humidity
and gas values inside the sensor does not fluctuate rapidly and does not require low pass filtering. The output of a next
measurement step is filtered using the following formula:
is the data coming from the current filter memory, and is the data coming from current ADC acquisition.
denotes the new value of filter memory and the value that will be sent to the output registers.
The IIR filter can be configured to different filter coefficients, which slows down the response to the sensor inputs. Note that
the response time with enabled IIR filter depends on the number of samples generated, which means that the data output
rate must be known to calculate the actual response time.
When writing to the register filter, the filter is reset. The next ADC values will pass through the filter unchanged and become
the initial memory values for the filter. If temperature or pressure measurements are skipped, the corresponding filter memory
will be kept unchanged even though the output registers are set to 0x80000. When the previously skipped measurement is
re-enabled, the output will be filtered using the filter memory from the last time when the measurement was not skipped. If
this is not desired, please write to the filter register in order to re-initialize the filter.
3.3.5 Gas sensor heating and measurement
The operation of the gas sensing part of BME680 involves two steps:
1. Heating the gas sensor hot plate to a target temperature (typically between 200 °C and 400 °C) and keep that
temperature for a certain duration of time.
2. Measuring the resistance of the gas sensitive layer.
Up to 10 different hot plate temperature set points can be configured by setting the registers res_heat_x<7:0>, where x =
0…9 .The internal heater control loop operates on the resistance of the heater structure. Hence, the user first needs to
convert the target temperature into a device specific target resistance before writing the resulting register code into the sensor
memory map.
The following code will calculate register code that to be written to res_heat_x<7:0>. Nevertheless, it is recommended to use
the sensor API available on github (Chapter 4) for a friendlier user experience.
var1 = ((double)par_g1 / 16.0) + 49.0;
var2 = (((double)par_g2 / 32768.0) * 0.0005) + 0.00235;
var3 = (double)par_g3 / 1024.0;
var4 = var1 * (1.0 + (var2 * (double) target_temp));
var5 = var4 + (var3 * (double)amb_temp);
res_heat_x = (uint8_t)(3.4 * ((var5 * (4.0 / (4.0 + (double)res_heat_range)) * (1.0/(1.0 +
((double)res_heat_val * 0.002)))) - 25));
where
par_g1, par_g2, and par_g3 are calibration parameters,
target_temp is the target heater temperature in degree Celsius,
amb_temp is the ambient temperature (hardcoded or read from temperature sensor),
var5 is the target heater resistance in Ohm,
res_heat_x is the decimal value that needs to be stored in register, where ‘x’ corresponds to the temperature profile
number between 0 and 9,
res_heat_range is the heater range stored in register address 0x02 <5:4>, and
res_heat_val is the heater resistance correction factor stored in register address 0x00 (signed, value from -128 to
127).