Interfacing BMP280 with Arduino to Read Pressure, Temperature, and Altitude

Interfacing BMP280 with Arduino

This article shows how to interface a BMP280 Pressure sensor with Arduino. BMP280 is a pressure, humidity, temperature, and approximate altitude sensor developed by Bosch Sensortec. It is ideally used for environment-related applications and this sensor can also be used for Prosthetic related applications where pressure is a very critical parameter to work with. It is further useful in drones where pressure, temperature, and altitude can be useful to monitor and make further observations.                              


The Bosch BMP280 can be interfaced with various microcontrollers like PIC, AVR, ESP32/ESP8266, Arduino, etc. In this tutorial, we will use Arduino to interface our BMP280 sensor. Apart from BMP280, there is also another sensor called BMP180 which can measure pressure. We have previously interfaced BMP180 with Raspberry pi and BMP180 with ESP32 to build IoT based weather stations, you can check them out if interested.


Components Required

  1. Arduino Uno and USB cable.
  2. BMP280.
  3. Breadboard.
  4. Jumper Wires.


Working of BMP280 Pressure Sensor

Before starting with the interfacing. Let us know some important details about the sensor. This sensor can operate from a minimum of 1.7V up to 3.6V. BMP280 consists of a Piezo-resistive sensing element which is then connected with an A/D converter. This converter provides the conversion results with specific sensor compensation along with a digital interface and is equipped with a built-in IIR filter to minimize the disturbances in output data.


The BMP280 can be interfaced using two protocols that are I2C and SPI. It can measure pressure from 300 to 1100 hPa with ±1% accuracy, temperature from -40 to +85℃ with ±1% accuracy, and can give us approximate altitude with some calculations. The operating voltage of the sensor is 1.2V to 3.6V with current consumption of 0.1uA in sleep mode which makes it useful for low power applications in embedded electronics. To know more about the sensor and its technical specification, you can check out BMP280 Datasheet.

BMP280 Sensor Module

Let us understand in short what is I2C (Inter-Integrated Circuit) protocol, it allows us to connect multiple slaves integrated with one or more master electronics. It is a 2 wire protocol that can support up to 1008 slaves. Each slave can be identified using a unique address.


Difference between BME280 vs BMP280

Do note that there two types of sensors sold in the market, namely the BME280 and BMP280. Here are the differences between these two sensors.   

  • Both BME280 and BMP280 are developed by Bosch Sensortec.
  • The BMP280 sensor is used to find the Digital Pressure and Temperature, whereas BME280 can be used to measure digital pressure, temperature, and humidity.
  • Because of this difference, BME280 is slightly more expensive than BMP280.
  • So depending upon your project requirement, you can select the sensor which serves your purpose.


Circuit Diagram for Interfacing BMP280 with Arduino

The complete schematics for connecting BMP280 with Arduino is shown below. I have also used the notes option to illustrate which pins are connected to what.

interfacing BMP280 with Arduino

The connections are very simple, I have used a breadboard to mount the sensor and used connecting wires to interface my sensor with Arduino. My hardware set-up looks like this below

 BMP280 Pressure Sensor with Arduino


Install BMP280 library in Arduino IDE

To communicate with this module using I2C and avoid complex programming techniques, we need to use this library  Adafruit_BMP280_Library. Download the library in zip format and follow the steps to install it in your Arduino IDE

Adafruit BMP280 Library


Go to the location where you have downloaded the zip folder and select the zip file and press open.

BMP280 library in Arduino IDE


This will install the library on your Arduino IDE. The default I2C address of this sensor is 0x77. In case if you get the error as Could not find a valid BMP280 sensor like shown below, check wiring!

Default I2C Address


Then if the problem persists, change the sensor address to 0x76 in the _i2caddr of Adafruit_BMP280.cpp as shown below.

BMP280 Sensor Library


If everything is working as it should, the output can be found on your serial monitor as shown below.

