Arduino Easy Weather Station With BME280 Sensor




Introduction: Arduino Easy Weather Station With BME280 Sensor

About: I am Nick Koumaris from Sparta, Greece. I'm extremely passionate about electronics, making things and design. I love teaching what I know and sharing my experiences with you. I put out new YouTube videos eve...

Dear friends welcome to another Arduino project tutorial!

In this tutorial we are going to take a first look at the new BME280 sensor, a new very interesting sensor. We are going to build a simple but very accurate weather station project. I have built a similar project 2 years ago, using different sensors. Now that we have a new sensor available which makes things easier, it’s time to update the project. As you can see, on the LCD display we can see the temperature, the humidity and the barometric pressure. The readings are updated every two seconds. This is a very easy project to build so it is ideal for beginners! Let’s build it!

Step 1: Get All the Parts

The parts needed in order to build this project are the following:

The cost of the project is around $18.

Step 2: BME280 Sensor

The BME280 in a new great sensor from Bosch. So far I was using the BMP180 sensor which can measure temperature and barometric pressure. The BME280 sensor can measure temperature, humidity and barometric pressure! How cool is that! We just need one sensor to build a complete weather station!

In addition to that, the sensor is very small in size and very easy to use. The module we are going to use today, uses the I2C interface so it makes communication with Arduino very easy. We only to connect power and two more wires to make it work.

There are already many libraries developed for this sensor so we can use it in our projects very easily!

The cost of the sensor is about 5$.

You can get it here ▶

NOTE: We need the BME280 sensor. There is also a BMP280 sensor which does not not offer humidity measurement. Be careful to order to sensor you need.

Step 3: LCD Shield

The LCD shield is a very useful shield. It offers a 16x2 LCD display along with some buttons. It also offers a potentiometer which controls the contrast of the display.

Althouth there is not much going on on this shield, it great shield in my opinion. You can easily connect it to an Arduino and display something on it at once. You don't even need to install a library to make it work. The LiquidCrystal library that is required was installed on your machine when you installed the Arduino IDE.

If you are new to Arduino, or if you need an easy to use display to start prototyping with it, this LCD shield is what you need. In addition to that, it costs less than 5$!

You can get it here ▶

Step 4: Connecting the Parts

Let’s connect the sensor to Arduino.

We are using the Arduino Mega today but you can use the Arduino Uno as well if you solder some header pins to your LCD shield. The Arduino Mega make things easier for beginners.

At first we connect the LCD shield to the Arduino Mega. It is very easy, you connect just like any other shield.

Then we connect the Vin pin of the sensor to the Arduino Mega 5V output. Next we connect the GND pin of the sensor to the Arduino Mega GND. The next step is to connect the SCL pin of the sensor to the SCL pin of the Arduino Mega, and the SDA pin of the sensor to the SDA pin of the Arduino Mega. Check the attached photos.

That’s it, if we load the code and power up the project we can see that after 2 seconds the readings from the sensor are displayed on the screen. Our project is ready! You can now build your own enclosure for it, and you have a very accurate weather station! Let’s now take a look at the code of the project.

Step 5: The Code of the Project

The code of the project uses 3 libraries. We need to download 2 of them, since the 3rd one is already installed with the Arduino IDE.

We need to download the

  1. Adafruit BME280 library ▶
  2. Adafruit Sensor library ▶

In order to see how to install the libraries watch the attached video, where I explain how to do it.

Now that we have installed the libraries we need to define the altitude for our location in meters in order to get accurate barometric pressure readings.

<p>#define ALTITUDE 216.0 // Altitude in Sparta, Greece</p>

As you can see, the code is very simple.

<p>void setup(void) {</p><p>  lcd.begin(16, 2);
  lcd.print("Reading sensors");</p><p>   bool status;
    // default settings
    status = bme.begin(0x76);  //The I2C address of the sensor I use is 0x76</p><p>    if (!status) {
        Serial.println("Could not find a valid BME280 sensor, check wiring!");
        while (1);

At first we initialize the sensor and the display.

Then in the loop function the read the sensor every 2 seconds. After reading the sensor we print the values on the display.

<p>delay(2000);</p><p> getPressure();
 //Printing Temperature
 String temperatureString = String(temperature,1);
 lcd.print("C ");</p>

In this version of the code we display the temperature in degrees Celsius but I have also prepared a version of the code with the temperature measured in degrees Fahrenheit. You can find both versions of the code of the project attached to this Instructable.

Step 6: Final Thoughts

That’s today’s project. An Arduino Weather Station project with the new BME280 sensor.

The new BME280 sensor is very easy to use since it uses the I2C interface. I am going to use it a lot in the future projects because it offers temperature, humidity and pressure sensors in one package. This makes our weather station projects easier to build and more compact. I would love to hear your opinion about this sensor. Are you going to use it any of your projects? If yes, what kind of projects are you going to build using this sensor? Please post your ideas below, I would love to read them. Thanks!

1 Person Made This Project!


  • Puzzles Speed Challenge

    Puzzles Speed Challenge
  • "Can't Touch This" Family Contest

    "Can't Touch This" Family Contest
  • CNC Contest 2020

    CNC Contest 2020

9 Discussions


Question 2 months ago

I made the project, but in the code-compilliering I get errors:
Arduino: 1.8.12 (Windows 10), Board: "Arduino Mega or Mega 2560, ATmega2560 (Mega 2560)"
In file included from C:\Users\raine\Documents\Arduino\weatherstation_bme280_keypad1\weatherstation_bme280_keypad1.ino:8:0:
C:\Users\raine\Documents\Arduino\libraries\Adafruit_Unified_Sensor/Adafruit_Sensor.h:52:1: error: expected unqualified-id before 'typedef'
typedef enum {
C:\Users\raine\Documents\Arduino\libraries\Adafruit_Unified_Sensor/Adafruit_Sensor.h:52:1: error: expected constructor, destructor, or type conversion before 'typedef'
C:\Users\raine\Documents\Arduino\libraries\Adafruit_Unified_Sensor/Adafruit_Sensor.h:70:3: error: 'sensors_type_t' does not name a type
} sensors_type_t;
exit status 1
Fehler beim Kompilieren für das Board Arduino Mega or Mega 2560.
Dieser Bericht wäre detaillierter, wenn die Option
"Ausführliche Ausgabe während der Kompilierung"
in Datei -> Voreinstellungen aktiviert wäre.

Please make a correction.
Happy returns
Rainer Distelrath


1 year ago

Nice and easy project, thank you.
What I like to do, but do not have the knowledge to do, is to stack another shield,
"XD-204 Data Logger Shield | RTC | Data Logger for Arduino UNO" from ebay.
I did try to write my code myself, but ........
Anyone outthere can help out with that, will be most appreciated :-)

Zygmunt docent
Zygmunt docent

2 years ago

A great design
I folded it and it works. I would like to make 433 MHz radio communication (I have such a set). I can not handle the code. If I can ask for the station code for BME280 and RF sensor.
Yours sincerely, Zygmunt Pułaczewski


3 years ago

I designed and 3d-printed an enclosure for it as well. I am very happy with the result, but I have to figure out why my temperature-readings seems to be too high.

Thank you for a great instructable (great project, great description, easy to follow along!).


3 years ago

For UNO users, SDA/SCL can be seen here.


3 years ago

Thanks. I want to have this placed in a case. What material do I need to use?


3 years ago

Any way to log the data?


3 years ago

Excellent project, thanks for sharing :-)


3 years ago

Great Instructable.
I've made anexo Arduino Uno Weather Station with other sensors. Maybe it can help you: