How to Connect BMP280 Pressure Sensor Module With Arduino

by Lisleapex Blog in Circuits > Arduino

265 Views, 0 Favorites, 0 Comments

How to Connect BMP280 Pressure Sensor Module With Arduino

How to connect BMP280 pressure sensor module with Arduino.png

If you want to build your own temperature monitoring system or measure the altitude of a drone, or just want to measure the atmospheric pressure in your area, then one of the best modules to use in your project is the BMP280 Pressure Sensor Module. BMP280 is an absolute pressure and temperature monitoring sensor, which is an upgraded version of BMP085, BMP180 and BMP183 sensors. Why is it called an upgraded version? It will be discussed in the following sections.


The BMP280 sensor module can be used with microcontrollers such as Arduino, PIC, AVR, etc. For this project we will use Arduino Uno and BMP280 along with LCD 16x2 display module to display temperature and pressure values. Before connecting the BMP280 with Arduino, we need to download the BMP280 Arduino library developed by Adafruit.

Supplies

  • Arduino
  • BMP280
  • Connect wires
  • Breadboard
  • LCD monitor - 16x2

Learn About BMP280 Firstly

BMP280 .png

The BMP280 sensor module operates at a minimum voltage (VDD) of 1.71V, whereas previous versions of the sensor module operated at 1.8V (VDD). In terms of current consumption, the BMP280 consumes 2.7uA, while the BMP180 consumes 12uA, and the BMP183 and BMP085 consume 5uA each. The BMP280 also supports new filtering modes. The BMP280 sensor module supports I2c and SPI protocols, while the remaining sensors support I2c or SPI. The BMP280 sensor module has an accuracy of ±0.12 hPa, which corresponds to an altitude difference of ±1 m. Due to these key properties, it is mainly used in various applications.


The BMP sensor consists of a pressure sensing element, a humidity sensing element and a temperature sensing element, which are further connected to the pressure front end, humidity front end and temperature front end. These front-end ICs are sensitive analog amplifiers used to amplify small signals. The output of this analog front-end IC is fed as an input signal to the ADC. In this case, the analog value is converted into a digital voltage and this voltage is fed to the logic circuit for further connection with the outside world.


The BMP280 sensor module consists of three power consumption modes, sleep mode, forced mode and normal mode. In sleep mode, no measurements are performed and power consumption is minimal. In forced mode, a single measurement is performed based on the selected measurement and filtering options. Normal mode continuously cycles between measurement and standby periods, the period of which will be defined by Tstandby. The current in standby mode is slightly higher than in sleep mode.

Circuit Diagram Connecting BMP280 to Arduino

Circuit Diagram Connecting BMP280 To Arduino.png

The circuit diagram for connecting Arduino with BMP280 sensor and LCD is shown below.

The VCC and GND pins of the sensor are connected to the 3v3 and GND pins of the Arduino. The SCL and SDA pins of the sensor are connected to A5 and A4 of the Arduino board.

Arduino Program to Connect BMP280 With Arduino

These libraries are included to enable special functionality. #include header file We can directly read the values from the sensor. The #include header facilitates communication using I2C. The #include header file is used to access special functions of the LCD, such as lcd.print(), Lcd.setCursor(), etc. These header files can be downloaded using the link given above. The downloaded file will be in zip format. Now open Arduino and select Sketch>include library>Add.zip library. Now add the downloaded file.

#include 
#include
#include
#include

Create object BMP for Adafruit_BMP280. Create object files to access special features.

Adafruit_BMP280 bmp;// I2C

Set up the pins of the Arduino to communicate with the LCD. Data will be transferred using these pins.

LCD LCD screen (9, 8, 5, 4, 3, 2);

Initialize LCD and serial communications.

void settings(){

  lcd.start(16,2);

  SerialNumber.Start(9600);

  Serial.println(F("BMP280 Test"));

  lcd.print("Welcome");

  lcd.setCursor(0,1);

  lcd.print("Circuit Digest");

  delay(1000);

  lcd.clear();

  if(!bmp.begin()){

   Serial.println(F("No valid BMP280 sensor found, check the wiring!"));

   And (1);

  }

This function works when initialization of the bmp object fails.

/* Default settings from data table. */

  bmp.setSampling(Adafruit_BMP280::MODE_NORMAL, /* Operating mode.*/

          Adafruit_BMP280::SAMPLING_X2, /* temperature. Oversampling */

          Adafruit_BMP280::SAMPLING_X16, /* pressure oversampling */

          Adafruit_BMP280::FILTER_X16, /* Filter. */

          Adafruit_BMP280::STANDBY_MS_500); /* Standby time. */

}

This part of the code prints the temperature on the serial monitor for debugging purposes.

void loop() {

   Serial.print(F("Temperature = "));

   Serial.print(bmp.readTemperature());

   Serial.println("*C");

The functions bmp.readPressure and bmp.readTemprature are used to call special functions and return temperature and pressure values.

    lcd.print(bmp.readTemperature());
lcd.print(bmp.readPressure());

Working on Arduino BMP280 Pressure Sensor Interface Project


The functions bmp.readTemprature() and bmp.readPressure() are used to return temperature and pressure values. These functions are a set of statements that perform a specific task, in our case returning temperature and pressure files. These functions are called using the bmp.readTemprature() and bmp.readPressure() functions. lcd.setCursor sets the LCD cursor to the desired position on the screen. The LCD print command prints data from the location set by the programmer. If the LCD position is not set, it defaults to (0, 0) as the initial position and prints data continuously. The next data occupies the position of the next column and the process continues until it reaches the end of the row and moves to the next row.

BMP280 Application

Can be used on flying toys, cell phones, tablets, PCs, GPS devices, portable healthcare devices, home weather stations and more. By following this procedure and using header files and some special functions we can easily connect BMP280 with Arduino.

Coding

#include


#include


#include


#include


Adafruit_BMP280 bmp; // I2C


//Adafruit_BMP280 bmp(BMP_CS); //Hardware SPI


//Adafruit_BMP280 bmp(BMP_CS, BMP_MOSI, BMP_MISO, BMP_SCK);


LCD LCD (9, 8, 5, 4, 3, 2);


void settings() {


lcd.begin(16,2);


SerialNumber.Start(9600);


Serial.println(F("BMP280 Test"));


lcd.print("Welcome");


lcd.setCursor(0,1);


lcd.print("Circuit Digest");


delay(1000);


lcd.clear();


if (!bmp.begin()) {


Serial.println(F("No valid BMP280 sensor found, check the wiring!"));


And (1);


}


/* Default settings from data table. */


bmp.setSampling(Adafruit_BMP280::MODE_NORMAL, /* Operating mode.*/


Adafruit_BMP280::SAMPLING_X2, /* Temperature oversampling */


Adafruit_BMP280::SAMPLING_X16, /* pressure oversampling */


Adafruit_BMP280::FILTER_X16, /* Filter. */


Adafruit_BMP280::STANDBY_MS_500); /* Standby time. */


}


void loop() {


Serial.print(F("Temperature = "));


Serial.print(bmp.readTemperature());


Serial.println("*C");


lcd.setCursor(0,0);


lcd.print("temperature = ");


lcd.print(bmp.readTemperature());



Serial.print(F("Pressure = "));


Serial.print(bmp.readPressure());


Serial.println("Pa");


lcd.setCursor(0,1);


lcd.print("press=");


lcd.print(bmp.readPressure());


Serial.print(F("Approximate height = "));


Serial.print(bmp.readAltitude(1018)); /* Adjust to local prediction! */


Serial.println("m");


Serial number.println();


Delay (2000);


}