
Specification
- Pressure sensing range: 300-1100 hPa (9000m to -500m above sea level)
- Up to 0.03hPa / 0.25m resolution
- -40 to +85°C operational range, +-2°C temperature accuracy
Wiring
Make the following connections
- GND <-> GND
- 3V3 <-> VIN (or 3Vo)
- D1 <-> SCL
- D2 <-> SDA
ライブラリの追加
“Adafruit Unified Sensor”ライブラリの追加
センサーをライブラリ追加
BMP180センサーを利用する
ライブラリからBMP085を検索して、追加してください
単体プログラム
ただシリアルモニタに表示するだけのプログラム
#include <Wire.h>
#include <Adafruit_BMP085.h>
Adafruit_BMP085 bmp;
void setup()
{
Serial.begin(9600);
//Wire.begin (4, 5);
if (!bmp.begin())
{
Serial.println("Could not find BMP180 or BMP085 sensor at 0x77");
while (1) {}
}
}
void loop()
{
Serial.print("Temperature = ");
Serial.print(bmp.readTemperature());
Serial.println(" Celsius");
Serial.print("Pressure = ");
Serial.print(bmp.readPressure());
Serial.println(" Pascal");
Serial.println();
delay(5000);
}
#include <Wire.h>
#include <Adafruit_BMP085.h>
Adafruit_BMP085 bmp;
void setup()
{
Serial.begin(9600);
//Wire.begin (4, 5);
if (!bmp.begin())
{
Serial.println("Could not find BMP180 or BMP085 sensor at 0x77");
while (1) {}
}
}
void loop()
{
Serial.print("Temperature = ");
Serial.print(bmp.readTemperature());
Serial.println(" Celsius");
Serial.print("Pressure = ");
Serial.print(bmp.readPressure());
Serial.println(" Pascal");
Serial.println();
delay(5000);
}
#include <Wire.h> #include <Adafruit_BMP085.h> Adafruit_BMP085 bmp; void setup() { Serial.begin(9600); //Wire.begin (4, 5); if (!bmp.begin()) { Serial.println("Could not find BMP180 or BMP085 sensor at 0x77"); while (1) {} } } void loop() { Serial.print("Temperature = "); Serial.print(bmp.readTemperature()); Serial.println(" Celsius"); Serial.print("Pressure = "); Serial.print(bmp.readPressure()); Serial.println(" Pascal"); Serial.println(); delay(5000); }
1602に表示するプログラム
/*
*
*/
#include <Wire.h>
#include <Adafruit_BMP085.h>
#include <LiquidCrystal_I2C.h>
Adafruit_BMP085 bmp;
// Set the LCD address to 0x27 for a 16 chars and 2 line display
LiquidCrystal_I2C lcd(0x27, 16, 2);
void setup()
{
lcd.begin(0,2); // sda=GPIO_0, scl=GPIO_2
lcd.init();
// Turn on the backlight.
lcd.backlight();
// Print a message to the LCD.
lcd.print("hello, world!");
if (!bmp.begin())
{
Serial.println("Could not find BMP180 or BMP085 sensor at 0x77");
while (1) {}
}
}
void loop()
{
lcd.setCursor(0, 0);
lcd.print("Temp = ");
lcd.print(bmp.readTemperature());
lcd.println(" Celsius");
// set the cursor to column 0, line 1
// (note: line 1 is the second row, since counting begins with 0):
lcd.setCursor(0, 1);
// print the number of seconds since reset:
lcd.print("Pres = ");
lcd.print(bmp.readPressure());
lcd.print(" Pascal ");
lcd.print(millis() / 1000);
}
/*
*
*/
#include <Wire.h>
#include <Adafruit_BMP085.h>
#include <LiquidCrystal_I2C.h>
Adafruit_BMP085 bmp;
// Set the LCD address to 0x27 for a 16 chars and 2 line display
LiquidCrystal_I2C lcd(0x27, 16, 2);
void setup()
{
lcd.begin(0,2); // sda=GPIO_0, scl=GPIO_2
lcd.init();
// Turn on the backlight.
lcd.backlight();
// Print a message to the LCD.
lcd.print("hello, world!");
if (!bmp.begin())
{
Serial.println("Could not find BMP180 or BMP085 sensor at 0x77");
while (1) {}
}
}
void loop()
{
lcd.setCursor(0, 0);
lcd.print("Temp = ");
lcd.print(bmp.readTemperature());
lcd.println(" Celsius");
// set the cursor to column 0, line 1
// (note: line 1 is the second row, since counting begins with 0):
lcd.setCursor(0, 1);
// print the number of seconds since reset:
lcd.print("Pres = ");
lcd.print(bmp.readPressure());
lcd.print(" Pascal ");
lcd.print(millis() / 1000);
}
/* * */ #include <Wire.h> #include <Adafruit_BMP085.h> #include <LiquidCrystal_I2C.h> Adafruit_BMP085 bmp; // Set the LCD address to 0x27 for a 16 chars and 2 line display LiquidCrystal_I2C lcd(0x27, 16, 2); void setup() { lcd.begin(0,2); // sda=GPIO_0, scl=GPIO_2 lcd.init(); // Turn on the backlight. lcd.backlight(); // Print a message to the LCD. lcd.print("hello, world!"); if (!bmp.begin()) { Serial.println("Could not find BMP180 or BMP085 sensor at 0x77"); while (1) {} } } void loop() { lcd.setCursor(0, 0); lcd.print("Temp = "); lcd.print(bmp.readTemperature()); lcd.println(" Celsius"); // set the cursor to column 0, line 1 // (note: line 1 is the second row, since counting begins with 0): lcd.setCursor(0, 1); // print the number of seconds since reset: lcd.print("Pres = "); lcd.print(bmp.readPressure()); lcd.print(" Pascal "); lcd.print(millis() / 1000); }
表示画面