How to Interface BMP180 pressure sensor with Arduino

In many of the projects like Drones, weather stations, improving routing performance, sports, etc. Calculating pressure and altitude is very important. The BMP180 sensor is one of the most regularly used sensors for detecting pressure & Temperature.

 These sensors are very simple, pre-calibrated, and don’t need extra components, so you can start calculating barometric pressure, temperature, and altitude in a very small amount of time similarly BME280.

Working of sensor

The BMP180 is a piezoresistive sensor that checks pressure. Piezoresistive sensors are usually made up of a semiconducting material (usually silicon) that swaps resistance when a mechanical force like atmospheric pressure is put in. 

The BMP 180 measures both temperature And pressure, as the temperature changes the thickness of gasses like air. The air is not as compact and heavy at higher temperatures, so it puts less pressure on the sensor. At lower temperatures, the air is more compact and weighs more, putting more pressure on the sensor. The sensor uses real-time temperature calculations to make up the pressure readings for changes in air density. 

The BMP180 products have an uncompensated temperature (UT) value and an uncompensated pressure (UP) value. The temperature measurement is drawn first, succeeded by pressure measurement. 

The BMP180 has a 176-bit EEPROM that holds 11 non-identical calibration coefficients that are rare to each sensor. These, along with the UT and UP, are used to measure the actual temperature and barometric pressure. 

Hardware Overview

The module’s heart is the next-generation digital pressure and temperature sensor manufactured by Bosch – BMP180

BMP180 can detect barometric pressure from 300 to 1100 hPa (9000m to -500m above sea level) and temperature from -40°C to 85°C with ±1.0°C accuracy.

The pressure measurements are so accurate (low altitude noise of 0.25m) that you can even utilize it as an altimeter with ±1 meter accuracy.

The BMP180 is a magnetic sensor to be utilized in your weather station; as the pressure switches with the altitude, this sensor can also calculate the altitude. 

This module emerges with an onboard LM6206 3.3V regulator so that you can utilize it with a 5V logic microcontroller like Arduino without being worried. The BMP180 absorbs less than 1mA during calculations and only 5μA during idle. This less power consumption permits the execution of battery-driven devices. 

bmp180 hardware overview

This module marks a straightforward two-wire 12C interface that can be effortlessly interfaced with any microcontroller of our choice. 

BMP180 pressure sensor Pin Out

The BMP180 module has 4 pins that interface it to the outer world. The connections are:

bmp180 pinout

VCC is the power provider for the module, which can be in any place between 3.3 V to 5V.

GND should be attached to the ground of Arduino. 

SCL is a consecutive clock pin for the 12C interface. 

SDA is a serial data pin for the 12C terminal.

Material required

S. No.Components usedUnit used
1BMP180 Sensor 1
2Arduino1
3WiresAs per requirements
4Breadboard1

Circuit connection 

Let’s connect the BMP180 module to the Arduino. The joinings are very simple. Start by attaching a VIN pin to the 5v output on the Arduino and join GND to the ground. Now we are left with the pins that are used for I2C communication. We have to note that each Arduino Board has nonidentical I2C pins, which should be joined accordingly. 

bmp180 connection with arduino

On the Arduino boards, in accordance with the R3 layout, the SDA (data line) and SCL (clock line) are on the pin headers close to the AREF pin. They are also called A5 (SCL) and A4 (SDA).

The pins are non-identical if you have a mega 

You’ll have to use digital 21 (SCL) and 20 (SDA). 

Measuring altitude and barometric pressure with the BMP180 module requires a lot of math. Providentially, Adafruit BMP180 Library was written to escape all the complexities so that we can affair simple commands to study the temperature, barometric pressure, and altitude data.

To set place, the library navigate to the Sketch > Include Library > Manage Libraries…we have to Wait for Library Manager to download the libraries index and bring up to date the list of installed libraries. Then type bmp180 and install Adafruit BMP085 Library.

bmp180 library

Code

The sketch starts along with four libraries viz. 

#include <Wire.h>
#include <Adafruit_BMP085.h>
#define seaLevelPressure_hPa 1013.25

Adafruit_BMP085 bmp;
  
void setup() {
  Serial.begin(9600);
  if (!bmp.begin()) {
	Serial.println("Could not find a valid BMP085 sensor, check wiring!");
	while (1) {}
  }
}
  
void loop() {
    Serial.print("Temperature = ");
    Serial.print(bmp.readTemperature());
    Serial.println(" *C");
    
    Serial.print("Pressure = ");
    Serial.print(bmp.readPressure());
    Serial.println(" Pa");

    Serial.print("Altitude = ");
    Serial.print(bmp.readAltitude());
    Serial.println(" meters");

    Serial.print("Pressure at sealevel (calculated) = ");
    Serial.print(bmp.readSealevelPressure());
    Serial.println(" Pa");

    Serial.print("Real altitude = ");
    Serial.print(bmp.readAltitude(seaLevelPressure_hPa * 100));
    Serial.println(" meters");
    
    Serial.println();
    delay(500);
}


FAQs

How does a BMP180 sensor work? 

Ans- The BMP180 calculates both pressure and temperature because temperature changes the density of gasses like air. The air is not as compact and heavy at higher temperatures, so it exerts less pressure on the sensor. At lower temperatures, the air is more compact and weighs more, so it gives more pressure on the sensor.

What is a barometric pressure sensor? 

Ans- A barometric pressure sensor is a type of sensor that detects atmospheric pressure. Different types of pressure sensors exist utilizing different materials and methods based on the pressure values to be measured. Between these, sensors that identify atmospheric pressure are called barometric pressure sensors.

Why is a barometric pressure sensor important? 

Ans- It is responsible for calculating the atmospheric pressure of the environment that the vehicle is driving in. Nonidentical environments will have different atmospheric pressures, affecting how the vehicle runs.

How is barometric pressure calculated? 

Ans- To measure barometric pressure, we need to look at a barometer and note down the pressure reading. Then, check back again in an hour and then write down the new reading. Once you have both readings, take away the current pressure from the pressure an hour ago to detect how much the barometric pressure has risen or fallen.

Leave a Comment