ESP32 CYD Weather Station with LVGL: Complete DIY Project Guide

Are you looking for your next weekend electronics project that is both functional and visually impressive? Imagine building your own smart weather station that displays live local data on a vibrant, colorful touchscreen. It’s easier than you think, and it costs a fraction of a commercial device.

In this comprehensive guide, we’ll show you exactly how to transform the popular ESP32 Cheap Yellow Display (CYD) into a fully-functional weather station using the powerful LVGL graphics library. By the end, you’ll have a sleek, desk-ready gadget that shows temperature, humidity, weather conditions, and the current date—all updated automatically from the internet.

Whether you’re a seasoned maker or an enthusiastic beginner, this project is the perfect way to level up your ESP32 skills and create something truly useful.

Why Build Your Own Weather Station? The Maker’s Advantage

Before we dive into the wiring and code, let’s look at why building your own is a superior choice. Off-the-shelf weather stations can be expensive, have small, hard-to-read screens, or lock you into proprietary apps and cloud services.

Building your own with the ESP32 CYD offers incredible benefits:

  • Full Customization: You control the data source, the screen layout, and the update frequency. Want to add air pressure or wind speed later? You can.

  • Cost-Effectiveness: The entire project is built around the incredibly affordable ESP32-2432S028R board, often found for under $15.

  • No Recurring Costs: We use the free and reliable Open-Meteo API, so you don’t need a subscription.

  • A Powerful Learning Experience: You’ll gain hands-on experience with the ESP32, Wi-Fi connectivity, JSON data parsing, and professional GUI creation with LVGL.

This isn’t just following instructions; it’s about understanding the components to build something uniquely yours.

Project Showcase: What You’ll Be Building

In this project, your ESP32 CYD will transform into a dedicated weather information center. The 2.8-inch TFT touchscreen will display:

  • Current Weather Description: “Clear Sky,” “Partly Cloudy,” “Rain,” etc.

  • Temperature: In Celsius or Fahrenheit.

  • Relative Humidity:

  • Current Date:

  • Last Updated Time:

  • Intuitive Weather Icons: A custom image (sun, cloud, rain, snow, etc.) visually represents the conditions, making the display easy to read at a glance.

The data is fetched from the Open-Meteo API, a free service that requires no API key, making this project incredibly straightforward to set up.

[Image: A clear photo of the completed ESP32 CYD weather station displaying data, e.g., showing 24°C, 65% humidity, and a sun icon]

Your Essential Shopping List: Parts Required

To get started, you’ll need just a few key components. We’ve vetted these to ensure compatibility and quality.

  1. The Brain & Display: ESP32-2432S028R (The “Cheap Yellow Display” or CYD)
    This is the heart of your project. This all-in-one board combines an ESP32-WROOM-32 module with a 2.8-inch TFT touchscreen, making it ideal for IoT projects with a GUI.

  2. A USB Cable: A standard Micro-USB data cable to power and program the board.

  3. A Computer: With the Arduino IDE installed and ready to go.

That’s it! The board includes all the necessary circuitry, an RGB LED, and a microSD card slot for future expansion.

Step-by-Step Implementation: From Zero to Weather Hero

Follow these steps carefully. We’ve structured this guide to ensure success, even on your first try.

Phase 1: Prerequisites & Setup (Trust the Foundation)

Skipping these steps is the number one reason projects fail. We’ve done the hard work of configuration so you don’t have to.

  1. Install ESP32 Boards in Arduino IDE: If you haven’t already, you need to add the ESP32 board package to your Arduino IDE. This tells the software how to talk to your chip.

  2. Get to Know Your CYD: This board is incredibly popular for a reason. Familiarize yourself with its pinout and features to avoid confusion later.

  3. Install the Core Libraries (The Secret Sauce): This project relies on two critical libraries configured in a very specific way.

    • LVGL (Light and Versatile Graphics Library): This is what creates the beautiful graphical interface.

    • TFT_eSPI: This library handles the low-level communication with the display.

    • Crucial Note: Generic library installs often won’t work. You must use the specific configuration files (lv_conf.h and User_Setup.h) provided in our dedicated setup tutorial. Using the wrong configuration will result in a blank screen or compilation errors.

    • [Follow our precise CYD + LVGL library setup tutorial]

  4. Install ArduinoJson: This library will help us decode the weather data from the Open-Meteo API. Go to Sketch > Include Library > Manage Libraries, search for “ArduinoJson,” and install the version by Benoit Blanchon (we recommend version 7.0.4 for this project).

