BMP280 Breakout Digital pressure sensor module(V1.0) Wiki - DFRobot

Introduction

This is a breakout version of BMP280 Barometric Pressure Sensor from DFRobot with temperature and pressure measurement functions, supporting Arduino code control.
Housed in a extremely compact package, the BMP280 is based on Bosch’s proven Piezo-resistive pressure sensor technology featuring high EMO robustness, high accuracy and linearity and long term stability. Numerous device operation options offer highest flexibility to optimize the device regarding power consumption, resolution and filter performance.
Barometric sensors are usually used to measure barometric pressure and temperature. But besides that, they can also measure altitude and relative floor height due to the fact that there is a certain relationship between altitude and barometric pressure. As for navigation, the barometric pressure sensor can be used to enhance GPS positioning or realize 3D indoor navigation with IMU sensor.

Application

Specification

More information, please refer to BMP280 Datasheet in More Documents.

Board Overview

Top View

Bottom View

Silkscreen Function Description
VCC +
GND -
SCL I2C Clock
SDA I2C Data
ADDR I2C Address Select

Tutorial

Detect the barometric pressure and temperature of the current environment and calculate the altitude of the environment in which the module is located.

Requirements

Connection Diagram

Connect this module with UNO board via I2C port.

Connection

Sample Code

Download BMP280 Library. About how to install a library?

 /*!
 * read_data.ino
 *
 * Download this demo to test simple read from bmp280, connect sensor through IIC interface
 * Data will print on your serial monitor
 *
 * Copyright   [DFRobot](http://www.dfrobot.com), 2016
 * Copyright   GNU Lesser General Public License
 *
 * version  V1.0
 * date  12/03/2019
 */

#include "DFRobot_BMP280.h"
#include "Wire.h"

typedef DFRobot_BMP280_IIC    BMP;    // ******** use abbreviations instead of full names ********

BMP   bmp(&Wire, BMP::eSdo_low);

#define SEA_LEVEL_PRESSURE    1015.0f   // sea level pressure

// show last sensor operate status
void printLastOperateStatus(BMP::eStatus_t eStatus)
{
  switch(eStatus) {
  case BMP::eStatusOK:    Serial.println("everything ok"); break;
  case BMP::eStatusErr:   Serial.println("unknow error"); break;
  case BMP::eStatusErrDeviceNotDetected:    Serial.println("device not detected"); break;
  case BMP::eStatusErrParameter:    Serial.println("parameter error"); break;
  default: Serial.println("unknow status"); break;
  }
}

void setup()
{
  Serial.begin(115200);
  bmp.reset();
  Serial.println("bmp read data test");
  while(bmp.begin() != BMP::eStatusOK) {
    Serial.println("bmp begin faild");
    printLastOperateStatus(bmp.lastOperateStatus);
    delay(2000);
  }
  Serial.println("bmp begin success");
  delay(100);
}

void loop()
{
  float   temp = bmp.getTemperature();
  uint32_t    press = bmp.getPressure();
  float   alti = bmp.calAltitude(SEA_LEVEL_PRESSURE, press);

  Serial.println();
  Serial.println("======== start print ========");
  Serial.print("temperature (unit Celsius): "); Serial.println(temp);
  Serial.print("pressure (unit pa):         "); Serial.println(press);
  Serial.print("altitude (unit meter):      "); Serial.println(alti);
  Serial.println("========  end print  ========");

  delay(1000);
}

Expected Results

FAQ

For any questions, advice or cool ideas to share, please visit the DFRobot Forum.

More Documents