BMP-180 Digital Barometric Pressure Sensor

BMP-180 is a compact and cheap Digital Barometric Pressure Sensor. Below is an image of the breakout board commonly available on ebay

BMP 180 Digital Barometric Pressure Sensor

There is some confusing information about the required voltage, so safest would be to go with 3.3v. As per datasheet (download here) from Bosch, the chip manufacturer, the max voltage is 3.6v

It has a temperature sensor also inbuilt.

The library from Sparkfun is very good. It can be found here on Github (another is under development). It also has a very good example sketch.  The library has been uploaded here to ensure availability.

Below is a code snippet for reading the temperature and pressure

#include <SFE_BMP180.h>
.............
.............
SFE_BMP180 pressure;
double T,P,temp,paH,paM;
...........
...........
pressure.begin();
...........
...........

// You must first get a temperature measurement to perform a pressure reading.
// Start a temperature measurement:
// If request is successful, the number of ms to wait is returned.
// If request is unsuccessful, 0 is returned.
status = pressure.startTemperature();
if (status != 0)
{
  // Wait for the measurement to complete:
  delay(status);

  // Retrieve the completed temperature measurement:
  // Note that the measurement is stored in the variable T.
  // Function returns 1 if successful, 0 if failure.

  status = pressure.getTemperature(T);
  if (status != 0)
  {
    // Print out the measurement:
    temp = T;

    // Start a pressure measurement:
    // The parameter is the oversampling setting, from 0 to 3 (highest res, longest wait).
    // If request is successful, the number of ms to wait is returned.
    // If request is unsuccessful, 0 is returned.

    status = pressure.startPressure(3);
    if (status != 0)
    {
      // Wait for the measurement to complete:
      delay(status);

      // Retrieve the completed pressure measurement:
      // Note that the measurement is stored in the variable P.
      // Note also that the function requires the previous temperature measurement (T).
      // (If temperature is stable, you can do one temperature measurement for a number of pressure measurements.)
      // Function returns 1 if successful, 0 if failure.

      status = pressure.getPressure(P,T);
      if (status != 0)
      {
        // Print out the measurement:
        paM = P;
        paH = P*0.0295333727;
      }
      else
      {
        paM = -1;
        paH = -1;
      }
    }
    else
    {
        paM = -1;
        paH = -1;
    }
  }
  else
  {
    temp = -1;
  }
}
else
{
  temp = -1;
}
...........
...........

One thought on “BMP-180 Digital Barometric Pressure Sensor

Leave a Reply