. ESP32 & BME280 Based Weather Station Live Monitoring
ESP32 & BME280 Based Weather Station Live Monitoring
ESP32 & BME280 Based Weather Station Live Monitoring

ESP32 & BME280 Based Mini Weather Station

In this tutorial, we learn how to make a Mini Weather station using ESP32 & BME280 Barometric Pressure Sensor that can give real-time information of Atmospheric Pressure, Temperature & Humidity. Using BME280 we can even measure the altitude above sea level.

Overview

BME280 is fairly simple to use, pre-calibrated and don’t require extra components. You can simply start measuring relative humidity, temperature, barometric pressure & approx. altitude in no time. So here we will simply interface BME280 Barometric Pressure Sensor with ESP32 Wifi Module and display all the measured parameters like temperature, pressure, humidity and altitude in webpage.

A weather station is a device that collects data related to the weather & environment using different sensors. There are two types of weather station, one which is having own sensors and the second type of weather station is where we pull data from the weather station servers using IoT Processor. In this tutorial, we will go for the first one, i.e. we will design our own weather station just by using only one sensor BME280.

Bill of Materials

Following are the components required for making BME280 weather Station. All the components can be purchased from Amazon via the links given below.

S.N.Components QuantityPurchase Links 1ESP32 Board1Amazon | AliExpress 2BME280 Sensor1Amazon | AliExpress 4Connecting Wires10Amazon | AliExpress 5Breadboard1Amazon | AliExpress BME280 Pressure, Temperature & Humidity Sensor

Bosch BME280 Humidity, Temperature & Pressure Sensor is an integrated environmental sensor which is very small-sized with low power consumption.This BME280 Atmospheric Sensor Breakout is the easy way to measure barometric pressure, humidity, and temperature readings all without taking up too much space. Basically, anything you need to know about atmospheric conditions you can find out from this tiny breakout.

This module uses an environmental sensor manufactured by Bosch with temperature, barometric pressure sensor that is the next generation upgrade to the popular BMP085/BMP180/BMP183 Sensor. This sensor is great for all sorts of weather sensing and can even be used in both I2C and SPI! This precision sensor from Bosch is the best low-cost, precision sensing solution for measuring barometric pressure with ±1 hPa absolute accuraccy, and temperature with ±1.0°C accuracy. Because pressure changes with altitude, and the pressure measurements are so good, you can also use it as an altimeter with ±1 meter accuracy.

Features of BME280

1. Interface: I2C & SPI 2. Supply Voltage: 1.71V to 3.6V 3. Temperature Range: -40 to +85°C 4. Humidity Range: 0% to 100% rel. humidity 5. Pressure Range: 300hPa to 1100hPa

script async 6. Humidity sensor and pressure sensor can be independently enabled/disabled

Applications

1. Context awareness, e.g. skin detection, room change detection 2. Health monitoring/well-being 3. Home automation control 4. Control heating, ventilation, air conditioning (HVAC) 5. Internet of things 6. GPS enhancement & Indoor/Outdoor navigation 7. Weather forecast 8. Vertical velocity indication (rise/sink speed)

BME280 Pinout

The BME280 I2C interface uses the following pins: 1. VCC: 1.71V to 3.6V 2. GND: Connect to GND 3. SCL: serial clock (SCK) 4. SDA: Serial data (SDI) 5. CSB: Must be connected to VDDIO to select I2C interface. 6. SDO: The I2C address decides the pin. If SDO connects to GND(0), the address is 0x76, if it connects to VDDIO(1), the address is 0x77. In this module, we have connected it to VDDIO, so the address should be 0x77.

I2C Interface

The module features a simple two-wire I2C interface which can be easily interfaced with any microcontroller I2C Pins. The default I2C address of the BME280 module is 0x76 and can be changed to 0x77 easily.

There are two different BME280 available in the market whose I2C address can be changed. For the module below if you remove a connection from SDO to GND, the address will change to 0x77.

There is another module available in the market which has only 4 pins. To change its I2C address Locate the solder jumper besides chip.

By default, the middle copper pad is connected to the left pad. So you need to scratch the connection between the middle and the left copper pad to disconnect them. Then you can add a solder blob between the middle and the right copper pad to join them. It allows you to set the I2C address 0x77.

Interfacing BME280 with ESP32 Wifi Module

The BME280 Barometric Pressure Sensor is interfaced with ESP32 to make a simple Mini Weather Station. Connect the SDA SCL pins of BME280 to ESP32 I2C GPIO Pins, i.e. GPIO22 & GPIO21 Pins respectively.

Source Code/Program

The Source Code/Program for Interfacing BME280 with ESP32 Wifi Module is given below. You can copy this code and upload it to your ESP32 Board.

But before that you need to install two libraries, i.e BME280 Library & Adafruit Unified Sensor Library. For this you can simply go to the library manager nd install these two libraries:

