Close Menu
  • Articles
    • Learn Electronics
    • Product Review
    • Tech Articles
  • Electronics Circuits
    • 555 Timer Projects
    • Op-Amp Circuits
    • Power Electronics
  • Microcontrollers
    • Arduino Projects
    • STM32 Projects
    • AMB82-Mini IoT AI Camera
    • BLE Projects
  • IoT Projects
    • ESP8266 Projects
    • ESP32 Projects
    • ESP32 MicroPython
    • ESP32-CAM Projects
    • LoRa/LoRaWAN Projects
  • Raspberry Pi
    • Raspberry Pi Projects
    • Raspberry Pi Pico Projects
    • Raspberry Pi Pico W Projects
  • Electronics Calculator
Facebook X (Twitter) Instagram
  • About Us
  • Disclaimer
  • Privacy Policy
  • Contact Us
  • Advertise With Us
Facebook X (Twitter) Instagram Pinterest YouTube LinkedIn
How To Electronics
  • Articles
    • Learn Electronics
    • Product Review
    • Tech Articles
  • Electronics Circuits
    • 555 Timer Projects
    • Op-Amp Circuits
    • Power Electronics
  • Microcontrollers
    • Arduino Projects
    • STM32 Projects
    • AMB82-Mini IoT AI Camera
    • BLE Projects
  • IoT Projects
    • ESP8266 Projects
    • ESP32 Projects
    • ESP32 MicroPython
    • ESP32-CAM Projects
    • LoRa/LoRaWAN Projects
  • Raspberry Pi
    • Raspberry Pi Projects
    • Raspberry Pi Pico Projects
    • Raspberry Pi Pico W Projects
  • Electronics Calculator
How To Electronics
Home » IoT Weather Station with NodeMCU OLED & OpenWeatherMap
ESP8266 Projects IoT Projects

IoT Weather Station with NodeMCU OLED & OpenWeatherMap

Mamtaz AlamBy Mamtaz AlamUpdated:November 18, 202213 Comments3 Mins Read
Share Facebook Twitter LinkedIn Telegram Reddit WhatsApp
IOT Weather Station with NodeMCU OLED & OpenWeatherMap
Share
Facebook Twitter LinkedIn Pinterest Email Reddit Telegram WhatsApp

IOT Weather Station with NodeMCU OLED:

In this Latest IoT project, we will learn how to make an IoT Based Simple Online Weather Station using ESP8266 NodeMCU (ESP-12E) Wi-Fi development board, and an SSD1306 OLED display (128×64 Pixel). This project is a wonderful project for IoT beginners who want to learn about retrieving data from an Online Internet server to the 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.

Check some of the weather station based projects here:
1. ESP8266 & BME280 Based Mini Weather Station
2. IoT Live Weather Station Monitoring with ESP8266
3. MQTT Weather Station with GSM
4. LoRa Based Wireless Weather Station


Bill of Materials

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.

S.N.Components NameQuantityPurchase Links
1NodeMCU ESP8266 Board1Amazon | AliExpress
20.96" I2C OLED Display1Amazon | AliExpress
3Connecting Wires10Amazon | AliExpress
4Breadboard1Amazon | AliExpress




Block Diagram – IOT Weather Station:

This is a simple block diagram for IoT Weather Station which simply explains how the System works.

IOT Weather Station with NodeMCU OLED & OpenWeatherMap

The website openweathermap.org provides an online service for weather data and forecast. The data is uploaded to a cloud server. NodeMCU ESP8266 Wifi Module collects the data information online and downloads/retrieves 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:

IOT Weather Station with NodeMCU OLED & OpenWeatherMap

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 the 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.

IOT Weather Station with NodeMCU OLED & OpenWeatherMap

Create or Generate your API Key as it is needed 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 the code.




Source Code/Programs:

Below is the code for IoT Weather Station with NodeMCU OLED & OpenWeatherMap. You need 3 different libraries for that, i.e Adafruit_GFX.h, Adafruit_SSD1306.h and ArduinoJson.h. You can get all these libraries from the Library Manager.

