BMP180 Module¶
This module contains the driver for BOSCH BMP180 Digital Barometric Pressure Sensor. The ultra-low power, low voltage electronics of the BMP180 is optimized for use in mobile devices and the I2C interface allows for easy system integration with a microcontroller. The BMP180 is based on piezo-resistive technology for EMC robustness, high accuracy and linearity as well as long term stability (datasheet).
class BMP180(i2cdrv,addr=0x77,clk=100000)
Creates an instance of a new BMP180.
Arguments:
- i2cdrv – I2C Bus used ‘( I2C0, … )’
- addr – Slave address, default 0x77
- clk – Clock speed, default 100kHz
Example:
from bosch.bmp180 import bmp180
...
bmp = bmp180.BMP180(I2C0)
bmp.start()
bmp.init()
temp, pres = bmp.get_temp_pres()
init(oss=0)
Initialize the BMP180 calibrating the sensor and setting the oss value.
Arguments:
- oss – OverSampling Setting value (from 0 to 4), default 0
set_over_sampling_setting(oss)
Sets the OverSampling Setting value of the BMP180.
Arguments:
- oss – OverSampling Setting value (from 0 to 4 allowed)
Note
The OverSampling Setting parameter selects different operating modes according to give the possibility for findind the optimum compromise between power consumption, speed, and resolution; in the table below allowed values are reported with related operating modes.
OSS param | Operating Mode | N of samples | Conversion time | Avg Current 1 sample/s |
---|---|---|---|---|
0 | Ultra Low Power | 1 | 4.5 ms | 3 uA |
1 | Standard | 2 | 7.5 ms | 5 uA |
2 | High Resolution | 4 | 13.5 ms | 7 uA |
3 | Ultra High Resolution | 8 | 25.5 ms | 12 uA |
get_raw_temp()
Retrieves the current temperature data from the sensor as raw value.
Returns raw_t.
get_raw_pres()
Retrieves the current pressure data from the sensor as raw value; according to the OverSampling Setting value this measure can be faster but less accurate or more precise but slower. (see set_over_sampling_setting()
)
Returns raw_p.
get_temp()
Retrieves the current temperature data from the sensor as calibrate value in °C.
Returns temp.
get_pres()
Retrieves the current pressure data from the sensor as calibrate value in Pa; according to the OverSampling Setting value this measure can be faster but less accurate or more precise but slower. (see set_over_sampling_setting()
)
Returns pres.
get_temp_pres()
Retrieves the current temperature (in °C) and pressure (in Pa) data from the sensor as calibrate values in one call.
Returns temp.
get_altitude()
Calculates, from measured pressure, the current altitude data as value in meters.
Returns altitude.
get_sea_level_pres()
Calculates, from measured pressure, the pressure (in Pa) at sea level when given a known altitude in meters.
Returns p0 (pressure at sea level).