Comments on: ESP32 TFT with LVGL: Weather Station (Description, Temperature, Humidity) https://randomnerdtutorials.com/esp32-tft-lvgl-weather-station/ Learn ESP8266, ESP32, Arduino, and Raspberry Pi Wed, 03 Dec 2025 15:19:35 +0000 hourly 1 https://wordpress.org/?v=6.8.5 By: Sara Santos https://randomnerdtutorials.com/esp32-tft-lvgl-weather-station/#comment-1130657 Wed, 03 Dec 2025 15:19:35 +0000 https://randomnerdtutorials.com/?p=162168#comment-1130657 In reply to Ton.

Hi.
To change the background color, you can use the lv_obj_set_style_bg_color() function.
To change the text color, you can use: lv_obj_set_style_text_color().

See an usage example of those functions here: https://docs.lvgl.io/9.4/examples.html#a-very-simple-hello-world-label

I hope this helps.

Regards,
Sara

]]>
By: Ton https://randomnerdtutorials.com/esp32-tft-lvgl-weather-station/#comment-1129391 Sun, 30 Nov 2025 19:08:48 +0000 https://randomnerdtutorials.com/?p=162168#comment-1129391 Hello, I would like to have the background black instead of white and the characters white, can this be adjusted in the code?

]]>
By: Sara Santos https://randomnerdtutorials.com/esp32-tft-lvgl-weather-station/#comment-1111349 Sun, 19 Oct 2025 09:50:01 +0000 https://randomnerdtutorials.com/?p=162168#comment-1111349 In reply to sid.

Hi.
What is exactly the error that you’re getting?
Regards,
Sara

]]>
By: sid https://randomnerdtutorials.com/esp32-tft-lvgl-weather-station/#comment-1110775 Fri, 17 Oct 2025 18:38:28 +0000 https://randomnerdtutorials.com/?p=162168#comment-1110775 Hey Sara,

I am getting an error for HTTPClient library. Can you please tell me which library I should add?

]]>
By: Sara Santos https://randomnerdtutorials.com/esp32-tft-lvgl-weather-station/#comment-1103642 Tue, 30 Sep 2025 10:26:55 +0000 https://randomnerdtutorials.com/?p=162168#comment-1103642 In reply to Hi-Z.

Hi.
That’s great.
Thank you for the suggestions.
Regards,
Sara

]]>
By: Hi-Z https://randomnerdtutorials.com/esp32-tft-lvgl-weather-station/#comment-1103018 Sun, 28 Sep 2025 18:23:54 +0000 https://randomnerdtutorials.com/?p=162168#comment-1103018 Great little project to play around with. No major issues in adapting it to my 3.5″ 480×320 screen and lots of fun learning how to reposition items in LVGL and adding additional weather items. I included some suggestions/improvements for consideration below:

// set timezone based on location (will also auto-correct for daylight savings)
String timezone = “auto”;

// Automatically darken (invert) the display at night:
// Add to Declaring other Variables
TFT_eSPI tft = TFT_eSPI();
// Add to loop()
if(is_day==1) {
tft.invertDisplay( false ); // day
} else {
tft.invertDisplay( true ); // night
}

]]>
By: Brad Sheppard https://randomnerdtutorials.com/esp32-tft-lvgl-weather-station/#comment-1097601 Mon, 15 Sep 2025 19:24:20 +0000 https://randomnerdtutorials.com/?p=162168#comment-1097601 In reply to Mark Edwards.

Hey Mark,

You say “Later in the code:….” and then you add in the info for cardinal directions. Where abouts in the code?

]]>
By: Mark Edwards https://randomnerdtutorials.com/esp32-tft-lvgl-weather-station/#comment-1076338 Wed, 30 Jul 2025 16:44:34 +0000 https://randomnerdtutorials.com/?p=162168#comment-1076338 In reply to Carlos.

Here is a code extract – let me know if you need more information.

void get_weather_data() {
if (WiFi.status() == WL_CONNECTED) {
HTTPClient http;
// Construct the API endpoint
String url = String(“http://api.open-meteo.com/v1/forecast?latitude=” + latitude + “&longitude=” + longitude + “&current=temperature_2m,relative_humidity_2m,is_day,precipitation,rain,weather_code,wind_speed_10m,wind_direction_10m” + temperature_unit + “&timezone=” + timezone + “&forecast_days=1”);
// Added wind speed and direction to API call.

later in the code:

//******************************
wind_speed = String(doc[“current”][“wind_speed_10m”]);
wind_len = wind_speed.length();
if (wind_len > 4) {
wind_speed = wind_speed.substring(0,4);
}

wind_direction = String(doc["current"]["wind_direction_10m"]);
wind_angle = wind_direction.toInt();
if ((wind_angle > 337.5)||(wind_angle <= 22.5)) {wind_cardinal =" N";}
if ((wind_angle > 22.5)&&(wind_angle <= 67.5)) {wind_cardinal =" NE";}
if ((wind_angle > 67.5)&&(wind_angle <= 112.5)) {wind_cardinal =" E";}
if ((wind_angle > 112.5)&&(wind_angle <= 157.5)) {wind_cardinal =" SE";}
if ((wind_angle > 157.5)&&(wind_angle <= 202.5)) {wind_cardinal =" S";}
if ((wind_angle > 202.5)&&(wind_angle <= 247.5)) {wind_cardinal =" SW";}
if ((wind_angle > 247.5)&&(wind_angle <= 292.5)) {wind_cardinal =" W";}
if ((wind_angle > 292.5)&&(wind_angle <= 337.5)) {wind_cardinal =" NW";}

//then I just added these to the display code
in void lv_create_main_gui(void) I added:
//********************************
text_label_wind_speed = lv_label_create(lv_screen_active());
lv_label_set_text(text_label_wind_speed, String(” ” + wind_speed + “km”).c_str());
lv_obj_align(text_label_wind_speed, LV_ALIGN_CENTER, 60, -17);
lv_obj_set_style_text_font((lv_obj_t*) text_label_wind_speed, &lv_font_montserrat_22, 0);

And finally added the following to static void timer_cb(lv_timer_t * timer){

lv_label_set_text(text_label_wind_speed, String(" " + wind_speed + " km" + wind_cardinal).c_str());

]]>
By: Carlos https://randomnerdtutorials.com/esp32-tft-lvgl-weather-station/#comment-1075957 Tue, 29 Jul 2025 13:44:31 +0000 https://randomnerdtutorials.com/?p=162168#comment-1075957 In reply to Mark Edwards.

Hi Mark, I made some changes on mine as well but would be interested in adding wind, any chance you can share your source code with me? Thank you.

]]>
By: Luis https://randomnerdtutorials.com/esp32-tft-lvgl-weather-station/#comment-1022979 Fri, 04 Apr 2025 04:09:36 +0000 https://randomnerdtutorials.com/?p=162168#comment-1022979 The Interrupt PIN selected (GPIO 36) for T_IRQ is not a good choice. It will behave unreliably because only TOUCH pins are mapped to the ESP32 hardware MUX. You should select from available TOUCH0 to 9 inputs, respectively GPIO # 4,0,2,15,13,12,14,27,33,32

]]>