Enter the WIFI SSID, Password, and City Name with Country Code. Now you can upload this code to NodeMCU Board.

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
#include <ESP8266WiFi.h>
#include <ESP8266HTTPClient.h> // http web access library
#include <ArduinoJson.h> // JSON decoding library
// Libraries for SSD1306 OLED display
#include <Wire.h> // include wire library (for I2C devices such as the SSD1306 display)
#include <Adafruit_GFX.h> // include Adafruit graphics library
#include <Adafruit_SSD1306.h> // include Adafruit SSD1306 OLED display driver
 
#define OLED_RESET 5 // define SSD1306 OLED reset at ESP8266 GPIO5 (NodeMCU D1)
Adafruit_SSD1306 display(OLED_RESET);
 
// set Wi-Fi SSID and password
const char *ssid = "Your Wifi SSID";
const char *password = "Your Wifi Password";
 
// set location and API key
String Location = "City Name, Country Code";
String API_Key = "Your API Key";
 
void setup(void)
{
Serial.begin(9600);
delay(1000);
 
Wire.begin(4, 0); // set I2C pins [SDA = GPIO4 (D2), SCL = GPIO0 (D3)], default clock is 100kHz
 
// by default, we'll generate the high voltage from the 3.3v line internally! (neat!)
display.begin(SSD1306_SWITCHCAPVCC, 0x3C); // initialize with the I2C addr 0x3D (for the 128x64)
// init done
 
Wire.setClock(400000L); // set I2C clock to 400kHz
 
display.clearDisplay(); // clear the display buffer
display.setTextColor(WHITE, BLACK);
display.setTextSize(1);
display.setCursor(0, 0);
display.println(" Internet Weather");
display.print(" Station - Jaipur");
display.display();
 
WiFi.begin(ssid, password);
 
Serial.print("Connecting.");
display.setCursor(0, 24);
display.println("Connecting...");
display.display();
while ( WiFi.status() != WL_CONNECTED )
{
delay(500);
Serial.print(".");
}
Serial.println("connected");
display.print("connected");
display.display();
delay(1000);
 
}
 
void loop()
{
if (WiFi.status() == WL_CONNECTED) //Check WiFi connection status
{
HTTPClient http; //Declare an object of class HTTPClient
 
// specify request destination
http.begin("http://api.openweathermap.org/data/2.5/weather?q=" + Location + "&APPID=" + API_Key); // !!
 
int httpCode = http.GET(); // send the request
 
if (httpCode > 0) // check the returning code
{
String payload = http.getString(); //Get the request response payload
 
DynamicJsonBuffer jsonBuffer(512);
 
// Parse JSON object
JsonObject& root = jsonBuffer.parseObject(payload);
if (!root.success()) {
Serial.println(F("Parsing failed!"));
return;
}
 
float temp = (float)(root["main"]["temp"]) - 273.15; // get temperature in °C
int humidity = root["main"]["humidity"]; // get humidity in %
float pressure = (float)(root["main"]["pressure"]) / 1000; // get pressure in bar
float wind_speed = root["wind"]["speed"]; // get wind speed in m/s
int wind_degree = root["wind"]["deg"]; // get wind degree in °
 
// print data
Serial.printf("Temperature = %.2f°C\r\n", temp);
Serial.printf("Humidity = %d %%\r\n", humidity);
Serial.printf("Pressure = %.3f bar\r\n", pressure);
Serial.printf("Wind speed = %.1f m/s\r\n", wind_speed);
Serial.printf("Wind degree = %d°\r\n\r\n", wind_degree);
 
display.setCursor(0, 24);
display.printf("Temperature: %5.2f C\r\n", temp);
display.printf("Humidity : %d %%\r\n", humidity);
display.printf("Pressure : %.3fbar\r\n", pressure);
display.printf("Wind speed : %.1f m/s\r\n", wind_speed);
display.printf("Wind degree: %d", wind_degree);
display.drawRect(109, 24, 3, 3, WHITE); // put degree symbol ( ° )
display.drawRect(97, 56, 3, 3, WHITE);
display.display();
 
}
 
http.end(); //Close connection
 
}
 
delay(60000); // wait 1 minute
 
}
// End of code.


Video Tutorial & Explanation:

IOT Based Weather Station || NodeMCU with OLED & OpenWeatherMap
Watch this video on YouTube.

