EXCLUSIVE TRAINING: Learn Robotics At Home & Unlock Highly Desirable $100,000 Tech Skills to Advance Your Career

Share on facebook
Share on twitter
Share on linkedin
Share on pinterest

BME280 Sensor with Arduino Tutorial

Disclosure: Some of the links below are affiliate links. This means that, at zero cost to you, I will earn an affiliate commission if you click through the link and finalize a purchase. Learn Robotics is a participant in the Amazon Services LLC Associates Program, an affiliate advertising program designed to provide a way for websites to earn advertising revenues by advertising and linking to Amazon.com.

EXCLUSIVE TRAINING:
Learn Robotics At Home & Gain Highly Desirable $100,000 Tech Skills to Advance Your Career… for ‘Absolute Beginners’ looking to learn robotics at home …without needing access to a robotics lab!

bme280 sensor

In this article we will learn about another popular sensor in the market known as the BME280. Developed by Bosch, the BME280 is an integrated environment sensor for mobile applications. It is a barometric sensor which can provide Temperature, Pressure and Humidity data quite accurately. Today we will learn more about this cool sensor and how to use it with an Arduino to monitor indoor weather.

BME280 Datasheet, Specs, & Features

Before we can start using the sensor, let’s take a look at its specifications. You can grab a copy of the BME280 Datasheet here.

Supply Voltage: 1.8 – 5V DC
Interface: I2C (up to 3.4MHz),
SPI (up to 10 MHz)

Operational Ranges:
Temperature: -40°C to +85°C, +-1°C
Humidity: 0-100%, -3%
Pressure: 300-1100 hPa, +-1Pa

I2C address:
SDO LOW : 0x76
SDO HIGH: 0x77

The sensor communicates using I2C protocol similar to how an OLED display works. Now that we are familiar with the sensor, let’s see how to connect it to the Arduino. For this project you’ll need an Arduino UNO and a BME280 module.

BME280 Arduino Wiring

As stated before, BME280 works with I2C protocol. So we just need 4 connections. Refer to the connection list below:

  • VIN = 3.3v
  • GND = GND
  • SCL = A5
  • SDA = A4

Here’s the Fritzing wiring diagram for the BME280.

bme280 arduino fritzing diagram

After you wire up the BME280 to the Arduino, it’s time to upload a sketch.

BME280 Arduino Programming

Before we can upload code, we have to install a library for the sensor. To install the library first open Arduino IDE and goto >> Tools >> Library manager. In the search box type “Adafruit_BME280.h” and install the library that shows up.

BME280 library installation

After the library is installed, restart the IDE. Upload the following code:

#include <Adafruit_BME280.h>
Adafruit_BME280 bme;

void setup() 
{
  Serial.begin(9600);
  if (!bme.begin(0x76)) 
  {
    Serial.println("Could not find a valid BME280 sensor, check wiring!");
    while (1);
  }
}

void loop()
{
  Serial.print("Temperature = ");
  Serial.print(bme.readTemperature()); //prints in °C
  //Uncomment the line below to get temperature in °F
  //Serial.print(bme.readTemperature() * 9 / 5 + 32); 
  Serial.println("*C");

  Serial.print("Pressure = ");
  Serial.print(bme.readPressure() / 100.0F);
  Serial.println("hPa");

  Serial.print("Humidity = ");
  Serial.print(bme.readHumidity());
  Serial.println("%");

  Serial.println();
  delay(1000);
}

After writing the code, connect your Arduino to the PC, select the right port, and upload the code.

Sensor Readings from the BME280

Now that the code is uploaded successfully, open the serial monitor and see the data printed in real time.

temperature readings arduino serial monitor

Now you can use the sensor for different projects. In the past we created a simple weather station without sensors. Now that we have a way to obtain temperature, pressure, and humidity, we’ll expand upon this project using the BME280 sensor. Stay tuned!

 

And, if you enjoyed this tutorial, consider picking up a copy of my “Mini WiFi Robot” eBook. In this full project guide, I show you how to design, build, and program your very own custom robot that can be controlled over WiFi. Snag your copy, today!

Botly Learn Robotics

Get Exclusive Learn Robotics Projects Directly to Your Inbox!

Leave a Reply

Your email address will not be published.

This site uses Akismet to reduce spam. Learn how your comment data is processed.

Did this content help you? 🤖
...say thanks and send us a coffee!

EXCLUSIVE TRAINING:

Learn Robotics At Home & Gain Highly Desirable $100,000 Tech Skills to Advance Your Career

For ‘Absolute Beginners’ looking to learn robotics at home …without needing access to a robotics lab

WHAT IS LEARN ROBOTICS?

Learn Robotics helps self-starters, hobbyists, and tech professionals get started in the robotics industry. 

We leverage a simple formula to make it easy to gain highly marketable and high-value 6-figure robotics & automation skills. 

Learn Robotics was founded by Robotics Engineer, Liz Miller, and leverages the Robotics Success Equation, our unique methodology that helps people learn to build robots while enhancing their careers for the future.

liz's featured robotics PROJECT ON YOUTUBE

Learn Robotics Botly Favicon

MORE LEARN ROBOTICS ARTICLES

Get Liz's Exclusive Robotics Content Directly to Your Inbox

Liz Miller Learn Robotics