Build a sleek and modern weather station using an ESP32 board with a built-in 0.96″ OLED screen. This project fetches live weather data and 3-day forecasts from OpenWeatherMap and displays it in a stylish sliding UI, complete with icons, temperature, weather description, and date/time. It’s an ideal IoT project to demonstrate API integration, Wi-Fi networking, and display handling.
Hardware Components
You’ll need the following hardware components to get started:
| Component | Model / Type | Qty |
|---|---|---|
| ESP32 Board Thingspark | With built-in 0.96″ OLED (I2C) | 1 |
| Micro USB Cable | For programming and power | 1 |
| Wi-Fi Network | 2.4GHz for ESP32 connection | 1 |
| Computer with Arduino IDE | IDE version 1.8.19 or later | 1 |
Steps-by-Step Guide
(1) Setting up Arduino IDE
Download Arduino IDE Software from its official site. Here is a step-by-step guide on “How to install Arduino IDE“.
(2) ESP32 in Arduino IDE
There’s an add-on that allows you to program the ESP32 using the Arduino IDE. Here is a step-by-step guide on “How to Install ESP32 on Arduino IDE“.
(3) Register OpenWeathermap,get API key
- Sign up OpenWeathermap new account: https://home.openweathermap.org/users/sign_up
- Get OpenWeathermap API keys for “Project 1:Weather Station” https://home.openweathermap.org/api_keys

(4) Download Code File
Download the code files from the link given below. Locate “WeatherStation” Tab,
Replace the “********” in the WiFi_Name with your WiFi Name Replace the “********” in the WiFi_Password with your WiFi Password

(4) Update OpenWeatherMap API Keys
Locate “WeatherStation” Tab, Replace the “******” in the OPEN_WEATHER_MAP_APP_ID with your
OpenWeathermap API keys which you registered in the previous preparations

(5) Wiring / Connections
| ESP32 GPIO Pin | OLED Function | Note |
|---|---|---|
| GPIO 21 (D21) | SDA | I2C Data line |
| GPIO 22 (D22) | SCL | I2C Clock line |
| GND | GND | Ground connection |
| 3.3V | VCC | Power supply for OLED |
What the Code Does
Key Features:
- Connects ESP32 to your Wi-Fi network
- Uses NTP to get accurate date & time
- Fetches current weather + 3-day forecast via OpenWeatherMap API
- Displays:
- Temperature with icons (sun, cloud, rain, etc.)
- Weather description (e.g., “clear sky”)
- Day/date and time
- Automatically updates every 20 minutes
How the UI Works:
- Uses the
OLEDDisplayUilibrary to create a sliding frame animation - Frames:
- Date & Time
- Current Weather
- 3-Day Forecast
- Overlay at the bottom shows:
- Clock on the left
- Temperature on the right
Essential Code Behavior
WiFi connection:
WiFi.begin(WiFi_Name, WiFi_Password);
Time sync via NTP:
configTime(TZ_SEC, DST_SEC, "pool.ntp.org");
API requests (OpenWeatherMap):
currentWeatherClient.updateCurrentById(...);
forecastClient.updateForecastsById(...);
UI management:
ui.setFrames(frames, numberOfFrames);
ui.setOverlays(overlays, numberOfOverlays);
ui.init();
Weather update every 20 minutes:
if (millis() - timeSinceLastWUpdate > (1000L*UPDATE_INTERVAL_SECS)) {
setReadyForWeatherUpdate();
}
This project is a beautiful blend of IoT, graphics, and real-time data. It’s perfect for a home dashboard, IoT showcase, or classroom demo to teach weather APIs and embedded displays.