In this Tutorial, we will learn how to make a IOT Based Simple Online Weather Station using ESP8266 NodeMCU (ESP-12E) Wi-Fi development board and SSD1306 OLED display (128×64 Pixel). This project is a wonderful project for IOT beginners who want to learn about retrieving data from Online Internet server to NodeMCU board.
The NodeMCU pulls weather data like temperature, humidity, pressure, wind speed and wind directional degree from weather website called openweathermap and display it on SSD1306 screen.
Block Diagram – IOT Online Weather Station:
This is a simple block diagram for IOT Online Weather Station which simply explains how the System works.
This Website openweathermap.org provides an online service for weather data and forecast. The data is upload on a cloud server. NodeMCU ESP8266 Wifi Module collects the data information online and download/retrieve the the info like temperature, humidity, pressure, wind speed and wind directional degree.
These data will display on 0.96″ SSD1306 OLED Display along with City.
The SDA and SCL lines of the I2C bus come from GPIO4 (D2) and GPIO0 (D3) of the NodeMCU board (respectively), they are connected to SDA and SCL (SCK) pins of the SSD1306 display module. The OLED display module is supplied with 5V from the Vin pin of NodeMCU board.
Generating API from OpenWeatherMap:
OpenWeatherMap Access current weather data for any location including over 200,000 cities all over the world. Current weather is frequently updated from more than 40,000 weather stations. The data is available in JSON, XML, or HTML format. We will use the data in JSON format here.
Visit https://openweathermap.org and sign in by creating your account.
Generate or Create your API Key as it is needed for retrieving data.
Select the city and country code by entering your city/town name. Example: Vempalli, IN here Vempalli is a city/town and IN is a country code for India. City name and country code need to be entered on code.
Please find below code for IOT Online Weather Station with NodeMCU OLED & OpenWeatherMap. You need 3 different library for that, i.e Adafruit_GFX.h, Adafruit_SSD1306.h and ArduinoJson.h. You can get all these libraries from Library Manager.
Enter the WIFI SSID, Password and City Name with Country Code. Now you can upload this code to NodeMCU Board.
Practical Video with Explanation
Watch this Practical video for better undestanding.
If you want to know more about NodeMcu Development Board visit this:Start with NodeMcu