|
|
||
|---|---|---|
| .. | ||
| README.md | ||
| demo_bme690.py | ||
README.md
BME69X
Getting Started
Construct new I2C and BreakoutBME69X instances:
from breakout_bme69x import BreakoutBME69X
i2c = machine.I2C()
bme = BreakoutBME69X(i2c)
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:
bme = BreakoutBME69X(i2c, 0x77)
The breakout_bme69x module also includes constants for the possible I2C addresses:
I2C_ADDRESS_DEFAULTI2C_ADDRESS_ALT
Reading Data From The Sensor
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:
temperature, pressure, humidity, gas_resistance, status, gas_index, meas_index = bme.read()
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.
You can pass a custom temperature and duration into read:
temperature, pressure, humidity, gas_resistance, status, gas_index, meas_index = bme.read(heater_temp=250, heater_duration=50)
Configuring The Sensor
The configure method allows you to set up the oversampling, filtering and operation mode.
bme.configure(filter, standby_time, os_pressure, os_temp, os_humidity)
The breakout_bme69x module includes constants for these:
Filter Settings
FILTER_COEFF_OFFFILTER_COEFF_1FILTER_COEFF_3FILTER_COEFF_8FILTER_COEFF_15FILTER_COEFF_31FILTER_COEFF_63FILTER_COEFF_127
Oversampling Settings
NO_OVERSAMPLINGOVERSAMPLING_1XOVERSAMPLING_2XOVERSAMPLING_4XOVERSAMPLING_8XOVERSAMPLING_16X
Mode Settings
SLEEP_MODEFORCED_MODENORMAL_MODE
Standby/Output Data Rate Settings
STANDBY_TIME_0_59_MSSTANDBY_TIME_62_5_MSSTANDBY_TIME_125_MSSTANDBY_TIME_250_MSSTANDBY_TIME_500_MSSTANDBY_TIME_1000_MSSTANDBY_TIME_10_MSSTANDBY_TIME_20_MS
Defaults
bme.configure(FILTER_COEFF_3, STANDBY_TIME_1000_MS, OVERSAMPLING_16X, OVERSAMPLING_2X, OVERSAMPLING_1X)