BPM 120
BPM 120
Give your next Arduino project the ability to sense the world around it with
BMP180.
As we travel from sea level to a mountain peak, the air pressure gets
lower. That means by measuring the pressure we can determine the
altitude. So, we can use this sensor as an Altimeter.
Because the atmospheric pressure changes with the weather, we can use
it to monitor changes in the weather.
These sensors are fairly simple to use, pre-calibrated and don’t require extra
components so you can start measuring barometric pressure, altitude and
temperature in no time.
Hardware Overview
At the heart of the module is the next-generation digital pressure and
temperature sensor manufactured by Bosch – BMP180.
BMP180 Chip
BMP180 can measure 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 precise (low altitude noise of 0.25m), you
can even use it as an altimeter with ±1 meter accuracy.
Power Requirement
The module comes with an on-board LM6206 3.3V regulator, so you can use it
with a 5V logic microcontroller like Arduino without worry.
The BMP180 consumes less than 1mA during measurements and only 5μA
during idle. This low power consumption allows the implementation in battery
driven devices.
I2C Interface
The module features a simple two-wire I2C interface which can be easily
interfaced with any microcontroller of your choice.
VCC is the power supply for the module which can be anywhere between 3.3V to
5V.
GND should be connected to the ground of Arduino.
SCL is a serial clock pin for I2C interface.
SDA is a serial data pin for I2C interface.
Connections are fairly simple. Start by connecting VIN pin to the 5V output on
the Arduino and connect GND to ground.
Now we are remaining with the pins that are used for I2C communication. Note
that each Arduino Board has different I2C pins which should be connected
accordingly. On the Arduino boards 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
known as A5 (SCL) and A4 (SDA).
If you have a Mega, the pins are different! You’ll want to use digital 21 (SCL) and
20 (SDA). Refer below table for quick understanding.
SCL SDA
Arduino Uno A5 A4
Arduino Nano A5 A4
Arduino Mega 21 20
Leonardo/Micro 3 2
To install the library navigate to the Sketch > Include Library > Manage
Libraries… Wait for Library Manager to download libraries index and update list
of installed libraries.
Filter your search by typing ‘bmp180’. There should be a couple entries. Look for
Adafruit BMP085 Library by Adafruit. Click on that entry, and then select Install.
Arduino Code – Reading Temperature
and Barometric Pressure
The following sketch will give you complete understanding on how to read
temperature and barometric pressure from BMP180 module and can serve as
the basis for more practical experiments and projects.
#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.println();
delay(500);
}
You can get a more accurate altitude measurement, if you know the current sea
level pressure which will vary with weather.
This code assumes that current sea level pressure is 1013.25 millibars that is
equal to 101325 Pascals. That’s why seaLevelPressure_hPa variable is set to
1013.25
Code Explanation:
The sketch starts with including four libraries viz. Wire.h and Adafruit_BMP085.h.
#include <Wire.h>
#include <Adafruit_BMP085.h>
Adafruit_BMP085 bmp;
In setup function of code we initialize the serial communication with PC and call
the begin() function.
The begin() function initializes I2C interface and checks if the chip ID is correct.
It then resets the chip using soft-reset & waits for the sensor for calibration after
wake-up.
Serial.begin(9600);
if (!bmp.begin()) {
Serial.println("Could not find a valid BMP085 sensor, check
wiring!");
while (1) {}
}
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");
Disclaimer
Privacy Policy