ESP32 BASICS · LESSON 20
Project: A Wi-Fi Weather Display
Putting it together: Wi-Fi, an HTTP request, and a small display in one finished build.
This project pulls several earlier lessons together: connecting to Wi-Fi, making an HTTP request, and showing the result — a small board that displays a weather figure it fetched from the internet.
weather_display.ino
#include
#include
const char* ssid = "your-network-name";
const char* password = "your-network-password";
const char* apiUrl = "http://example.local/weather"; // your own data source
void setup() {
Serial.begin(115200);
WiFi.begin(ssid, password);
while (WiFi.status() != WL_CONNECTED) delay(300);
Serial.println("Wi-Fi connected");
}
void loop() {
if (WiFi.status() == WL_CONNECTED) {
HTTPClient http;
http.begin(apiUrl);
if (http.GET() == 200) {
String reading = http.getString();
Serial.print("Latest reading: ");
Serial.println(reading); // swap this for display.print(reading) with a real screen
}
http.end();
}
delay(60000); // check once a minute
}
Taking it further
- Swap the
Serial.printlnline for calls into a small display library once a screen is wired up over I2C or SPI. - Add deep sleep between checks if the project will run on a battery.
- Point
apiUrlat any service that returns a simple reading — a weather feed, a home sensor, or a value from your own small web server.
KEY IDEA
Every finished ESP32 project is the same handful of building blocks from this course, combined — nothing here needed a technique you haven't already seen.