BMP280 Sensor Serial Monitor 


Arduino Program to Read Temperature, Pressure, and Altitude using BMP280

The complete program demonstrated in this article can be found at the bottom of this page. The explanation of the code is as follows.

We start the program by defining the libraries as below.

#include <Wire.h>
#include <SPI.h>
#include <Adafruit_BMP280.h>


Then we will be defining SPI pins if we use SPI communication protocol.

#define BMP_SCK  (13)
#define BMP_MISO (12)
#define BMP_MOSI (11)
#define BMP_CS   (10)


In the setup, we define the Serial monitor baud rate and Initialize the I2C module by calling the begin() function. It has some print statements to make the code interactive on reset. If the sensor fails to read due to the wrong address or wiring issue, it gives the error on serial to check the sensor wiring and address. If the sensor connects successfully, it will start printing the value on your serial terminal.

  Serial.println(F("BMP280 test"));
  if (!bmp.begin()) {
    Serial.println(F("Could not find a valid BMP280 sensor, check wiring!"));
    while (1);
/* Default settings from datasheet. */
  bmp.setSampling(Adafruit_BMP280::MODE_NORMAL,     /* Operating Mode. */
                  Adafruit_BMP280::SAMPLING_X2,     /* Temp. oversampling */
                  Adafruit_BMP280::SAMPLING_X16,    /* Pressure oversampling */
                  Adafruit_BMP280::FILTER_X16,      /* Filtering. */
                  Adafruit_BMP280::STANDBY_MS_500); /* Standby time. */


In the loop, the code gives us the reading from the sensor using the following functions and prints it on the serial terminal.

bmp.readTemperature() - reads the temperature in celsius
bmp.readAltitude(1013.25) - calculates altitude in meter based on the sea level pressure defined
bmp.readPressure() - reads pressure in hPA (hectoPascal = millibar)


In the market, there are various sensor module, the sensor we had with us was direct to the interface, but there is a chance you may get the sensor which may have I2C address selector something like this,

BMP280 Sensor

You need not to worry about it, we will explain how you can interface this sensor using the same steps as explained above.

BMP280 Sensor Module

The complete working can also be found in the video linked below. In conclusion, this sensor gives us ease to get pressure, humidity, temperature, and altitude without any complicated wiring or programming. The sensor works on I2C protocol which is easy to understand and has predefined functions which does the job for us.


  This is a library for the BMP280 humidity, temperature & pressure sensor
  Designed specifically to work with the Adafruit BMP280 Breakout
  These sensors use I2C or SPI to communicate, 2 or 4 pins are required
  to interface.
  This code was tested by Taher Ujjainwala on behalf of CircuitDigest
  To learn more visit our website
#include <Wire.h>
#include <SPI.h>
#include <Adafruit_BMP280.h>
#define BMP_SCK  (13)
#define BMP_MISO (12)
#define BMP_MOSI (11)
#define BMP_CS   (10)
Adafruit_BMP280 bmp; // I2C
//Adafruit_BMP280 bmp(BMP_CS); // hardware SPI
//Adafruit_BMP280 bmp(BMP_CS, BMP_MOSI, BMP_MISO,  BMP_SCK);
void setup() {
  Serial.println(F("BMP280 test"));
  if (!bmp.begin()) {
    Serial.println(F("Could not find a valid BMP280 sensor, check wiring!"));
    while (1);
  /* Default settings from datasheet. */
  bmp.setSampling(Adafruit_BMP280::MODE_NORMAL,     /* Operating Mode. */
                  Adafruit_BMP280::SAMPLING_X2,     /* Temp. oversampling */
                  Adafruit_BMP280::SAMPLING_X16,    /* Pressure oversampling */
                  Adafruit_BMP280::FILTER_X16,      /* Filtering. */
                  Adafruit_BMP280::STANDBY_MS_500); /* Standby time. */
void loop() {
    Serial.print(F("Temperature = "));
    Serial.println(" *C");
    Serial.print(F("Pressure = "));
    Serial.println(" Pa");
    Serial.print(F("Approx altitude = "));
    Serial.print(bmp.readAltitude(1013.25)); /* Adjusted to local forecast! */
    Serial.println(" m");



Hi there, just became aware of your blog through Google, and found that it is truly informative. I'm going to watch out for brussels. I'll appreciate if you continue this in future. A lot of people will be benefited from your writing. Cheers!|

I needed to send you one very small remark to be able to give thanks over again over the splendid secrets you have provided on this page. This is wonderfully generous of people like you to supply unhampered all numerous people would've distributed for an e-book to help make some money on their own, chiefly seeing that you might have done it if you desired. These creative ideas also served to be the good way to be aware that other people online have a similar desire like my own to realize a good deal more on the subject of this condition. I am certain there are a lot more enjoyable instances ahead for people who looked over your site.

Thanks for every one of your hard work on this web site. My niece takes pleasure in carrying out internet research and it's simple to grasp why. A lot of people know all concerning the dynamic manner you deliver good techniques through your web site and increase participation from some other people on that concern while our own princess is being taught a great deal. Take pleasure in the rest of the new year. You are carrying out a very good job.

Thanks so much for giving everyone an exceptionally breathtaking opportunity to read articles and blog posts from this site. It really is so brilliant plus packed with a great time for me and my office fellow workers to search your site at a minimum thrice weekly to read the latest tips you have. Of course, I am just certainly fulfilled concerning the astonishing principles you give. Certain two tips in this article are rather the most suitable we have ever had.

I discovered your weblog website on google and test just a few of your early posts. Proceed to maintain up the excellent operate. I simply further up your RSS feed to my MSN Information Reader. In search of forward to studying extra from you afterward!?

I must convey my gratitude for your generosity for all those that actually need assistance with your study. Your real dedication to passing the message across appears to be surprisingly good and has in most cases made most people much like me to realize their endeavors. The valuable tutorial signifies a lot a person like me and additionally to my fellow workers. Regards; from everyone of us.

I am just writing to make you know what a incredible experience our princess went through reading through your web page. She learned so many pieces, which included what it's like to have a marvelous teaching character to make certain people quite simply understand certain hard to do issues. You undoubtedly surpassed our expected results. Thanks for delivering the practical, trusted, revealing as well as cool tips on this topic to Tanya.

I am only commenting to let you understand of the impressive encounter my friend's girl obtained using your site. She picked up many details, with the inclusion of how it is like to have an incredible giving mindset to make the rest very easily know just exactly selected problematic issues. You undoubtedly did more than my expectations. Many thanks for offering such good, safe, edifying and in addition fun tips about that topic to Lizeth.

Thank you for all your valuable work on this web site. My mother loves participating in investigations and it's really simple to grasp why. All of us know all of the compelling way you create sensible thoughts on the blog and as well as inspire participation from others on the area and our daughter is really starting to learn a whole lot. Have fun with the rest of the year. You are always doing a superb job.

I'm commenting to make you be aware of what a great experience my friend's girl experienced using your webblog. She realized numerous issues, including what it's like to possess a marvelous teaching mindset to make folks with no trouble have an understanding of some impossible subject matter. You actually exceeded my expected results. Many thanks for offering the useful, dependable, educational and fun thoughts on this topic to Jane.

Thanks a lot for giving everyone such a superb chance to check tips from here. It is always very brilliant and also jam-packed with amusement for me and my office acquaintances to visit your blog a minimum of thrice weekly to see the latest stuff you have. And lastly, I am just usually astounded with all the unique thoughts you give. Some two ideas in this posting are particularly the most impressive we've had.

Add new comment

The content of this field is kept private and will not be shown publicly.

Plain text

  • No HTML tags allowed.
  • Lines and paragraphs break automatically.
  • Web page addresses and email addresses turn into links automatically.