How to Measure Air Pressure and Altitude with Arduino and BMP180 Barometer

Introduction

Welcome to the world of Arduino and atmospheric sensing! In this guide, we’ll learn the process of How to Measure Air Pressure and Altitude with Arduino and BMP180 Barometer sensor. The BMP180 sensor provides a convenient and accurate way to monitor atmospheric pressure and determine altitude changes. Whether you’re monitoring weather patterns, tracking altitude variations, or building a drone altitude hold system, the BMP180 sensor offers versatile applications in environmental sensing. Let’s explore the details of the BMP180 sensor and discover how to integrate it with Arduino for atmospheric measurements.

Hardware Required

You will require the following Hardware Components for How to Interfacing the BMP180 Barometer sensor Module with Arduino.

Components#Buy From Amazon
Arduino UNO1Buy Link
BMP180 Sensor1Buy Link
BMP085 Sensor1Buy Link
9v DC Adapter (Optional)1Buy Link
Jumper Wires4Buy Link
Breadboard1Buy Link

What is the BMP180 Sensor?

The BMP180 is a digital thermometer and barometer that measures air pressure and can function as an altimeter when connected to devices like Arduino. It relies on the weight of the air column in the atmosphere to determine barometric pressure, affected by factors like temperature, humidity, and wind.

While barometric pressure doesn’t offer precise absolute altitude measurements due to continuous weather variations, it’s useful for relative altitude measurements like elevation differences.

With a measurement range from 300hPa to 1110hPa (equivalent to -500m to 9000m above sea level), the BMP180 provides high precision (1.0 hPa absolute, 0.12 hPa relative) and low power consumption (0.1µA in standby, 650µA during measurement).

Communication occurs via the I2C bus, facilitating data retrieval, and the module is often integrated into modules like the GY-68, with built-in voltage regulation for easy Arduino connectivity.

Widely used in meteorological applications, the BMP180 is also employed in aerial vehicles like airplanes and quadcopters, as well as applications requiring vertical displacement speed measurement.

Pinout

BMP180-BMP085-Barometer-Pressure-Sensor-Modules

Pin Configuration

Pin NumberPin NameDescription
1VccPower supply voltage input (3.3V or 5V)
2GNDGround
3SCLSerial Clock (I2C)
4SDASerial Data (I2C)
5XCLRExternal Clear Input (Optional)
6EOCEnd of Conversion Output

Features

  1. High Precision Pressure Sensing: Provides accurate measurement of atmospheric pressure with high resolution.
  2. Temperature Compensation: Includes built-in temperature sensor for temperature compensation, ensuring accurate pressure readings over a wide temperature range.
  3. Low Power Consumption: Designed for low power operation, making it suitable for battery-powered applications.
  4. Digital Output: Furnishes digital output data for easy integration with microcontrollers like Arduino.
  5. Calibration Support: Includes factory-calibrated coefficients for pressure and temperature compensation, eliminating the need for user calibration.

Specifications

  1. Pressure Measurement Range:
    • 300 to 1100 hPa (hectopascals).
  2. Pressure Resolution:
    • 0.01 hPa (high resolution mode).
  3. Temperature Measurement Range:
    • -40°C to +85°C.
  4. Temperature Resolution:
    • 0.1°C.
  5. Communication Interface:
    • I2C (Inter-Integrated Circuit) interface for communication with Arduino.
    • Operating voltage: 1.8V to 3.6V.

Circuit Diagram

The following circuit shows you the connection of the How to Measure Air Pressure and Altitude with Arduino and BMP180 Barometer, Please make the connection carefully

Measure-air-pressure-and-altitude-with-Arduino-and-BMP180-barometer-Sensor-Circuit

Circuit Connections

ArduinoBMP180 Sensor
+5VVCC Pin
GNDGND Pin
A4SDA
A5SCL

Installing Arduino IDE Software

First, you will require to Download the updated version of Arduino IDE Software and Install it on your PC or laptop. if you Learn How to install the Arduino step-by-step guide then click on how to install Arduino Button given Blow

Installing Libraries

Now when you are Ready to upload the code, to the Arduino Board you will need first to add the Following Libraries in Arduino, If you Learn How to add the library in the Arduino step-by-step guide click on how to install the library Button given Blow

Code Examples

Get pressure and temperature values

The initial example retrieves raw pressure and temperature measurements and displays them on the screen. These values are valuable, for instance, in creating a weather station.

//For more Projects: www.arduinocircuit.com

#include <SFE_BMP180.h>
#include <Wire.h>

SFE_BMP180 bmp180;

void setup()
{
  Serial.begin(9600);

  if (bmp180.begin())
    Serial.println("BMP180 started");
  else
  {
    Serial.println("Error starting BMP180");
    while(1); // Infinite loop
  }
}

void loop()
{
  charstatus;
  double T,P;

  status = bmp180.startTemperature(); //Start temperature reading
  if (status != 0)
  {
    delay(status); //Pause for reading to finish
    status = bmp180.getTemperature(T); //Get the temperature
    if (status != 0)
    {
      status = bmp180.startPressure(3); //Start pressure reading
      if (status != 0)
      {
        delay(status); //Pause for reading to finish
        status = bmp180.getPressure(P,T); //We get the pressure
        if (status != 0)
        {
          Serial.print("Temperature: ");
          Serial.print(T,2);
          Serial.print(" *C , ");
          Serial.print("Pressure: ");
          Serial.print(P,2);
          Serial.println("mb");
        }
      }
    }
  }
  delay(1000);
}

