Tutorial 6: ESP8266 and BME280 make a local/remote weather station

In previous tutorials, we explored how to connect an SSD1306-based I2C OLED to ESP8266 for displaying texts and graphics, as well as to setup an ESP8266-based web server. This tutorial combines the knowledge gained before to make a standalone weather station that will display the local weather data on an OLED screen. In addition, the weather station will also run a web server that would allow a remote computer to access the weather data via web browser.

dsds

BME280 weather station

Hardware Setup

This project uses the EasyESP-1 board and the following hardware devices.

BME280 sensor module: BME280 is a fully integrated environmental unit from Bosch that combines sensors for pressure, humidity, and temperature in a tiny 8-pin metal-lid LGA package of size 2.5 x 2.5 x 0.93 mm³. Because of its compact size, ease of use (BME280 supports standard I2C and SPI interfaces), and availability of supporting open-source Arduino libraries, BME280 is very popular among weather enthusiasts. You can buy a BME280 sensor module in Grove form factor from Elecrow.

SSD1306 I2C OLED module: As described in Tutorial 3, the SSD1306 OLED controller supports both SPI and I2C interfaces. We will use an I2C version with a 0.96″ diagonal length and 128×64 monochrome pixels OLED Grove board. Despite its small size, the readability is pretty good due to its high contrast.

For this experiment, the 4-pin Grove connectors of BME280 and OLED modules are directly plugged into the two I2C ports on the EasyESP-1 board, as shown below. This connects the the SDA and SCK pins of BME280 and OLED modules to D2 and D1 pins of EasyESP-1, respectively.

Complete project setup

Complete project setup

BME280 and OLED connect to I2C Grove ports

BME280 and OLED connections to I2C Grove ports

Software

The ESP8266 firmware for this project is developed using Arduino IDE. You need to install the ESP8266 core to enable the Arduino IDE for ESP8266 programming. Instructions can be found here. You will also need the following Adafruit libraries for reading data from the BME280 sensor. The I2C address of BME280 sensor on Elecrow’s sensor board is 0x77, which is also the default address set in the Adafruit’s library.

Adafruit unified sensor library

Adafruit BME280 library

Besides, you also need Daniel Eichhorn‘s OLED library for ESP8266. Read Tutorial 3 for more details on this.

The complete code for this weather station project can be downloaded from the following link:

Download BME280 Weather Station Code

The code for a very basic HTML webpage with the BME280 sensor output and auto refresh meta tag is included in the code. Note that you need to edit the SSID name and password in the program to match with your WiFi network before uploading it to the EasyESP-1 board.

Output

After uploading the program to EasyESP-1, when the ESP8266 restarts it prints out on the serial monitor the local IP address that was allocated to it in the WiFi network. The BME280 sensor readings for temperature, pressure and humidity are displayed on the OLED screen. In order to access these data over the web server, you need to open a web browser on any computer, tablet, or smartphone connected to the same WiFi network and type in the ESP8266 IP address in the URL field and hit enter. On receiving a client request, the ESP8266 serves a webpage containing the BME sensor readings, as shown below.

BME280 local weather station

BME280 local weather station

Web

Weather data displayed on client’s browser

Buy EasyESP-1 board

Buy BME280 sensor module 

Buy SSD1306 I2C OLED module

More tutorials

EASYESP-1: A RAPID PROTOTYPING AND DEVELOPMENT BOARD FOR ESP8266
TUTORIAL 1: SETTING UP THE ARDUINO IDE FOR EASYESP-1
TUTORIAL 2: EASYESP-1 “HELLO WORLD” EXAMPLE
TUTORIAL 3: CONNECTING AN OLED DISPLAY TO ESP8266
TUTORIAL 4: WORKING WITH ESP8266 WIFI SCAN CLASS
TUTORIAL 5: SETTING UP AN ESP8266 WEB SERVER

Related Posts

2 comments

  • Hey, this code still works in late 2020 with fully updated drivers and arduino IDE. Thanks for making it, I was trying to write something of this nature, but I’m new to coding, and I know very little about C. This made it all possible. The only change I had to make was to add a (0x76) into:

    if (!bme.begin(0x76)) {

    I had 3 other working scripts, one for the OLED, one for the BME280, and one for a ds18b20 to web server. I was struggling to blend all their functions into one code. This did the job. Thank you.

  • Of Paul’s cathedral designed Old Agonyis household|the household of Aged Agony was designed
    by Christopher Wren, who was the seventeenth-century architect This can be currently likely to be your first draft.
    The thing that is main would be to include more for your sentences.
    Paul’s cathedral|Christopher Wren, who was simply
    the seventeenth century architect Lots of students don’t have an idea of how entry essays should be prepared.
    They have weak program documents which reject them the opportunity
    of entrance. Exactly why they’re incapable of come up with
    superior quality admission essays is that they shortage writing creativity
    and abilities they likewise have no time and so end up with entrance essays of very low quality.

    These are the reasons why Many of them prefer to find help
    from organizations offering entry services. Only some of them are authentic although you can find a lot of companies giving admission services.
    Several writing organizations present poor-quality entry companies at exploitative rates because their purpose
    is to generate profits. Pupils should be careful to not be patients of corporations that are such.
    In order to avoid fake publishing organizations, they
    should perform investigation. Evaluation and study should be carried out as a way to recognize
    the caliber of entry services provided. They ought to consult peers, their friends and people on the best entry essay writing
    companies. They make decisions that are smart and need to review examples of entrance essays made available from
    companies. Individuals must seek admission providers from organizations which have writers that
    are skilled and imaginative. Writers of entrance documents
    should really be graduates from colleges which might
    be globally recognized. They should be slots of levels in owners.

    There is of entry article writers a good blend composed of
    people with degrees in several academic fields.
    Creating firms providing admission documents must provide quality entry companies
    that are supreme. That is possible through selecting authors of eliminating
    all sorts of mistakes and problems with capability.
    Problems that affect the grade of entrance documents incorporate sentencing that is inadequate grammar, capitalization and wrong quotation. Admission providers wanted to applicants must be plagiarism free.
    From utilizing another individual’s work as one’s own work plagiarism outcomes.
    This really is individuals and an offence with admission documents which can be plagiarized are
    not given entry. Creating firms giving entry providers should ensure before they are sent to
    applicants that entry documents are carefully tested for plagiarism.
    The academic documents ought to be tested suing the plagiarism pieces that were best.
    Paul’s cathedral designed Previous Miseryis property|the residence of Aged Misery was
    designed by Christopher Wren, who was simply the seventeenth century architect They have an extensive selection of writers, which includes skilled writers that are specialized within their matter or field.
    Their authors understand every one of the guidelines and expectations that exist in writing that is
    instructional. They offer college program essay writing support
    with diligence to you, as well as planning and their information make certain that the work you receive is of
    the quality that is greatest. Paul’s cathedral|Christopher Wren, who
    was the seventeenth century architect You can purchase
    article documents in The Uni Trainer from us. Paul’s cathedral
    created the property of Outdated Misery|Christopher Wren, who was Several clicks.
    Paul’s cathedral created the property of Previous Agony|Wren, who was St.
    Paul’s cathedral|Wren, who was the seventeenth century builder A great IT help enterprise
    will give you the clock, at rates which can be only unbelievable to exquisite service round.
    With your firms, you obtain company inside your dialect,
    hence increasing comfort level, while additionally ensuring that
    there is no info lost in interpretation. Decide on a trustworthy IT company to
    back up you in the event of trouble along with your infrastructure.
    Paul’s cathedral|Wren, who had been the seventeenth-century
    architect

Leave a Reply

Your email address will not be published. Required fields are marked *