Phase 2: The Code and Customization (Your Project, Your Data)

Now for the exciting part. We’ll provide you with the complete, tested code. You just need to add your personal details.

  1. Download the Required Files:

    • The Main Code: Copy the full Arduino sketch provided below.

    • weather_images.h: This file contains all the custom icons (sun, cloud, rain) encoded for LVGL. This is essential.

      • Important: Download this file and save it in the same folder as your main .ino sketch file. Your Arduino IDE should show two tabs: one for the main code and one for weather_images.h.

  2. Copy and Personalize the Main Arduino Code:
    Copy the code below into your Arduino IDE. You’ll need to modify a few key lines for your location and Wi-Fi.

    cpp
    /*  Rui Santos & Sara Santos - Random Nerd Tutorials - https://RandomNerdTutorials.com/esp32-cyd-lvgl-weather-station/
        Full tutorial and explanation available at the URL above.
        ... [rest of the code as provided in the original article] ...
    */
  3. Insert Your Wi-Fi Credentials: Find these lines and replace the placeholders with your actual network name and password.

    cpp
    const char* ssid = "YOUR_SSID_HERE";
    const char* password = "YOUR_PASSWORD_HERE";
  4. Set Your Location: Enter the latitude and longitude for your city. You can easily find these with a quick Google search for “latitude and longitude for [your city]”.

    cpp
    String latitude = "41.14961";   // Example: Porto
    String longitude = "-8.61099";  // Example: Porto
    String location = "Porto";       // Your city name for display
    String timezone = "Europe/Lisbon"; // Find your timezone from the list in the article
  5. Choose Your Temperature Scale: By default, the code is set to Celsius. To change to Fahrenheit, simply change the #define TEMP_CELSIUS 1 line to #define TEMP_CELSIUS 0.

    cpp
    #define TEMP_CELSIUS 1 // Change to 0 for Fahrenheit

Phase 3: Uploading and Troubleshooting (Making It Work)

  1. Select Your Board and Port: In the Arduino IDE, go to Tools > Board and select ESP32 Dev Module. Then, select the correct COM port under Tools > Port.

  2. Fix the “Sketch Too Big” Error: The code and images take up a lot of space. If you get an error about the sketch being too large, you need to change the partition scheme. Go to Tools > Partition Scheme and select “Huge APP (3MB No OTA/1MB SPIFFS)” or any option with an APP size larger than 1.4MB.

  3. Upload and Watch It Come to Life: Click the upload button. After a successful upload, the display will initialize, connect to your Wi-Fi, and within a few seconds, your very own weather station will be live!

Your Next Project Awaits

Building your own ESP32 weather station is more than just a fun weekend project—it’s a statement. It’s a declaration that you prefer to build, customize, and understand the technology in your life. It’s a functional piece of tech you can be proud to display on your desk.

With the ESP32 CYD and LVGL, the possibilities are endless. From here, you could add weather forecasts, connect it to your home automation system, or even turn it into a digital photo frame.

Ready to get started? Grab your ESP32 CYD board today and follow this guide. We can’t wait to see what you build!

======================================

About ESP32S.com

Since 2016, ESP32S.com has grown to become a complete ecosystem partner for your IoT journey. Based in Shenzhen, a global hub for electronics innovation, we have helped hundreds of developers and businesses bring their ESP32-based ideas to life. Our team is dedicated to providing exceptional support and innovative solutions to help you achieve your IoT goals.
At ESP32S.com, we master the intricacies of developing an ESP32-based product, which involves multiple stages, from concept to market launch. That’s why we now offer comprehensive solutions covering the entire product lifecycle for ESP32-based devices. Whether you need help with PCB design, prototyping, production, or even marketing and fulfillment, we have you covered.

Contact Us

Ready to take your IoT project to the next level? Contact ESP32S.com today to learn more about our comprehensive solutions for ESP32-based devices. Let us be your trusted partner in bringing your innovative ideas to life. Contact us now to get started.

Table of Contents

Related Posts
Start typing to see products you are looking for.
Shopping cart
Sign in

No account yet?

Shop
Wishlist
0 items Cart
My account