ESP8266/IoT B.Tech/Diploma Beginner

ESP8266 & BME280 Based Mini Weather Station

Mini Weather station using ESP8266 & BME280 Barometric Pressure Sensor to give real-time information Atmospheric Pressure, Temperature, Humidity, Altitude

  • Suitable forB.Tech/Diploma ESP8266/IoT students
  • Build time1-2 weeks
  • LevelBeginner
  • Available atAjvika Labs, Kakinada

About this project

In this tutorial, we learn how to make a
Mini Weather station
using
ESP8266 & 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 ESP8266 Wifi Module
and display all the measured parameters like temperature, pressure, humidity and altitude in
Web Server
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
You can check some more projects related to BME280:

BME280 & Arduino Based Simple Weather Station

ESP32 & BME280 Based Mini Weather Station
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
Quantity
Purchase Links

NodeMCU ESP8266

Amazon
AliExpress

BME280 Sensor

Amazon
AliExpress

Connecting Wires

Amazon
AliExpress

Breadboard

Amazon
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 accuracy, 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. Check
BME280 Datasheet
Features of BME280
Interface:
I2C & SPI
Supply Voltage:
1.71V to 3.6V
Temperature Range:
-40 to +85°C
Humidity Range:
0% to 100% rel. humidity
Pressure Range:
300hPa to 1100hPa
<
script async
6. Humidity sensor and pressure sensor can be independently enabled/disabled
Applications
Context awareness, e.g. skin detection, room change detection
Health monitoring/well-being
Home automation control
Control heating, ventilation, air conditioning (HVAC)
Internet of things
GPS enhancement & Indoor/Outdoor navigation
Weather forecast
Vertical velocity indication (rise/sink speed)
BME280 Pinout
The BME280 I2C interface uses the following pins:

VCC:
1.71V to 3.6V

GND:
Connect to GND

SCL:
serial clock (SCK)

SDA:
Serial data (SDI)

CSB:
Must be connected to VDDIO to select I2C interface.

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 ESP8266 Wifi Module
The BME280 Barometric Pressure Sensor is interfaced with ESP8266 to make a simple Mini Weather Station. Connect the SDA SCL pins of BME280 to ESP8266 I2C GPIO Pins, i.e. D2 & D1 Pins respectively.
Source Code/Program
The
Source Code/Program
for
Interfacing BME280 with ESP8266 Wifi Module
is given below. You can copy this code and upload it to your ESP8266 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:

#include <ESP8266WebServer.h>
#include <Wire.h>
#include <Adafruit_Sensor.h>
#include <Adafruit_BME280.h>
#define SEALEVELPRESSURE_HPA (1013.25)
Adafruit_BME280
bme
;
float
temperature
humidity
pressure
altitude
;
const
char
*
ssid
=
"Fimo"
;
// Enter SSID here
const
char
*
password
=
"Fimo@!23"
;
//Enter Password here
ESP8266WebServer
server
(

)
;
void
setup
(
)
{
Serial
begin
(
115200
)
;
delay
(

)
;
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
(
"."
)
;
}
Serial
println
(
""
)
;
Serial
println
(
"WiFi connected..!"
)
;
Serial
(
"Got IP: "
)
;
Serial
println
(
WiFi
localIP
(
)
)
;
server
on
(
"/"
handle_OnConnect
)
;
server
onNotFound
(
handle_NotFound
)
;
server
begin
(
)
;
Serial
println
(
"HTTP server started"
)
;
}
void
loop
(
)
{
server
handleClient
(
)
;
}
void
handle_OnConnect
(
)
{
temperature
=
bme
readTemperature
(
)
;
humidity
=
bme
readHumidity
(
)
;
pressure
=
bme
readPressure
(
)
/
100.0F
;
altitude
=
bme
readAltitude
(
SEALEVELPRESSURE_HPA
)
;
server
send
(

"text/html"
SendHTML
(
temperature
humidity
pressure
altitude
)
)
;
}
void
handle_NotFound
(
)
{
server
send
(

"text/plain"
"Not found"
)
;
}
String
SendHTML
(
float
temperature
float
humidity
float
pressure
float
altitude
)
{
String
ptr
=
"<!DOCTYPE html>"
;
ptr
+=
"<html>"
;
ptr
+=
"<head>"
;
ptr
+=
"<title>ESP8266 Weather Station</title>"
;
ptr
+=
"<meta name='viewport' content='width=device-width, initial-scale=1.0'>"
;
ptr
+=
"<link href='https://fonts.googleapis.com/css?family=Open+Sans:300,400,600' rel='stylesheet'>"
;
ptr
+=
"
<style>
";
ptr +="
html
{
font-family
:
'Open Sans'
sans-serif
;
display
:
block
;
margin
:
0px
auto
;
text-align
:
center
;
color
:
#444444
;
}
";
ptr +="
body
{
margin
:
0px
;
}
";
ptr +="
h1
{
margin
:
50px
auto
30px
;
}
";
ptr +="
.side-by-side
{
display
:
table-cell
;
vertical-align
:
middle
;
position
:
relative
;
}
";
ptr +="
.text
{
font-weight
:

;
font-size
:
19px
;
width
:
200px
;
}
";
ptr +="
.reading
{
font

Technologies used

ESP32ESP8266ArduinoWiFiBLEBME280BMP180GPSI2CSPIHTMLCSS

Hardware components

  • ESP32
  • ESP8266
  • Arduino
  • BME280
  • BMP180
  • GPS

Software & tools

  • Arduino IDE

What you get

  • Working project / hardware kit, tested before delivery
  • Complete source code with explanation
  • Project demo and guidance for your viva
  • Project report, PPT and IEEE paper support (on request)
Delivery & Payment
Delivery takes a minimum of two weeks from the date your inquiry is confirmed. Payment is in two parts: • 50% advance to start the project • Remaining 50% before delivery Note: • Documentation and PPT are not included by default • If you need documentation/PPT, it can be arranged for extra time and cost We'll confirm the exact timeline and cost with you after reviewing your requirements.