#define SEALEVELPRESSURE_HPA (1013.25) Adafruit_BME280 bme ; float temperature , humidity , pressure , altitude ; /*Put your SSID & Password*/ const char * ssid = "Sri Krishna 2." ; // Enter SSID here const char * password = "subbu@123" ; //Enter Password here WebServer server ( 80 ) ; void setup ( ) < Serial . begin ( 115200 ) ; delay ( 100 ) ; bme . begin ( 0x76 ) ; Serial . println ( "Connecting to " ) ; Serial . println ( ssid ) ; //connect to your local wi-fi network WiFi . begin ( ssid , password ) ; //check wi-fi is connected to wi-fi network while ( WiFi . status ( ) != WL_CONNECTED ) < delay ( 1000 ) ; Serial . print ( "." ) ; Serial . println ( "" ) ; Serial . println ( "WiFi connected. " ) ; Serial . print ( "Got IP: " ) ; Serial . println ( WiFi . localIP ( ) ) ; server . on ( "/" , handle_OnConnect ) ; server . onNotFound ( handle_NotFound ) ; server . begin ( ) ; Serial . println ( "HTTP server started" ) ; server . handleClient ( ) ; void handle_OnConnect ( ) < temperature = bme . readTemperature ( ) ; humidity = bme . readHumidity ( ) ; pressure = bme . readPressure ( ) / 100.0F ; altitude = bme . readAltitude ( SEALEVELPRESSURE_HPA ) ; server . send ( 200 , "text/html" , SendHTML ( temperature , humidity , pressure , altitude ) ) ; void handle_NotFound ( ) < server . send ( 404 , "text/plain" , "Not found" ) ; String SendHTML ( float temperature , float humidity , float pressure , float altitude ) < String ptr = "" ; ptr += "ESP32 Weather Station" ; ptr + crayon-k ">html < font-family : 'Open Sans' , sans-serif ; display : block ; margin : 0px auto ; text-align : center ; color : #444444 ; >"; ptr + crayon-k ">body < margin : 0px ; >"; ptr + crayon-k ">h1 < margin : 50px auto 30px ; >"; ptr + crayon-k ">.side-by-side < display : table-cell ; vertical-align : middle ; position : relative ; >"; ptr + crayon-k ">.text < font-weight : 600 ; font-size : 19px ; width : 200px ; >"; ptr + crayon-k ">.reading < font-weight : 300 ; font-size : 50px ; padding-right : 25px ; >"; ptr + crayon-k ">.temperature .reading < color : #F29C1F ; >"; ptr + crayon-k ">.humidity .reading < color : #3B97D3 ; >"; ptr + crayon-k ">.pressure .reading < color : #26B99A ; >"; ptr + crayon-k ">.altitude .reading < color : #955BA5 ; >"; ptr + crayon-k ">.superscript < font-size : 17px ; font-weight : 600 ; position : absolute ; top : 10px ; >"; ptr + crayon-k ">.data < padding : 10px ; >"; ptr + crayon-k ">.container < display : table ; margin : 0 auto ; >"; ptr + crayon-k ">.icon < width : 65px >"; ptr + crayon-ta"> " ; ptr += "

ESP32 Weather Station

" ; ptr += "www.how2electronics.com" ;

ptr += "c0-2.943-1.312-5.574-3.378-7.355V18.436h-3.914v-2h3.914v-2.808h-4.084v-2h4.084V8.82H11.976z M15.302,44.833" ;

ptr += "s2.257,1.01,2.257,2.257V39.73C13.934,40.597,15.302,42.554,15.302,44.833z'fill=#F29C21 />" ; ptr += "Temperature" ; ptr += ( int ) temperature ;

ptr += "C29.235,17.95,14.618,0,14.618,0z M13.667,37.135c-5.604,0-10.162-4.56-10.162-10.162c0-0.787,0.638-1.426,1.426-1.426" ;

ptr += "C15.093,36.497,14.455,37.135,13.667,37.135z'fill=#3C97D3 />" ; ptr += "Humidity" ; ptr += ( int ) humidity ;

ptr += "C34.76,21.271,34.313,20.823,34.313,20.271z M23.084,22.037c-0.559,1.561-2.274,2.372-3.833,1.814" ;

ptr += "C23.196,19.843,23.464,20.973,23.084,22.037z'fill=#26B999 />" ; ptr += "Pressure" ; ptr += ( int ) pressure ;

ptr += "C58.422,38.323,58.339,38.024,58.203,37.754z'fill=#955BA5 /> ptr += "C19.405,39.407,19.518,39.019,19.704,38.674z'fill=#955BA5 />" ; ptr += "Altitude" ; ptr += ( int ) altitude ; return ptr ; Video Tutorial BME280 Weather Station | With Arduino, ESP8266 & ESP32 Previous Article BME280 & Arduino Based Simple Weather Station Next Article ESP8266 & BME280 Based Mini Weather Station Related Posts ESP32 IoT Vehicle Motion Analyzer with MPU6050 & LIS3MDL High-Accuracy Pitch, Roll, Yaw with ESP32 & BNO08x IMU DIY Colorimeter using AS7265x Spectroscopy Sensor & ESP32 Updated: February 1, 2026 Flight Black-Box Motion Recorder System using ESP32 & BMI160 Updated: December 7, 2025 1K ESP8266 & DHT11 Humidity Temperature Monitor on ThingSpeak Updated: October 19, 2025 34 42K IoT based Battery SoC (%) Monitoring System with ESP32 6 Comments where I download WebServer.h library?