Share. Facebook Twitter Pinterest LinkedIn Tumblr Email Reddit Telegram WhatsApp
Previous ArticleRGB LED Strip Color Control with Bluetooth & Arduino
Next Article Wireless Charging Technology : The Fuel of Future

Related Posts

ESP32 Fingerprint Attendance System with Live Web Dashboard

Updated:June 14, 2026
IoT Based PM & Air Quality Monitoring System using ESP32

IoT Based PM & Air Quality Monitoring System using ESP32

Updated:June 14, 2026
DIY ESP32 MLX90640 IR Thermal Camera with Live Web Display

DIY ESP32 MLX90640 IR Thermal Camera with Live Web Display

Updated:May 10, 20261K
IoT Activity Tracker with ESP32 & Accelerometer Gyroscope

IoT Activity Tracker with ESP32 & Accelerometer/Gyroscope

Updated:May 2, 2026

ESP32 IoT Vehicle Motion Analyzer with MPU6050 & LIS3MDL

Updated:April 27, 20261K
High-Accuracy Pitch, Roll, Yaw with ESP32 & BNO08x IMU

High-Accuracy Pitch, Roll, Yaw with ESP32 & BNO08x IMU

Updated:April 27, 20262K
View 13 Comments

13 Comments

  1. Moin Almin on April 6, 2019 8:43 PM

    Hello Sir,
    The video shows you using a I2C oled, but the circuit diagram shows it’s a SPI oled. I am a bit confused as I made the connections using the circuit diagram and the oled doesn’t show anything. Please help.

    Reply
  2. Robert Bock on June 6, 2019 2:21 AM

    Nice job but the code doesn’t work. Keeps giving not declared for this instance error on line 74 DynamicJsonBuffer jsonBuffer(512);

    Reply
    • Zeno on December 7, 2019 2:10 AM

      The Json libraries need to be v5.0-5.10. If you change it, I think it will work.

      Reply
  3. Rob P. on August 30, 2019 8:27 AM

    How do I change pressure to read in Hg (America unit) and F not C ?

    Reply
  4. update2019code4WS on October 30, 2019 6:40 AM

    After reviewing code, and data retruned from the serial console / terminal, the temperature values are never updated from OpenWeatherMap.
    The heading for the Name of the weather station doesn’t scroll off the screen.
    The temperature stays at a static value of -273.15
    So, all we see on the OLED is the 2 above values.

    Tried for many hours to troubleshoot why not able to get OpenWeatherMap data.
    Yes. Wifi Connects
    Yes. API key is valid

    Note sure what is missing from the code, but if you can follow up with this comment, this would be a great Weather Station using ESP8266 and OLED, with a cool 3D printed case to house them both.

    Reply
  5. Zeno on December 7, 2019 1:54 AM

    Hi. It doesn’t work with Hungarian location. What can I do?

    Reply
  6. Kali on November 9, 2020 3:16 AM

    I think the SCL is on GPIO5 (D1) not GPIO0 (D3) witch is FLASH. So, code line should be Wire.begin(4, 5);
    The address in the code line 0x3C does not match the address in the comment 0x3D.

    Reply
  7. Kali on November 12, 2020 1:49 AM

    I wrote nonsense. The sketch above is ok.

    Reply
  8. ERIC D CHRISTIAN on December 30, 2021 4:32 AM

    Hello, have you ever updated the code for this project? Genesis Technology is just around the corner
    This is an Awesome project, but the code needs new JSON strings.
    Thanks, Eric

    Reply
  9. Diego Andres Martinez Martinez on February 17, 2022 5:29 AM

    Io lo sto facendo su un esp8266-01 pero mi piacerebbe sapere cosa cambia nel codice? perché mi funziona pero non lo posso vedere ancora nella OLED 0.96 se mi potresti dare una mano con quello grazie mille.

    Reply
  10. Arbor Chetia on July 9, 2022 1:32 PM

    The spi oled is converted to iic by moving a surface mouted resisistor on the back.

    Reply
  11. leonaidus on January 15, 2024 8:36 AM

    C:\Users\siddh\OneDrive\Desktop\sketch_jan15a\sketch_jan15a.ino: In function ‘void loop()’:
    C:\Users\siddh\OneDrive\Desktop\sketch_jan15a\sketch_jan15a.ino:66:11: error: call to ‘HTTPClient::begin’ declared with attribute error: obsolete API, use ::begin(WiFiClient, url)
    66 | http.begin(“http://api.openweathermap.org/data/2.5/weather?q=” + Location + “&APPID=” + API_Key); // !!
    | ~~~~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

    exit status 1

    Compilation error: call to ‘HTTPClient::begin’ declared with attribute error: obsolete API, use ::begin(WiFiClient, url)

    Reply
    • bijoy on January 23, 2024 12:11 PM

      In board manager esp8266 2.7.4v install its work for me.
      thanks.

      Reply

CommentsCancel reply

Latest Posts

ESP32 Fingerprint Attendance System with Live Web Dashboard

June 14, 2026
IoT Based PM & Air Quality Monitoring System using ESP32

IoT Based PM & Air Quality Monitoring System using ESP32

June 14, 2026
DIY ESP32 MLX90640 IR Thermal Camera with Live Web Display

DIY ESP32 MLX90640 IR Thermal Camera with Live Web Display

May 10, 2026
IoT Activity Tracker with ESP32 & Accelerometer Gyroscope

IoT Activity Tracker with ESP32 & Accelerometer/Gyroscope

May 2, 2026
A Guide to Sourcing Obsolete ICs for Vintage Projects

Beyond AliExpress: A Guide to Sourcing Obsolete ICs for Vintage Projects

April 21, 2026

ESP32 IoT Vehicle Motion Analyzer with MPU6050 & LIS3MDL

April 27, 2026
Building a Smart Sensor Node with a BLE Microcontroller

Building a Smart Sensor Node with a BLE Microcontroller

February 26, 2026
High-Accuracy Pitch, Roll, Yaw with ESP32 & BNO08x IMU

High-Accuracy Pitch, Roll, Yaw with ESP32 & BNO08x IMU

April 27, 2026
Top Posts & Pages
  • IoT Based PM & Air Quality Monitoring System using ESP32
    IoT Based PM & Air Quality Monitoring System using ESP32
  • 12V DC to 220V AC Inverter Circuit & PCB
    12V DC to 220V AC Inverter Circuit & PCB
  • Buck Converter: Basics, Working, Design & Application
    Buck Converter: Basics, Working, Design & Application
  • How to use INA219 DC Current Sensor Module with Arduino
    How to use INA219 DC Current Sensor Module with Arduino
  • How to use ADS1220 24-Bit ADC Module with Arduino
    How to use ADS1220 24-Bit ADC Module with Arduino
  • IoT AC Energy Meter with PZEM-004T & ESP32 WebServer
    IoT AC Energy Meter with PZEM-004T & ESP32 WebServer
  • L293D Dual H-Bridge Motor Driver IC Pins, Circuit, Working
    L293D Dual H-Bridge Motor Driver IC Pins, Circuit, Working
  • LD2410 Sensor with ESP32 - Human Presence Detection
    LD2410 Sensor with ESP32 - Human Presence Detection
Categories
  • Arduino Projects (197)
  • Articles (60)
    • Learn Electronics (19)
    • Product Review (15)
    • Tech Articles (28)
  • Electronics Circuits (46)
    • 555 Timer Projects (21)
    • Op-Amp Circuits (7)
    • Power Electronics (13)
  • IoT Projects (205)
    • ESP32 MicroPython (7)
    • ESP32 Projects (82)
    • ESP32-CAM Projects (15)
    • ESP8266 Projects (76)
    • LoRa/LoRaWAN Projects (22)
  • Microcontrollers (38)
    • AMB82-Mini IoT AI Camera (4)
    • BLE Projects (18)
    • STM32 Projects (19)
  • Raspberry Pi (93)
    • Raspberry Pi Pico Projects (57)
    • Raspberry Pi Pico W Projects (12)
    • Raspberry Pi Projects (24)
Follow Us
  • Facebook
  • Twitter
  • Pinterest
  • Instagram
  • YouTube
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.
  • About Us
  • Disclaimer
  • Privacy Policy
  • Contact Us
  • Advertise With Us

Type above and press Enter to search. Press Esc to cancel.

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.