
6
5. Usage
5.1 With Arduino
Barometric condition is one of the criteria used to predict coming change in weather and deduce altitude
above sea level. Here is a demo to show you how to read the barometric data from this Grove -
Barometer Sensor (BMP180).
1. Connect it to IIC port of Seeeduino or Grove - Base Shield via a Grove cable. And connect Arduino to
PC via a USB cable.
2. Download the library(the barometer library is shared by Grove - Barometer Sensor (BMP180) and
Grove - Barometer Sensor(BMP085));Unzip it into the libraries file of Arduino IDE by the
path: ..\arduino-1.0.1\libraries.
3. Create a new Arduino sketch and paste the codes below to it or open the code directly by the path:
File -> Example ->Barometer_Sensor->Barometer_Sensor.
* Based largely on code by Jim Lindblom
* Get pressure, altitude, and temperature from the BMP085.
* Serial.print it out at 9600 baud to serial monitor.
*
* By:http://www.seeedstudio.com
*/
#include "Barometer.h"
#include <Wire.h>
float temperature;
float pressure;
float atm;
float altitude;
Barometer myBarometer;
void setup(){
Serial.begin(9600);
myBarometer.init();
}
void loop()
{
temperature =myBarometer.bmp085GetTemperature(myBarometer.bmp085ReadUT()); //Get the
temperature, bmp085ReadUT MUST be called first
pressure =myBarometer.bmp085GetPressure(myBarometer.bmp085ReadUP());//Get the temperature
altitude =myBarometer.calcAltitude(pressure); //Uncompensated calculation - in Meters
atm =pressure /101325;