Hi, great Tutorial. I did all like here but i get error messages in Arduino IDe and platformIO both the same, can you tell me what i do wrong? THANKS! Arduino: 1.8.13 (Mac OS X), Board: “ESP32 Dev Module, Disabled, Default 4MB with spiffs (1.2MB APP/1.5MB SPIFFS), 240MHz (WiFi/BT), QIO, 80MHz, 4MB (32Mb), 115200, None” Traceback (most recent call last): File “esptool.py”, line 57, in File “/Library/Python/2.7/site-packages/PyInstaller/loader/pyimod03_importers.py”, line 389, in load_module File “serial/tools/list_ports.py”, line 29, in File “/Library/Python/2.7/site-packages/PyInstaller/loader/pyimod03_importers.py”, line 389, in load_module File “serial/tools/list_ports_posix.py”, line 31, in File “/Library/Python/2.7/site-packages/PyInstaller/loader/pyimod03_importers.py”, line 389, in load_module File “serial/tools/list_ports_osx.py”, line 32, in ValueError: dlsym(RTLD_DEFAULT, kIOMasterPortDefault): symbol not found Failed to execute script esptool Multiple libraries were found for “WiFi.h” Used: /Users/muratcobanoglu/Library/Arduino15/packages/esp32/hardware/esp32/1.0.4/libraries/WiFi Not used: /Applications/Arduino.app/Contents/Java/libraries/WiFi exit status 255 /Applications/Arduino.app/Contents/Java/arduino-builder returned 255 Error compiling for board ESP32 Dev Module. This report would have more information with “Show verbose output during compilation” option enabled in File -> Preferences.

RazorLine on June 8, 2021 2:48 PM

it is better: //Adafruit_BME280 bme; #define I2C_SDA 27 #define I2C_SCL 26 #define BME280_ADDRESS 0x76 //If the sensor does not work, try the 0x77 address as well Adafruit_BME280 bme(I2C_SDA, I2C_SCL);

Hello Can two bmp180s be connected at the same time? Thank you.

Hi, i seen your page its awesome work. How to connect ESP32 to thermister – 4, Humidity – 2, pressure and Sun intensity and this is for monitoring solar dryer, and how to connect ESP32 to 3.5inch TFT Display with Aurdino

im HTML ( Zeile 101 ) statt ptr +=(int)temperature; wäre ptr +=String(temperature, 2); besser um die Nachkommastellen mit zu sehen

CommentsCancel reply Latest Posts ESP32 IoT Vehicle Motion Analyzer with MPU6050 & LIS3MDL March 10, 2026 Building a Smart Sensor Node with a BLE Microcontroller February 26, 2026 High-Accuracy Pitch, Roll, Yaw with ESP32 & BNO08x IMU February 16, 2026 DIY Colorimeter using AS7265x Spectroscopy Sensor & ESP32 February 1, 2026 Flight Black-Box Motion Recorder System using ESP32 & BMI160 December 7, 2025 ESP8266 & DHT11 Humidity Temperature Monitor on ThingSpeak October 19, 2025 IoT based Battery SoC (%) Monitoring System with ESP32 September 28, 2025 Speed-Run Translations: Making Fast-Moving Meme Videos Accessible Worldwide September 22, 2025 Top Posts & Pages Categories
  • Arduino Projects (197)
  • Articles (59)
    • Learn Electronics (19)
    • Product Review (15)
    • Tech Articles (27)
    • 555 Timer Projects (21)
    • Op-Amp Circuits (7)
    • Power Electronics (13)
    • ESP32 MicroPython (7)
    • ESP32 Projects (78)
    • ESP32-CAM Projects (15)
    • ESP8266 Projects (76)
    • LoRa/LoRaWAN Projects (22)
    • AMB82-Mini IoT AI Camera (4)
    • BLE Projects (18)
    • STM32 Projects (19)
    • Raspberry Pi Pico Projects (57)
    • Raspberry Pi Pico W Projects (12)
    • Raspberry Pi Projects (24)
    Follow Us About Us

    “‘How to Electronics’ is a vibrant community for electronics enthusiasts and professionals. We deliver latest insights in areas such as Embedded Systems, Power Electronics, AI, IoT, and Robotics. Our goal is to stimulate innovation and provide practical solutions for students, organizations, and industries. Join us to transform learning into a joyful journey of discovery and innovation.

    Copyright © How To Electronics. All rights reserved. Ad Blocker Enabled! Ad Blocker Enabled!

    Looks like you're using an ad blocker. Please allow ads on our site. We rely on advertising to help fund our site.