Skip to content
Switch branches/tags

Latest commit


Git stats


Failed to load latest commit information.
Latest commit message
Commit time

micropython Module for the BMP180 and BMP085 sensors is a pycom micropython module for the Bosch BMP085/BMP180 sensor. It measures temperature as well as pressure, with a high enough resolution to calculate altitude.
Boards: Pycom modules and similar, like ESP8266, generic ESP32 modules. It may be that the I2C access has to be adapted for non-Pycom modules.


This module is based on an 2014 implementation by Sebastian Plamauer, for the esp8266. I have adapted it to the Pycom modules. The details of the change are listed in the source code.


bmp = BMP180(i2c=None)

Class for the BMP180 pressure sensor. The I2C bus to be used must be supplied with i2c.

bmp = BMP085(i2c=None)

Class for the BMP085 pressure sensor. The I2C bus to be used must be supplied with i2c.

The two classes differ only by their name.


compval = bmp.compvaldump()

Returns a list of all compensation values.


Generator refreshing the measurements. Does not need to be called manually.


Trigger a read and wait until data is available.


temperature = bmp.temperature

Nonblocking read of temperature in degree C.

pressure = bmp.pressure

Nonblocking read of pressure in hPa.

altitude = bmp.altitude

Altitude in m. The altitude is calculated based on the value given to the property sealevel (see below). Obviously, this value does not have to be the sealevel pressure, but any pressure you may select, for instance to measure altitude difference in general.

bmp.sealevel = sealevel

sealevel = bmp.sealevel

Setting and getting the pressure for altitude calculation.
The default is 1013.25 hPa, but you can use your local QNH in hPa, or set a local pressure to determine altitude difference.

bmp.oversample = value

value = bmp.oversample

Setting and getting the oversample setting. The default is 0

Mode Setting Samples Conversion Time (ms)
low power 0 1 4.5
standard 1 2 7.5
high res 2 4 13.5
ultra high res 3 4 25.5

Instance variables


ID of chip is hard coded on the sensor.


# this example assumes the default connection for the I2C Obviously
# at P9 = sda and P10 = scl
from machine import Pin, I2C
from bmp085 import BMP180

i2c = I2C()
bmp = BMP180(i2c)
bmp.oversample = 2
bmp.sealevel = 101325

temp = bmp.temperature
p = bmp.pressure
altitude = bmp.altitude
print(temp, p, altitude)

Important Notice:
Make sure to either use this in fast loops or call gauge() in fast loops to make sure to always get current values. If you call pressure() once and then again 10 seconds later, it will report a 10 seconds old value. Look at the gauge() function in the source to understand this. Alternatively use the blocking_read() method.


Micropython module for the BMP085 and BMP180 sensors



No releases published


No packages published