# Sensing Barometric Pressure

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.

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>

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

These displays use I2C to communicate, 2 pins are required to
interface
Adafruit invests time and resources providing this open source code,

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)

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 = “);
Tf=((Tc*9)/5)+32;
Serial.print(Tf);
Serial.println(” *F”);

Serial.print(“Pressure = “);
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 = “);
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.println(” meters”);

Serial.println();
delay(1000);
}