Estimate the Altitude of the Sea

In the following example, we estimate the altitude relative to sea level. We achieve this by utilizing the standard pressure at sea level as a reference value.

//For more Projects: www.arduinocircuit.com

#include <SFE_BMP180.h>
#include <Wire.h>

SFE_BMP180 bmp180;

double SeaLevelPressure = 1013.25; //pressure above sea level in mbar

void setup()
{
  Serial.begin(9600);

  if (bmp180.begin())
    Serial.println("BMP180 started");
  else
  {
    Serial.println("Error starting BMP180");
    while(1);
  }
}

void loop()
{
  charstatus;
  double T,P,A;
  
  status = bmp180.startTemperature(); //Start temperature reading
  if (status != 0)
  {
    delay(status); //Pause for reading to finish
    status = bmp180.getTemperature(T); //Get the temperature
    if (status != 0)
    {
      status = bmp180.startPressure(3); //Start pressure reading
      if (status != 0)
      {
        delay(status); //Pause for reading to finish
        status = bmp180.getPressure(P,T); //Get the pressure
        if (status != 0)
        {
          Serial.print("Temperature: ");
          Serial.print(T);
          Serial.print(" *C , ");
          Serial.print("Pressure: ");
          Serial.print(P);
          Serial.print(" mb , ");
          
          A= bmp180.altitude(P,SeaLevelPressure); //Calculate height
          Serial.print("Altitude: ");
          Serial.print(A);
          Serial.println(" m");
        }
      }
    }
  }
  delay(1000);
}

Estimate the Height Difference Between two Points

In the final example, we calculate the difference in altitude between two points. We accomplish this by measuring the variance in elevation between two pressure points. Instead of using sea level as the reference point, we establish the first point as the reference.

//For more Projects: www.arduinocircuit.com

#include <SFE_BMP180.h>
#include <Wire.h>

SFE_BMP180 bmp180;

double Po; //pressure of the initial point for h=0;
charstatus;
double T,P,A;
void setup()
{
  Serial.begin(9600);

  if (bmp180.begin())
  {
    Serial.println("BMP180 started");
    status = bmp180.startTemperature(); //Start temperature reading
    if (status != 0)
    {
      delay(status); //Pause for reading to finish
      status = bmp180.getTemperature(T);//Get the temperature
      if (status != 0)
      {
        status = bmp180.startPressure(3); //Start pressure reading
        if (status != 0)
        {
          delay(status); //Pause for reading to finish
          status = bmp180.getPressure(P,T); //Get the pressure
          if (status != 0)
          {
            Po=P; //We assign the pressure value as a reference point
            Serial.println("Set reference point: h=0");
          }
        }
      }
    }
    
  }
  else
  {
    Serial.println("Error starting BMP180");
    while(1);
  }
}

void loop()
{
  status = bmp180.startTemperature(); //Start temperature reading
  if (status != 0)
  {
    delay(status); //Pause for reading to finish
    status = bmp180.getTemperature(T); //Get the temperature
    if (status != 0)
    {
      status = bmp180.startPressure(3); //Start pressure reading
      if (status != 0)
      {
        delay(status); //Pause for reading to finish
        status = bmp180.getPressure(P,T); //Get the pressure
        if (status != 0)
        {
          A= bmp180.altitude(P,Po); //Calculate height with respect to the reference point
          Serial.print("h=");
          Serial.print(A);
          Serial.println(" m");
        }
      }
    }
  }
  delay(1000);
}

Applications

  1. Weather Monitoring: Use the BMP180 sensor for weather monitoring applications to measure atmospheric pressure and temperature, enabling real-time weather data collection and analysis.
  2. Altitude Tracking: Implement altitude tracking systems using the BMP180 sensor to measure changes in altitude for applications such as altitude hold systems in drones, altitude logging in GPS devices, and elevation profiling in outdoor activities.
  3. Indoor Environment Monitoring: Integrate the BMP180 sensor into indoor environment monitoring systems to measure indoor air pressure and temperature, facilitating applications such as HVAC (Heating, Ventilation, and Air Conditioning) control and indoor air quality monitoring.
  4. Flight Control Systems: Utilize the BMP180 sensor in flight control systems for drones, UAVs (Unmanned Aerial Vehicles), and model aircraft to monitor altitude changes and adjust flight parameters accordingly for stable flight performance.
  5. Geographic Information Systems (GIS): Incorporate the BMP180 sensor into GIS applications for mapping, surveying, and geolocation services, providing accurate altitude measurements for terrain modeling and elevation mapping.

Conclusion

With its advanced features and versatile applications, the BMP180 barometer sensor offers endless possibilities for atmospheric sensing in Arduino projects. Whether you’re monitoring weather conditions, tracking altitude variations, controlling flight systems, or conducting environmental monitoring, the BMP180 provides accurate and reliable atmospheric data for enhanced functionality and performance. Let’s embark on the journey of measuring air pressure and altitude with Arduino and unlock the potential of atmospheric sensing in your projects!

Leave a Comment


error: