CircuitPython BMP180 Library

bmp180 - Temperature & Barometric Pressure Sensor

CircuitPython driver from BMP180 Temperature and Barometric Pressure sensor

  • Author(s): BadTigrou, Jose D. Montoya

class bmp180.BMP180(i2c_bus: busio.I2C, address: int = 0x77)[source]

Driver for the BMP180 Sensor connected over I2C.

Parameters:
i2c_bus : I2C

The I2C bus the BMP180 is connected to.

address : int

The I2C device address. Defaults to 0x77

Raises:

RuntimeError – if the sensor is not found

Quickstart: Importing and using the device

Here is an example of using the BMP180 class. First you will need to import the libraries to use the sensor

import board
import bmp180

Once this is done you can define your board.I2C object and define your sensor object

i2c = board.I2C()  # uses board.SCL and board.SDA
bmp = bmp180.BMP180(i2c)

Now you have access to the attributes

press = bmp.pressure
temp = bmp.temperature
property temperature

The compensated temperature in Celsius. Calculation of true temperature in steps of 0.1°C.

property altitude

With the measured pressure p and the pressure at sea level p0 e.g. 1013.25hPa, the altitude in meters can be calculated with the international barometric formula

With the measured pressure p and the absolute altitude the pressure at sea level can be calculated too. See the altitude setter for this calculation

property pressure

The compensated pressure in hectoPascals. Calculation of true pressure in steps of 1Pa (= 0.01hPa = 0.01mbar)

property mode

Operation mode

Mode

Value

bmp180.MODE_ULTRALOWPOWER

0x00

bmp180.MODE_STANDARD

0x01

bmp180.MODE_HIGHRES

0x02

bmp180.MODE_ULTRAHIGHRES

0x03

Example

i2c = board.I2C()
qmc = bmp180.BMP180(i2c)


bmp180.mode = bmp180.MODE_HIGHRES
property oversampling_setting

Oversampling setting Allowed values are set in the OVERSAMPLES enum class