Arduino BMP180 Guide: Barometric Pressure and Temperature
88 Views, 1 Favorites, 0 Comments
Arduino BMP180 Guide: Barometric Pressure and Temperature
Enhance your upcoming Arduino project’s environmental awareness with the BMP180 sensor.
Tailored for measuring atmospheric pressure, the BMP180 sensor serves two essential functions.
- As we ascend from sea level to higher altitudes, atmospheric pressure decreases, enabling us to gauge altitude by measuring pressure. Hence, the sensor doubles as an altimeter.
- Additionally, since atmospheric pressure fluctuates with weather changes, the sensor proves invaluable for monitoring weather variations.
These sensors are user-friendly, pre-calibrated, and require no additional components, facilitating quick measurement of barometric pressure, altitude, and temperature.
Supplies
BMP180 Module Pinout
The BMP180 module features only 4 pins for external connections. Here’s how they are configured:
- VCC: This pin serves as the power supply for the module, accepting voltages ranging from 3.3V to 5V.
- GND: Connect this pin to the ground (GND) of the Arduino.
- SCL: This pin functions as the serial clock for the I2C interface.
- SDA: This pin serves as the serial data line for the I2C interface.
Wiring BMP180 Module to Arduino
Let’s establish the connection between the BMP180 module and the Arduino.
The connections are straightforward. Begin by linking the VIN pin to the 5V output on the Arduino, and connect GND to ground.
Next, focus on the pins designated for I2C communication. It’s important to note that each Arduino Board features different I2C pins, so make sure to connect them accordingly. On Arduino boards with the R3 layout, the SDA (data line) and SCL (clock line) pins are located on the pin headers near the AREF pin. They are also identified as A5 (SCL) and A4 (SDA).
For the Mega, the pin configuration is different. You’ll need to use digital pin 21 for SCL and pin 20 for SDA. Refer to the table below for a quick reference:
Arduino Code – Reading Temperature and Barometric Pressure
The following sketch provides a comprehensive understanding of how to read temperature and barometric pressure from the BMP180 module. It serves as the foundation 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.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);
}