This module contains the Zerynth driver for Bosch BME280 digital environmental sensor. The unit combine high linearity and accuracy sensors for pressure, humidity and temperature and is designed for low current consumption, long term sability and high EMC robustness. The BME280 features I2C and SPI digital interfaces, the present library enables I2C only (datasheet).
Creates an intance of the BME280 class.
- drvname – I2C Bus used ‘( I2C0, … )’
- addr – Slave address, default 0x76
- clk – Clock speed, default 400kHz
Sensor’s calibration data are automatically read on object creation and setup method is called with default parameters. Temperature, humidity and pressure values can be easily obtained from the sensor:
from bosch.bme280 import bme280 ... bme = bme280.BME280(I2C0) temp, hum, pres = bme.get_values()
setup(mode = 3,os_t = 1,os_h = 1,os_p = 1,t_sb = 6,filter = 1)
This method sets the operating mode and the sampling parameters of the module.
mode: Control the operating mode. Sleep mode is entered by default after power on reset. In sleep mode, no measurement are performed and all registers are accessible. In normal mode the sensor cycles between an active measurement period and an inactive standby period. In forced mode a single measurement is performed in accordance to the selected measurement and filter options, after which the sensor enter in sleep mode.
|1 or 2||Forced Mode|
See pages 12-13 of the datasheet for more details on operating mode and allowed sensor mode transitions.
os_t: Oversampling setting for temperature sensor, see os_p for details on allowed values.
os_h: Oversampling setting for humidity sensor, see os_p for details on allowed values.
os_p: Oversampling setting for pressure sensor.
|0||Skipped (output set to 0)|
t_sb: Control the inactive duration t_standby in normal mode.
filter: Control the time constant of the internal IIR filter. It reduces the bandwidth of the temperature and pressure output signals and increases the resolution of the pressure and temperature output data to 20 bit.
Return the current temperature value in Celsius degree.
Return the current humidity value in %rH.
Return the current pressure value in Pascal.
Return a 3-element tuple containing current temperature, humidity and pressure values.
Reset the device using the complete power-on-reset procedure.
Return a two element long tuple representing the status of the sensor. The first element is equal to
1 whenever a conversion is running; it is equal to
0 when the results have been transferred to the data register. The second and last element of the returned tuple is euqal to
1 when the non-volatile memory data (calibration parameters) are being copied to image registers; it is equal to
0 when the copying is done. The data are copied at power-on-reset and before every conversion.
Return the device chip id as a single byte integer.