The upgraded Pressure & Altitude Sensor Gravity BMP280 by DFRobot has the functions both on detecting temperature and air pressure. It can be connected to Arduino, and controlled by Arduino code. Compared to the old edition BMP180, BMP280 has lower power consumption, more precise measurement, lower noise and higher sampling frequency. Normally, pressure sensors measure the air pressure and the temperature. Because of the relation between the air pressure and the altitude, we can use the air pressure sensor to measure the altitude and the building height. BMP280 is also suitable for navigation, by the use of Inertia Measurement Unit (IMU), BMP280 can be used in GPS refinement, 3D in-door navigation and floor detection. The BMP280 is based on Bosch’s proven Piezo-resistive pressure sensor technology featuring high EMC robustness, high accuracy and linearity and long term stability. The relative accuracy is ±0.12 hPa, which is equivalent to ±1 m difference in altitude. The operating temperature range for long tern stability is 0 ~65 ℃. Attention: because the sensor is very sensitive to the environment, please don’t touch it.



Board Overview

Gravity: I2C BMP280 Barometer Sensor

Label Description
SDA I2C Data
SCL I2C Clock
VCC 3.3/5V


To measure the air pressure and temperature of the local environment, and calculate the altitude of the sensor.


Connection Diagram


Sample Code

 * @file bmp280test.ino
 * @brief DFRobot's Temperature & Barometer.
 * @n This example read the Temperature, Barometer and Altitude from BMP280, and then print them
 * @copyright   [DFRobot](, 2016
 * @copyright   GNU Lesser General Public License
 * @version  V1.0
 * @date  2016-12-06

#include <Wire.h>
#include "DFRobot_BMP280.h"

DFRobot_BMP280 bmp280;

void setup() {
  Serial.println("BMP280 demo");

  if (!bmp280.begin()) {
    Serial.println("Could not find a valid BMP280 sensor!");
    while (1);

void loop() {
    Serial.print("Temperature = ");
    Serial.println(" *C");

    Serial.print("Pressure = ");
    Serial.println(" Pa");

    Serial.print("Altitude = ");
    Serial.print(bmp280.readAltitudeValue(1013.25)); // this should be adjusted to your local forcase
    Serial.println(" m");


Expected Results



Q1. Did I get the right value? It is always changing.
A1. You can visit the local weather forecast to confirm the data.
For any questions, advice or cool ideas to share, please visit the DFRobot Forum.

More Documentation