Professional Documents
Culture Documents
Introduction:
In this project am going to Interface BMP180 Sensor with Arduino to measure Altitude, Pressure
& Temperature using Arduino. The project is about the barometric sensor BMP180 for Altitude,
Pressure & Temperature Measurement using Arduino. The BMP180 Sensor is a barometric
sensor capable of measuring pressure, temperature & altitude as well.
With Arduino, a 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).
Bill of Materials
S.N. Components Name Quantity Purchase Links
1 Arduino UNO Board 1 Nerokas solutions
2 BMP180 Sensor 1 Nerokas solutions
4 16X2 LCD Display 1 Nerokas solutions
5 Connecting Wires 8 Nerokas solutions
6 Breadboard 1 Nerokas solutions
Here I will Interface BMP180 Sensor with Arduino. I will use an Arduino board to read the
temperature and barometric pressure measurements from the BMP180 sensor and display the
data on the 16*2 LCD.
Pin Details:
1. Vin – +5V DC
2. GND – GND
3. SCL – I2C Interface
4. SDA – I2C Interface
Working of BMP180:
The BMP180 consists of a piezo-resistive sensor, an analog to digital converter and a control unit
with E2PROM and a serial I2C interface. The BMP180 delivers the uncompensated value of
pressure and temperature. The microcontroller sends a start sequence to start a pressure or
temperature measurement. After converting time, the result value (pressure or temperature
respectively) can be read via the I2C interface.
This project BMP180 for Altitude, Pressure & Temperature Measurement using Arduino can be
explained via program functions and variables.
Like most pressure sensors, the BMP180 measures absolute pressure. This is the actual ambient
pressure seen by the device, which will vary with both altitude and weather. Before taking a
pressure reading you must take a temperature reading. This is done with startTemperature() and
getTemperature(). The result is in degrees C. Once you have a temperature reading, you can take
a pressure reading. This is done with startPressure() and getPressure(). The result is in millibar
(mb) aka hectopascals (hPa).
If you’ll be monitoring weather patterns, you will probably want to remove the effects of
altitude. This will produce readings that can be compared to the published pressure readings
from other locations. To do this, use the sealevel() function. You will need to provide the known
altitude at which the pressure was measured.
If you want to measure altitude, you will need to know the pressure at a baseline altitude. This
can be average sealevel pressure, or a previous pressure reading at your altitude, in which case
subsequent altitude readings will be + or – the initial baseline. This is done with the altitude()
function.
For calculating temperature in °C and pressure in hPa (hecto Pascal), the calibration data has to
be used. These constants can be read out from the BMP180 E2PROM via the I2C interface at
software initialization. The sampling rate can be increased up to 128 samples per second
(standard mode) for dynamic measurement. In this case, it is sufficient to measure the
temperature only once per second and to use this value for all pressure measurements during the
same period.
Since pressure varies with altitude, you can use a pressure sensor to measure altitude (with a few
caveats). The average pressure of the atmosphere at sea level is 1013.25 hPa (or mbar). This
drops off to zero as you climb towards the vacuum of space. Because the curve of this drop-off is
well understood, you can compute the altitude difference between two pressure measurements (p
and p0) by using this equation:
Program/Source Code:
#include <SFE_BMP180.h>
#include <Wire.h>
#include <LiquidCrystal_I2C.h>
// Initialize the BMP180 Pressure Sensor
SFE_BMP180 pressure;
// Initialize the LCD. Assuming the I2C address of the LCD is 0x27.
// If your LCD has a different address, change it accordingly.
LiquidCrystal_I2C lcd(0x27, 16, 2);
void setup() {
Serial.begin(9600);
Serial.println("REBOOT");
void loop() {
char status;
double T, P, p0, a;
2. Weather: You should also remember that pressure changes due to weather will affect
your altitude readings. The best accuracy will be obtained if you take a “fresh” p0 when
you need it and don’t rely on it to be accurate for extended periods due to changes in
the weather.
3. Maximum altitude: The BMP180 can’t measure all the way down to vacuum (or up to
space). It’s advertised lower limit is about 300 hPa (or mbar), which corresponds to an
altitude of about 3000m or 30,000 feet. People have flown these to higher altitudes and
gotten useful results, but this isn’t guaranteed or likely to be accurate. (You might
consider using GPS for high-altitude measurements).
4. Minimum altitude: Similarly, this sensor isn’t suited for large pressures either. The
advertised upper limit is 1100 hPa=mbar (or 16 psi), which is about 500 feet below sea
level (that’s in air – the BMP180 isn’t submersible in water). This sensor isn’t a good
choice for submersible or compressed-gas measurements.
SFE_BMP180 pressure;
void setup()
{
Serial.begin(9600);
Serial.println("REBOOT");
if (pressure.begin())
Serial.println("BMP180 init success");
else
{
// Oops, something went wrong, this is usually a connection problem,
// see the comments at the top of this sketch for the proper connections.
void loop()
{
char status;
double T,P,p0,a;
Serial.println();
Serial.print("provided altitude: ");
Serial.print(ALTITUDE,0);
Serial.print(" meters, ");
Serial.print(ALTITUDE*3.28084,0);
Serial.println(" feet");
// If you want to measure altitude, and not pressure, you will instead need
// to provide a known baseline pressure. This is shown at the end of the
sketch.
status = pressure.startTemperature();
if (status != 0)
{
// Wait for the measurement to complete:
delay(status);
status = pressure.getTemperature(T);
if (status != 0)
{
// Print out the measurement:
Serial.print("temperature: ");
Serial.print(T,2);
Serial.print(" deg C, ");
Serial.print((9.0/5.0)*T+32.0,2);
Serial.println(" deg F");
status = pressure.startPressure(3);
if (status != 0)
{
// Wait for the measurement to complete:
delay(status);
status = pressure.getPressure(P,T);
if (status != 0)
{
// Print out the measurement:
Serial.print("absolute pressure: ");
Serial.print(P,2);
Serial.print(" mb, ");
Serial.print(P*0.0295333727,2);
Serial.println(" inHg");
// On the other hand, if you want to determine your altitude from the
pressure reading,
// use the altitude function along with a baseline pressure (sea-level
or other).
// Parameters: P = absolute pressure in mb, p0 = baseline pressure in
mb.
// Result: a = altitude in m.
a = pressure.altitude(P,p0);
Serial.print("computed altitude: ");
Serial.print(a,0);
Serial.print(" meters, ");
Serial.print(a*3.28084,0);
Serial.println(" feet");
}
else Serial.println("error retrieving pressure measurement\n");
}
else Serial.println("error starting pressure measurement\n");
}
else Serial.println("error retrieving temperature measurement\n");
}
else Serial.println("error starting temperature measurement\n");