|
| 1 | +# BME69X <!-- omit in toc --> |
| 2 | + |
| 3 | +- [Getting Started](#getting-started) |
| 4 | +- [Reading Data From The Sensor](#reading-data-from-the-sensor) |
| 5 | +- [Configuring The Sensor](#configuring-the-sensor) |
| 6 | + - [Filter Settings](#filter-settings) |
| 7 | + - [Oversampling Settings](#oversampling-settings) |
| 8 | + - [Mode Settings](#mode-settings) |
| 9 | + - [Standby/Output Data Rate Settings](#standbyoutput-data-rate-settings) |
| 10 | + - [Defaults](#defaults) |
| 11 | + |
| 12 | +## Getting Started |
| 13 | + |
| 14 | +Construct new `I2C` and `BreakoutBME69X` instances: |
| 15 | + |
| 16 | +```python |
| 17 | +from breakout_bme69x import BreakoutBME69X |
| 18 | + |
| 19 | +i2c = machine.I2C() |
| 20 | +bme = BreakoutBME69X(i2c) |
| 21 | +``` |
| 22 | + |
| 23 | +The default I2C address is `0x76`. If you've cut the trace to change the I2C address of the sensor, you can specify the alternate I2C address like this: |
| 24 | + |
| 25 | +``` python |
| 26 | +bme = BreakoutBME69X(i2c, 0x77) |
| 27 | +``` |
| 28 | + |
| 29 | +The `breakout_bme69x` module also includes constants for the possible I2C addresses: |
| 30 | + |
| 31 | +* `I2C_ADDRESS_DEFAULT` |
| 32 | +* `I2C_ADDRESS_ALT` |
| 33 | + |
| 34 | +## Reading Data From The Sensor |
| 35 | + |
| 36 | +The `read` method will return a tuple containing Temperature (degrees C), Pressure (Pa), relative humidity (%rH), and gas resistance (Ω) values, plus the status code and gas/measurement indexes: |
| 37 | + |
| 38 | +```python |
| 39 | +temperature, pressure, humidity, gas_resistance, status, gas_index, meas_index = bme.read() |
| 40 | +``` |
| 41 | + |
| 42 | +In all cases `gas_index` and `meas_index` will be zero, since these refer to the measurement profile used to gather the current readings. The MicroPython bindings currently only support a single measurement profile with a default of 300c for 100ms. |
| 43 | + |
| 44 | +You can pass a custom temperature and duration into `read`: |
| 45 | + |
| 46 | +```python |
| 47 | +temperature, pressure, humidity, gas_resistance, status, gas_index, meas_index = bme.read(heater_temp=250, heater_duration=50) |
| 48 | +``` |
| 49 | + |
| 50 | +## Configuring The Sensor |
| 51 | + |
| 52 | +The `configure` method allows you to set up the oversampling, filtering and operation mode. |
| 53 | + |
| 54 | +```python |
| 55 | +bme.configure(filter, standby_time, os_pressure, os_temp, os_humidity) |
| 56 | +``` |
| 57 | + |
| 58 | +The `breakout_bme69x` module includes constants for these: |
| 59 | + |
| 60 | +### Filter Settings |
| 61 | + |
| 62 | +* `FILTER_COEFF_OFF` |
| 63 | +* `FILTER_COEFF_1` |
| 64 | +* `FILTER_COEFF_3` |
| 65 | +* `FILTER_COEFF_8` |
| 66 | +* `FILTER_COEFF_15` |
| 67 | +* `FILTER_COEFF_31` |
| 68 | +* `FILTER_COEFF_63` |
| 69 | +* `FILTER_COEFF_127` |
| 70 | + |
| 71 | +### Oversampling Settings |
| 72 | + |
| 73 | +* `NO_OVERSAMPLING` |
| 74 | +* `OVERSAMPLING_1X` |
| 75 | +* `OVERSAMPLING_2X` |
| 76 | +* `OVERSAMPLING_4X` |
| 77 | +* `OVERSAMPLING_8X` |
| 78 | +* `OVERSAMPLING_16X` |
| 79 | + |
| 80 | +### Mode Settings |
| 81 | + |
| 82 | +* `SLEEP_MODE` |
| 83 | +* `FORCED_MODE` |
| 84 | +* `NORMAL_MODE` |
| 85 | + |
| 86 | +### Standby/Output Data Rate Settings |
| 87 | + |
| 88 | +* `STANDBY_TIME_0_59_MS` |
| 89 | +* `STANDBY_TIME_62_5_MS` |
| 90 | +* `STANDBY_TIME_125_MS` |
| 91 | +* `STANDBY_TIME_250_MS` |
| 92 | +* `STANDBY_TIME_500_MS` |
| 93 | +* `STANDBY_TIME_1000_MS` |
| 94 | +* `STANDBY_TIME_10_MS` |
| 95 | +* `STANDBY_TIME_20_MS` |
| 96 | + |
| 97 | +### Defaults |
| 98 | + |
| 99 | +```python |
| 100 | +bme.configure(FILTER_COEFF_3, STANDBY_TIME_1000_MS, OVERSAMPLING_16X, OVERSAMPLING_2X, OVERSAMPLING_1X) |
| 101 | +``` |
0 commit comments