Adafruit makes a nice barometric pressure sensor (BMP180), but their tutorial is designed for the BMP085 and does not compile on Arduino 1.05
It has a built in temperature sensor, and we calculate our current altitude, which is not exact, and can fluctuate with the weather.
Here is how to make it work, and I’ve added a bunch of calculations for US units of measure. The 4 connections are in the code below. This is a 5v friendly board, and works with the UNO with no modifications.
You will need to download and install the BMP085 library that works with both the BMP085 and the BMP180 at https://github.com/adafruit/Adafruit-BMP085-Library
Become the Maker you were born to be. Try Arduino Academy for FREE!
I will be merging this sensor with our weather project at http://arduinotronics.blogspot.com/2013/12/temp-humidity-w-dew-point-calcualtions.html that serves up temp, humidity, dew point and heat index calculations.
#include <Wire.h>
#include <Adafruit_BMP085.h>
float Tc=0;
float Tf=0;
float Pa=0;
float InHg=0;
float Am=0;
float Af=0;
/***************************************************
This is an example for the BMP085 Barometric Pressure & Temp Sensor
Designed specifically to work with the Adafruit BMP085 Breakout
—-> https://www.adafruit.com/products/391
These displays use I2C to communicate, 2 pins are required to
interface
Adafruit invests time and resources providing this open source code,
please support Adafruit and open-source hardware by purchasing
products from Adafruit!
Written by Limor Fried/Ladyada for Adafruit Industries.
BSD license, all text above must be included in any redistribution
****************************************************/
//Modified by Steve Spence of http://arduinotronics.blogspot.com
// Connect VIN of the BMP180 sensor to 5.0V //Make sure you have a 5v sensor, otherwise use the 3.3v power pin on the Arduino
// Connect GND to Ground
// Connect SCL to A5 on Arduino Uno (pin 21 on the 2560)
// Connect SDA to A4 on Arduino Uno (pin 20 on the 2560)
Adafruit_BMP085 bmp;
void setup() {
Serial.begin(9600);
if (!bmp.begin()) {
Serial.println(“Could not find a valid BMP085/180 sensor, check wiring!”);
while (1) {}
}
}
void loop() {
Serial.print(“Temperature = “);
//Serial.print(bmp.readTemperature());
Tc=bmp.readTemperature();
Tf=((Tc*9)/5)+32;
Serial.print(Tf);
Serial.println(” *F”);
Serial.print(“Pressure = “);
//Serial.print(bmp.readPressure());
Pa=bmp.readPressure();
InHg=Pa*0.000295333727;
Serial.print(InHg);
Serial.println(” In Hg”);
// Calculate altitude assuming ‘standard’ barometric
// pressure of 1013.25 millibar = 101325 Pascal
Serial.print(“Altitude = “);
//Serial.print(bmp.readAltitude());
Am=bmp.readAltitude(101550); //adjusted for local altitude
Af=Am*3.28084;
Serial.print(Af);
Serial.println(” feet”);
// you can get a more precise measurement of altitude
// if you know the current sea level pressure which will
// vary with weather and such. If it is 1015 millibars
// that is equal to 101500 Pascals.
// Serial.print(“Real altitude = “);
// Serial.print(bmp.readAltitude(101500));
// Serial.println(” meters”);
Serial.println();
delay(1000);
}