NodeMCU Internet clock and weather station | IoT Projects

In the last NodeMCU WiFi development board project, I made an internet weather station where weather data (temperature, humidity, pressure, wind speed and wind degree) are sent serially to the laptop and displayed on SSD1306 OLED screen (128×64 Pixel). In that project the NodeMCU pulls whether data from weather website provides free API keys and JSON format openweathermap.org.
Before that I posted an other IoT project which shows how to build an internet clock using the NodeMCU board. The SSD1306 display was also used to display local time and date.

This project is just a combination of the previous two ones, it shows how to make an internet clock with local time and weather station. All data will be displayed on the SSD1306 OLED display.

Related Projects:
ESP8266 NodeMCU interfacing with SSD1306 OLED
NodeMCU Internet clock with SSD1306 display | IoT Projects
NodeMCU Internet weather station with SSD1306 OLED | IoT Projects

The SSD1306 OLED used in this project is configured to work in I2C mode, some SSD1306 OLED boards may require a small hardware modifications (to select between SPI mode or I2C mode) such as soldering, placing jumpers ….

ESP8266 NodeMCU Internet clock and weather station

Hardware Required:

  • ESP8266 NodeMCU development board
  • SSD1306 OLED display with 128×64 Pixel resolution
  • micro USB cable (for programming and powering the circuit)
  • Breadboard
  • Jumper wires

NodeMCU Internet clock and weather station circuit:
Project circuit schematic diagram is shown below.

ESP8266 ESP-12E nodeMCU SSD1306 OLED display circuit

And the following image shows fritzing circuit:

ESP8266 ESP-12E nodeMCU SSD1306 OLED display fritzing circuit

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.
Reset pin (RES) of the display module is connected to GPIO5 (D1) of the NodeMCU development board.

The SSD1306 display module is supplied with 3.3V which comes from the NodeMCU board.

NodeMCU Internet clock and weather station code:
Project code uses some libraries which we have to install, download links are below:

The first library is NTPClient (NTPClient.h), this library connects the ESP8266 WiFi to a time server, this server sends time information to the module. NTP: Network Time Protocol.
NTPClient Library   —   direct link

The 2nd library is Arduino Time library (TimeLib.h), this library converts Unix timestamp (Unix epoch) into: seconds, minutes, hours, day of the week, day, month and year. The Unix epoch is the number of seconds that have elapsed since January 1, 1970 (midnight UTC/GMT).
Basically the time server sends time in Unix epoch format which needs to be converted, this library does all the job. Download links are below:
Arduino Time Library   —   direct link

The 3rd library is ArduinoJson library (ArduinoJson.h), we can install it by going to:
Arduino IDE –> Sketch –> Include Library –> Manage Libraries…
a new window will open, in the search box write: arduinojson
choose library version (I’m using version 5.13.2) and click on install.

We can install the library manually by downloading it from the following URL:
ArduinoJSON library
After the download, extract the zipped file and a folder with name ArduinoJSON-5.13.2 should appear. Move the folder to Arduino libraries folder, the folder should be renamed to ArduinoJSON (remove -5.13.2).

To install Adafruit graphics library (Adafruit_GFX.h) and Adafruit SSD1306 OLED driver (Adafruit_SSD1306.h), see the following post:
ESP8266 NodeMCU interfacing with SSD1306 OLED

The other are built-in libraries including: ESP8266WiFi.h, WiFiUdp.h, ESP8266HTTPClient.h and Wire.h.

The weather (of London, United Kingdom) is updated every 1 minute, for that I used the following:

Full code:

NodeMCU Internet clock and weather station video:


Discover more from Simple Circuit

Subscribe to get the latest posts sent to your email.

4 thoughts on “NodeMCU Internet clock and weather station | IoT Projects”

  1. Ton van der Vorst van der Vorst

    Compilation error: ‘second’ was not declared in this scope; did you mean ‘second_’?

    What do i now?

  2. I am trying to use a part of your example project with a clock that syncs over the internet (udp). I need the lib ‘WiFiUdp.h’. I can’t even find where to download. Can you help me out?
    .

Leave a Comment

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

This site uses Akismet to reduce spam. Learn how your comment data is processed.

Scroll to Top