BMP280 Pressure Sensor Module With Arduino
by Utsource in Circuits > Arduino
188 Views, 0 Favorites, 0 Comments
BMP280 Pressure Sensor Module With Arduino
Hi guys in this instructables we will learn how to use BMP280 Pressure sensor module with Arduino and display the data on the LCD.
If you want make a barometer or any kind of device which involves measuring pressure then this module and this Tutorial is all you need.
If you want make a barometer or any kind of device which involves measuring pressure then this module and this Tutorial is all you need.
Things You Need
For this instructables we will need following things :
Arduino
BMP280
Connecting Wires
Bread Board
LCD- 16x2
Connections
The circuit diagram to connect the Arduino with the BMP280 sensor and the LCD is shown.
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 the A5 and A4 of the Arduino board. The LCD connections are as follows
LCD Pin Name Arduino Pin
VSS and RW GND
RS D9
E D8
D4, D5, D6, D7 D5,D4,D3,D2
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 the A5 and A4 of the Arduino board. The LCD connections are as follows
LCD Pin Name Arduino Pin
VSS and RW GND
RS D9
E D8
D4, D5, D6, D7 D5,D4,D3,D2
Code
Please copy the following code and upload it to the arduino Board :
#include "Wire.h"
#include "SPI.h"
#include "Adafruit_BMP280.h"
#include "LiquidCrystal.h"
Adafruit_BMP280 bmp; // I2C
//Adafruit_BMP280 bmp(BMP_CS); // hardware SPI
//Adafruit_BMP280 bmp(BMP_CS, BMP_MOSI, BMP_MISO, BMP_SCK);
LiquidCrystal lcd(9, 8, 5, 4, 3, 2);
void setup() {
lcd.begin(16,2);
Serial.begin(9600);
Serial.println(F("BMP280 test"));
lcd.print("Welcome to ");
lcd.setCursor(0,1);
lcd.print("CIRCUIT DIGEST");
delay(1000);
lcd.clear();
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.print(bmp.readTemperature());
Serial.println(" *C");
lcd.setCursor(0,0);
lcd.print("Temp= ");
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("Approx altitude = "));
Serial.print(bmp.readAltitude(1018)); /* Adjusted to local forecast! */
Serial.println(" m");
Serial.println();
delay(2000);
}
#include "Wire.h"
#include "SPI.h"
#include "Adafruit_BMP280.h"
#include "LiquidCrystal.h"
Adafruit_BMP280 bmp; // I2C
//Adafruit_BMP280 bmp(BMP_CS); // hardware SPI
//Adafruit_BMP280 bmp(BMP_CS, BMP_MOSI, BMP_MISO, BMP_SCK);
LiquidCrystal lcd(9, 8, 5, 4, 3, 2);
void setup() {
lcd.begin(16,2);
Serial.begin(9600);
Serial.println(F("BMP280 test"));
lcd.print("Welcome to ");
lcd.setCursor(0,1);
lcd.print("CIRCUIT DIGEST");
delay(1000);
lcd.clear();
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.print(bmp.readTemperature());
Serial.println(" *C");
lcd.setCursor(0,0);
lcd.print("Temp= ");
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("Approx altitude = "));
Serial.print(bmp.readAltitude(1018)); /* Adjusted to local forecast! */
Serial.println(" m");
Serial.println();
delay(2000);
}
Testing the Pressure Sensor
After Connecting everything together and uploading the code to arduino. Then if everything is fine so you will able to see the pressure reading of the sensor in your LCD display as shown in image.