BMP180

Overview

In this tutorial, we delve into the GY-87 IMU module, focusing on the BMP180 sensor for measuring temperature, pressure, and altitude. Ideal for applications like weather monitoring and altitude tracking, this lesson covers interfacing the GY-87 with an Arduino Uno and using the Adafruit BMP085 library. You’ll learn how to initialize the BMP180 sensor and read its data on the Arduino Serial Monitor, a crucial skill for projects that require environmental data.

Required Components

In this project, we need the following components.

It’s definitely convenient to buy a whole kit, here’s the link:

Name

ITEMS IN THIS KIT

LINK

Elite Explorer Kit

300+

Elite Explorer Kit

You can also buy them separately from the links below.

COMPONENT INTRODUCTION

PURCHASE LINK

Arduino Uno R4 WiFi

-

Jumper Wires

BUY

GY-87 IMU module

-

Wiring

../_images/09-gy87_bb1.png

Schematic Diagram

../_images/09_basic_gy87_schematic.png

Code

Note

  • You can open the file 09-gy87_bmp180.ino under the path of elite-explorer-kit-main\basic_project\09-gy87_bmp180 directly.

  • Or copy this code into Arduino IDE.

Note

To install the library, use the Arduino Library Manager and search for “Adafruit BMP085 Library” and install it.

Code Analysis

  • initializeBMP180()

    Initialize the BMP180 sensor.

    void initializeBMP180() {
      // Start BMP180 initialization
      if (!bmp.begin()) {
        Serial.println("Could not find a valid BMP180 sensor, check wiring!");
        while (1)
          ;  // Halt if sensor not found
      }
      Serial.println("BMP180 Found!");
    }
    
  • printBMP180()

    Print the values ​​read by the BMP180 sensor.

    void printBMP180() {
      Serial.println();
      Serial.println("BMP180 ------------");
      Serial.print("Temperature = ");
      Serial.print(bmp.readTemperature());
      Serial.println(" *C");
    
      Serial.print("Pressure = ");
      Serial.print(bmp.readPressure());
      Serial.println(" Pa");
    
      // Calculate altitude assuming 'standard' barometric
      // pressure of 1013.25 millibar = 101325 Pascal
      Serial.print("Altitude = ");
      Serial.print(bmp.readAltitude());
      Serial.println(" meters");
    
      Serial.print("Pressure at sealevel (calculated) = ");
      Serial.print(bmp.readSealevelPressure());
      Serial.println(" Pa");
      Serial.println("BMP180 ------------");
      Serial.println();
    }