Weather Station on ARD-ESP32-C3-TFT24
by mardar007 in Circuits > Arduino
69 Views, 1 Favorites, 0 Comments
Weather Station on ARD-ESP32-C3-TFT24
My goal was to build a smart weather station using an ESP32 microcontroller and a TFT display. The project combines real-time weather information with an accurate digital clock and automatic screen brightness control, creating a practical device that can be used every day.
Supplies
ARD-ESP32-C3-TFT24
Required Software
Before uploading the project, make sure you have the following software installed:
- Arduino IDE
- ESP32 by Espressif Systems — Version 2.0.14
- TFT_eSPI library — Version 2.5.43
- ArduinoJson library
Using the specified versions is recommended to ensure full compatibility with the project.
Configure the TFT Display
A pre-configured User_Setup.h file is included in the project attachments.
Replace the default User_Setup.h file inside the TFT_eSPI library with the provided one before compiling the project. This file already contains the correct display driver, pin configuration, and other settings required for the TFT display used in this project.
Create an OpenWeatherMap API Key
The weather station downloads live weather information from OpenWeatherMap.
To enable this feature:
- Create a free OpenWeatherMap account.
- Generate a personal API key at:
- https://home.openweathermap.org/api_keys
- Copy the generated key.
- Paste it into the following line of the source code:
Configure Your Wi-Fi
Open the source code and enter your Wi-Fi credentials:
You can also change the city by modifying:
Replace it with any city supported by OpenWeatherMap.
Upload the Program
Select your ESP32 board in the Arduino IDE and upload the sketch.
After the upload is complete, the ESP32 will:
- Connect to your Wi-Fi network.
- Synchronize the current time using an NTP server.
- Download the latest weather information from OpenWeatherMap.
- Display the weather and digital clock on the TFT screen.
How the Program Works
The project combines several ESP32 features into a compact weather station.
After startup, the ESP32 connects to Wi-Fi and synchronizes the current time with an NTP server. This guarantees that the displayed clock is always accurate.
Every 10 minutes, the ESP32 sends an HTTP request to the OpenWeatherMap API. The returned JSON data is parsed using the ArduinoJson library to obtain:
- Current temperature
- Humidity
- Wind speed
- Weather conditions
The TFT display continuously shows:
- A large digital clock
- Current date
- Day of the week
- Weather information
- Weather icon
To improve performance, only the parts of the screen that have changed are redrawn. This significantly reduces unnecessary screen updates and provides a smoother user experience.
The display brightness is automatically adjusted depending on the time of day. During daylight hours the backlight is set to full brightness, while at night it is dimmed to make the display more comfortable to read and to reduce power consumption.
Overall, this project demonstrates the integration of Wi-Fi communication, REST API requests, JSON parsing, NTP time synchronization, graphical display control, and automatic hardware management, resulting in a fully functional smart weather station.