Contents

Interfacing BMP180 Digital Barometric Pressure Sensor with Arduino

Overview

In many projects such as flying robots, weather stations, improving routing performance, sports etc. measuring pressure and altitude is very important. In this tutorial, you’ll learn how to use the BMP180 sensor, which is one of the most commonly used sensors for measuring the pressure.

 

What You Will Learn

What Is the Barometric Pressure?

Barometric pressure or atmospheric pressure results from the weight of the air on the earth. This pressure is about 1 kg per square centimeter at the sea level.

There are several units to express the atmospheric pressure, that can easily be converted to each other. The SI unit for measuring the pressure is Pascal (Pa).

Unit 1hPa equivalent
Pascal(Pa) 100
Atmosphere(atm) 0.000986923
Milibar(MBR) 1
Millimeters Mercury(mmHg) 0.750063755
Inch of Mercury(inHg) 0.02953
Torr(torr) 0.750061683
Pounds per square inch(psi) 0.014503774
Newtons per square meter(N/m^2) 100
The barometric pressure has an approximately linear inverse ratio with the altitude from the sea level so if we measure the barometric pressure of a place, we can calculate the altitude from the sea level using a simple mathematical operation.

BMP180 Barometric Pressure Module Features

BMP180 barometric pressure sensor can be used to measure atmospheric pressure. It can also measure temperature. The key features are:

  • Pressure range: 300 to 1100hPa
  • Capable of measuring temperature
  • Fully calibrated
  • Pressure measurement accuracy: 0.01hPa
  • Temperature measurement accuracy: 0.1°C
  • I2C communication protocol

Applications:

  • Mobile phones
  • PDA
  • GPS
  • Outdoor equipments
Note

Each hPa is equal to 100Pa.

BMP180 Barometric Pressure Module Pinout

This Module has 4 pins:

  • VIN: Module power supply
  • GND: Ground
  • SDA: I2C Data
  • SCL: I2C Clock

You can see the pinout of this module in the image below.

Required Material

Hardware component

Arduino UNO R3 × 1
GY-68 BMP180 Digital Barometric Pressure Sensor Module × 1
Male to Female jumper wire × 1

Software Apps

Arduino IDE

Interfacing BMP180 Barometric Pressure Module with Arduino

Step 1: Circuit

The following circuit show how you should connect Arduino to BMP180 sensor. Connect wires accordingly.

Step 2: Library

Go to Library manager and search for BMP085, install Adafruit_BMP085_Unified library.

Tip

If you need more help with installing a library on Arduino, read this tutorial: How to Install an Arduino Library

Step 3: Code

Upload the following code to your Arduino.

 /*
  GY-68-BMP180-Barometric-Pressure-Sensor-Module
  modified on 30 Dec 2020
  by Amir Mohammad Shojaee @ Electropeak
  
Home
Based on Adafruit Example */ #include <Wire.h> #include <Adafruit_Sensor.h> #include <Adafruit_BMP085_U.h> Adafruit_BMP085_Unified bmp = Adafruit_BMP085_Unified(10085); void setup(void) { Serial.begin(9600); Serial.println("Pressure Sensor Test"); Serial.println(""); /* Initialise the sensor */ if(!bmp.begin()) { /* There was a problem detecting the BMP085 ... check your connections */ Serial.print("Ooops, no BMP085 detected ... Check your wiring or I2C ADDR!"); while(1); } } void loop(void) { /* Get a new sensor event */ sensors_event_t event; bmp.getEvent(&event); /* Display the results (barometric pressure is measure in hPa) */ if (event.pressure) { /* Display atmospheric pressue in hPa */ Serial.print(" Pressure: "); Serial.print(event.pressure); Serial.println(" hPa"); float temperature; bmp.getTemperature(&temperature); Serial.print(" Temperature: "); Serial.print(temperature); Serial.println(" C"); /* Convert the atmospheric pressure, and SLP to altitude */ /* Update this next line with the current SLP for better results */ float seaLevelPressure = SENSORS_PRESSURE_SEALEVELHPA; Serial.print(" Altitude: "); Serial.print(bmp.pressureToAltitude(seaLevelPressure, event.pressure)); Serial.println(" m"); Serial.println(""); } else { Serial.println("Sensor error"); } delay(1000); }

At the beginning of program, the 3 needed libraries are included. Then, these parameters appear on Serial Monitor: pressure in hPa, temperature in degrees Celsius and altitude in meter. Altitude is calculated from measured atmospheric pressure.

The output is as follows. You see the three parameters: atmospheric pressure, temperature and altitude.

Liked What You See?​
Get Updates And Learn From The Best​

Leave a Reply

Your email address will not be published. Required fields are marked *