Weather Station and NTP-Clock

1. Features

This project shows how to autoconnect to the internet and get time from an ntp-server pool and weather data from OpenWeatherMap. To get access to the weather data you have to register whereupon you receive a key.

Weather data, time and WiFi connection data are displayed in turn on the display of an ESP32-Shield with 0.96 inch OLED Display / 18650 Lithium Battery / WiFi / Bluetooth.

Thanks to the Arduino library ESPAsyncWiFiManager there is no need to hardcode the WLAN credentials ssid/password in the program. To establish the first connection to your WiFi with ESPAsyncWiFiManager you need only a mobile phone. You connect to the accesspoint AutoConnect, choose the SSID of your WiFi and enter the password.

2. Specification

The goal of this project is to display the connection data of the ESP32-Shield, the time and date received from an ntp-server and the actual weather imnformation for a configured location in a given time zone. These 3 information blocks are displayed in turn for 10 seconds each.

Power consumption : 5V / 50mA on USB or 4V / 70mA on battery (to be considered with caution).

The 3 screens and the according explanations are shown below.

Displayed data
displayed data
Screen 1 : Connection data
SSID
IP address
MAC address
RSSI received signal strength indicator
Screen 2 : Date and Time
NTP-Clock as title
Time
Date
MAC address
Screen 3 : Weather data
Location and description of sky
Sunrise and sunset UTC
Temperature, relative humidity and barometric pressure
Wind speed and direction
Date and time MEST

3. Parts

Parts needed for the Weather / Clock Station
parts

4. Wiring

The ESP32-Shield contains all parts therefor no wiring is needed.

5. Program Code

The main program uses the class Owm which gets the weather data and parses the obtained strings into a data structure.

Interested? Please download the entire program code. The zip-file contains the complete PlatformIO project.

My programming environment is not the native Arduino™ IDE but PlatformIO™ on top of Microsoft's Visual Studio Code™. This combination offers many advantages and allows a much better structuring of the code into several modules especially when we adopt The Object Oriented way.