Beaglebone and BMP180 example in python

The BMP180 is a digital barometric pressure sensor of Bosch Sensortec, with a very high performance, which enables applications in advanced mobile devices, such as smartphones, tablet PCs and sports devices. It follows the BMP085 and brings many improvements, like the smaller size and the expansion of digital interfaces.

The ultra-low power consumption down to 3 μA makes the BMP180 the leader in power saving for your mobile devices. BMP180 is also distinguished by its very stable behavior (performance) with regard to the independency of the supply voltage.

Parameter Technical data
Pressure range 300 … 1100 hPa
RMS noise expressed in pressure 0.06 hPa, typ. (ultra low power mode)
0.02 hPa, typ. (ultra high resolution mode)
RMS noise expressed in altitude 0.5 m, typ. (ultra low power mode)
0.17 m, typ. (ultra high resolution mode)
Relative accuracy pressure
VDD = 3.3 V
950 … 1050 hPa/ ±0.12 hPa
@ 25 °C/ ±1.0 m
700 … 900 hPa/ ±0.12 hPa
25 … 40 °C/ ±1.0 m
Absolute accuracy
p = 300…1100hPa
(Temperature = 0…+65°C, VDD = 3.3. V)
Pressure: -4.0 … +2.0 hPa
Temperature: ±1 °C, typ.
Average current consumption (1 Hz data refresh rate)

Peak current

3 μA, typical (ultra-low power mode)
32 μA, typical (advanced mode)650 μA, typical
Stand-by current 1.62 … 3.6 V
Supply voltage VDDIO 1.62 … 3.6 V
Supply voltage VDD 1.8 … 3.6 V
Operation temp.
Range full accuracy”
-40 … +85 °C
0 … +65 °C
Pressure conv. Time 5 msec, typical (standard mode)

 

Parts Required

 

Name Link
Beaglebone Black BeagleBone Black TI AM3358 Cortex-A8 development BB-Black Rev.C
BMP180 module 1pcs GY-68 BMP180 Digital Barometric Pressure Sensor
Connecting wire Free shipping Dupont line 120pcs 20cm male to male + male to female and female to female jumper wire

 

Schematic/Connection

beaglebone and bmp180
beaglebone and bmp180

Code Example

I used the Adafruit library from https://github.com/adafruit/Adafruit_Python_BMP

To install, download the library by clicking the download zip link to the right and unzip the archive somewhere on your Raspberry Pi or Beaglebone Black. Then execute the following command in the directory of the library

sudo python setup.py install

This is the simpletest.py example. I changed the busnum to 2

[codesyntax lang=”python”]

#!/usr/bin/python
# Copyright (c) 2014 Adafruit Industries
# Author: Tony DiCola

# Can enable debug output by uncommenting:
#import logging
#logging.basicConfig(level=logging.DEBUG)

import Adafruit_BMP.BMP085 as BMP085

# Default constructor will pick a default I2C bus.
#
# For the Raspberry Pi this means you should hook up to the only exposed I2C bus
# from the main GPIO header and the library will figure out the bus number based
# on the Pi’s revision.
#
# For the Beaglebone Black the library will assume bus 1 by default, which is
# exposed with SCL = P9_19 and SDA = P9_20.
#sensor = BMP085.BMP085()

# Optionally you can override the bus number:
sensor = BMP085.BMP085(busnum=2)

# You can also optionally change the BMP085 mode to one of BMP085_ULTRALOWPOWER,
# BMP085_STANDARD, BMP085_HIGHRES, or BMP085_ULTRAHIGHRES. See the BMP085
# datasheet for more details on the meanings of each mode (accuracy and power
# consumption are primarily the differences). The default mode is STANDARD.
#sensor = BMP085.BMP085(mode=BMP085.BMP085_ULTRAHIGHRES)

print(‘Temp = {0:0.2f} *C’.format(sensor.read_temperature()))
print(‘Pressure = {0:0.2f} Pa’.format(sensor.read_pressure()))
print(‘Altitude = {0:0.2f} m’.format(sensor.read_altitude()))
print(‘Sealevel Pressure = {0:0.2f} Pa’.format(sensor.read_sealevel_pressure()))

[/codesyntax]

 

Output

Click on run in Cloud 9 IDE, I saw this in the terminal window

Your code is running at http://localhost.
Important: use os.getenv(PORT, 8080) as the port and os.getenv(IP, 0.0.0.0) as the host in your scripts!

Temp = 22.80 *C
Pressure = 99204.00 Pa
Altitude = 177.59 m
Sealevel Pressure = 99207.00 Pa

LEAVE A REPLY

Please enter your comment!
Please enter your name here