Table of Contents
IOT Weather Station with NodeMCU OLED:
In this Latest IoT project, 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.org and display it on SSD1306 screen.
As the topic is clear, i.e IOT Weather Station with NodeMCU OLED & OpenWeatherMap, we just need OLED Display and NodeMCU wifi Module for this project. You can purchase these components from Amazon.
Block Diagram – IOT Weather Station:
This is a simple block diagram for IOT Weather Station which simply explains how the System works.
The 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 are displayed on 0.96″ SSD1306 OLED Display along with City.
Circuit Diagram & Connection:
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.
Create or Generate your API Key as it is need for retrieving data.
Select the city and country code by entering your city name. Example: Jaipur, IN here Jaipur is a city and IN is a country code for India. City name and country code need to be entered on code.
Below is the code for IOT 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.