barometric pressure sensor BMP085 - デジタル気圧センサー

barometric pressure sensor BMP085

デジタル気圧センサー BMP085 (Bosch Sensortec) を I2C で接続します。

Weatherduinoのプログラムを流用し、I2Cの部分をmbed用に書き換えました。

http://blog.galileo-7.com/images/mbed_bmp085.jpg http://www.bosch-sensortec.com/content/language2/img_productworlds/bmp_085_ts.jpg

Schematic

blockdiagram

	+--------+
	|        |3.3V---+-+--+
	|        |       | |  |       BMP085
	|        |       R R  |      +------+
	|        |       | |  +---VDD|3,4   |
	|  mbed  |SCK----+-|------SCK|6    8|XCLR
	|        |SDA------+------SDA|7     |
	|        |            +---GND|1    2|EOC
	|        |            |      +------+
	|        |            |
	|        |GND---------+       R=2.2kΩ x 2
	+--------+

Library

Import libraryBMP085

barometric pressure sensor BMP085 http://mbed.org/users/okini3939/notebook/barometric-pressure-sensor-bmp085/ http://mbed.org/users/okini3939/notebook/weatherduino-on-mbed/

Import library

Public Member Functions

  BMP085 (PinName p_sda, PinName p_scl, BMP085_oss p_oss=BMP085_oss1)
  Initializes interface (private I2C)
  BMP085 (I2C &p_i2c, BMP085_oss p_oss=BMP085_oss1)
  Initializes interface (public I2C)
float  get_temperature ()
  Get temperature.
float  get_pressure ()
  Get pressure.
void  update ()
  Update results.

Sample

#include "mbed.h"
#include "BMP085.h"

BMP085 bmp085(p9, p10);

DigitalOut myled(LED1);
Serial pc(USBTX, USBRX);

int main() {
    float p, t;

    while(1) {
        myled = 1;

        bmp085.update();
        p = bmp085.get_pressure();
        t = bmp085.get_temperature();
        pc.printf("p:%6.2f hPa / t:%6.2f C\n", p, t);

        myled = 0;
        wait(3);
    }
}

Import programbmp085_lib

barometric pressure sensor BMP085 http://mbed.org/users/okini3939/notebook/barometric-pressure-sensor-bmp085/ http://mbed.org/users/okini3939/notebook/weatherduino-on-mbed/

I2Cを他と共用する場合

  :
I2C i2c(p9, p10);
BMP085 bmp085(i2c);
  :

サンプリング回数を指定する場合

BMP085_oss1,2,4,8

  :
BMP085 bmp085(p9, p10, BMP085_oss4);
  or
BMP085 bmp085(i2c, BMP085_oss4);
  :


21 Sep 2010

Tested it... works great!!! Thanks.

08 Apr 2011

Also tested, seems to work perfectly.

Thanks  h. suga

2 comments on barometric pressure sensor BMP085 - デジタル気圧センサー:

05 Mar 2013

It's not wokring for me. My program stops when I add the line "BMP085 bmp085(p9, p10);". Maybe you already have a solution, but I cant read Japanese

14 Feb 2017

Hi, I am sorry about you disturb.

I tried to use your code but the results that is not waited. "p:409.84 hPa / t: 12.80 C" These values are not the good ones and they do not vary.

Can use me to understand the problem?

Thank you very much

Please log in to post comments.