Skip to content
This repository has been archived by the owner on Dec 1, 2021. It is now read-only.

micropython-bmp180 is a module for esp8266 micropython which provides a class for the BMP180 pressure sensor

License

Notifications You must be signed in to change notification settings

spirkaa/micropython-bmp180

 
 

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

74 Commits
 
 
 
 
 
 
 
 
 
 

Repository files navigation

micropython-bmp180

Module bmp180

bmp180 is a esp8266 micropython module for the Bosch BMP180 sensor. It measures temperature as well as pressure, with a high enough resolution to calculate altitude.
Breakoutboard: http://www.adafruit.com/products/1603
data-sheet: http://ae-bst.resource.bosch.com/media/products/dokumente/bmp180/BST-BMP180-DS000-09.pdf

If you have any questions, open an issue.

Quickstart

Example:

from machine import Pin, I2C
from bmp180 import BMP180

i2c = I2C(scl=Pin(5), sda=Pin(4))
bmp180 = BMP180(i2c)
bmp180.oversample_sett = 2
bmp180.baseline = 101325

temp = bmp180.temperature
p = bmp180.pressure
altitude = bmp180.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.

Classes

BMP180
Module for the BMP180 pressure sensor.
UML diagramm

Methods

compvaldump() Returns a list of all compensation values.

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

temperature
Nonblocking read of temperature in degree C.

pressure
Nonblocking read of pressure in Pascal (divide result by 100 for millibar/hP).

blocking_read()
Trigger a read and wait until data is available.

altitude
Altitude in m.

Instance variables

chip_id
ID of chip is hardcoded on the sensor.

oversample_sett
Sets the accuracy. Default: 0

  • 0 lowest accuracy, fastest
  • 1
  • 2
  • 3 highest accuracy, slowest

baseline
Pressure at Main Sea Level. The default is 101325 Pa, but you can use your local QNH in Pa.
To get different altitudes, use this as baselines:

altitude baseline
absolute local pressure
true QNH*100
pressure 101325 or None

About

micropython-bmp180 is a module for esp8266 micropython which provides a class for the BMP180 pressure sensor

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages

  • Python 100.0%