Build a Weather Globe That Checks the Sky for You!
Meet Gale — an ESP32-powered globe that connects to WiFi, downloads real live weather data, and smoothly rotates a servo-powered arrow to point at Sunny, Cloudy, Rainy, or Stormy — while a bright OLED screen shows the exact temperature.
🌤️ Say hi to Gale, your WiFi weather globe!
What Is a WiFi Weather Globe, Anyway?
Gale is an IoT (Internet of Things) project — a device that connects to the internet to do something useful in the real world. Using its built-in WiFi, the ESP32 microcontroller downloads live weather data from a weather service, figures out if it's sunny, cloudy, rainy, or stormy, and moves a servo-powered arrow to point at the matching symbol while showing the exact temperature on a small screen.
What You'll Need
Gather these parts before you start building Gale!
ESP32 Development Board
Has built-in WiFi to download live weather data.
SG90 Micro Servo
Rotates the weather arrow to the correct symbol.
0.96" I2C OLED Display
Shows the live temperature and weather condition.
Small Buzzer (optional)
Sounds a short alert if a thunderstorm is detected.
Clear Plastic or Glass Globe/Dome
Houses the arrow and weather symbols.
Printed Weather Symbols
Sun, cloud, rain, and storm icons arranged in a circle.
Breadboard
For connecting everything without soldering.
Free OpenWeatherMap API Key
Lets your ESP32 request real weather data online.
Jumper Wires
Male-to-male and male-to-female.
The Circuit Diagram
The OLED, servo, and buzzer connect to the ESP32's GPIO pins — WiFi itself needs no extra wiring, since it's built into the board.
Step-by-Step Build Instructions
Ask an adult to help you sign up for a free weather API key. Let's build Gale!
Get a free weather API key
Sign up for a free account at OpenWeatherMap.org and copy your personal API key — you'll need to paste it into the code.
💡 Tip: New API keys can take up to an hour to activate, so grab yours early before you start testing!Wire the OLED, servo, and buzzer
Connect the OLED's SDA and SCL to GPIO 21 and 22, the servo's signal wire to GPIO 13, and the buzzer to GPIO 12, exactly as shown in the circuit diagram.
Build the weather symbol ring
Print or draw sun, cloud, rain, and storm symbols and arrange them evenly in a circle around where the arrow will point, inside your clear globe or dome.
Mount the arrow on the servo
Attach a light arrow shape to the servo horn, positioned at the center of your weather symbol ring.
Install the libraries
In the Arduino IDE, install ESP32Servo, ArduinoJson, Adafruit_SSD1306, and Adafruit_GFX from the Library Manager.
Update the code with your details
Edit the code below with your WiFi name, WiFi password, API key, and city name, then upload it to your ESP32.
Watch Gale check the weather!
Once connected, the OLED will show the temperature and condition, and the arrow will smoothly rotate to point at today's weather.
The ESP32 Code
This code needs the ESP32Servo, ArduinoJson, and Adafruit_SSD1306 libraries. Fill in your WiFi details and API key, then click Upload.
// 🌦️🤖 Gale the WiFi Weather Globe — ESP32 Robotics Project // Downloads live weather data and points a servo arrow at Sunny, Cloudy, Rainy, or Stormy #include <WiFi.h> #include <HTTPClient.h> #include <ArduinoJson.h> #include <ESP32Servo.h> #include <Wire.h> #include <Adafruit_GFX.h> #include <Adafruit_SSD1306.h> // ---- Fill in your own details here ---- const char* ssid = "YOUR_WIFI_NAME"; const char* password = "YOUR_WIFI_PASSWORD"; String apiKey = "YOUR_OPENWEATHERMAP_API_KEY"; String city = "London"; Servo weatherArrow; const int servoPin = 13; const int buzzerPin = 12; Adafruit_SSD1306 display(128, 64, &Wire, -1); unsigned long lastUpdate = 0; const unsigned long updateInterval = 600000; // check every 10 minutes void setup() { Serial.begin(115200); weatherArrow.attach(servoPin); pinMode(buzzerPin, OUTPUT); display.begin(SSD1306_SWITCHCAPVCC, 0x3C); showMessage("Connecting WiFi..."); WiFi.begin(ssid, password); while (WiFi.status() != WL_CONNECTED) { delay(500); } showMessage("WiFi Connected!"); delay(1000); fetchWeather(); // get the weather immediately on startup } void loop() { if (millis() - lastUpdate > updateInterval) { fetchWeather(); lastUpdate = millis(); } } // Downloads the latest weather and updates the arrow + display void fetchWeather() { if (WiFi.status() != WL_CONNECTED) return; HTTPClient http; String url = "http://api.openweathermap.org/data/2.5/weather?q=" + city + "&appid=" + apiKey + "&units=metric"; http.begin(url); int httpCode = http.GET(); if (httpCode == 200) { String payload = http.getString(); StaticJsonDocument<1024> doc; deserializeJson(doc, payload); float temperature = doc["main"]["temp"]; String condition = doc["weather"][0]["main"].as<String>(); moveArrowToCondition(condition); showWeather(temperature, condition); if (condition == "Thunderstorm") { tone(buzzerPin, 1000, 500); } } else { showMessage("Weather fetch failed"); } http.end(); } // Rotates the arrow servo to match the current weather condition void moveArrowToCondition(String condition) { int angle = 90; // default middle position if (condition == "Clear") angle = 0; else if (condition == "Clouds") angle = 60; else if (condition == "Rain" || condition == "Drizzle") angle = 120; else if (condition == "Thunderstorm") angle = 180; weatherArrow.write(angle); } // Shows the temperature and condition on the OLED void showWeather(float temp, String condition) { display.clearDisplay(); display.setTextSize(2); display.setTextColor(SSD1306_WHITE); display.setCursor(0, 10); display.print(temp, 1); display.println(" C"); display.setTextSize(1); display.setCursor(0, 40); display.println(condition); display.display(); } // Shows a short status message on the OLED void showMessage(String msg) { display.clearDisplay(); display.setTextSize(1); display.setTextColor(SSD1306_WHITE); display.setCursor(0, 25); display.println(msg); display.display(); }
How Does Gale Actually Work?
Here are the big ideas hiding inside this project:
Making a Web Request
HTTPClient lets the ESP32 act like a tiny web browser, requesting a page of weather data from the internet and reading back the response.
Parsing JSON
Weather services send data in a format called JSON — ArduinoJson unpacks that text into values your code can actually use, like doc["main"]["temp"].
Checking on a Timer
Using millis() instead of delay() lets Gale check the weather every 10 minutes without freezing or blocking anything else in the meantime.
Turning Words into Angles
moveArrowToCondition() matches text like "Rain" to a specific servo angle — a simple but powerful way to turn data into physical motion.
🧑🔬 Safety First!
- Build with an adult, especially when setting up WiFi credentials and API keys.
- Never share your WiFi password or API key publicly, including in photos of your code.
- Keep fingers clear of the servo arrow while it's moving.
- This project simply displays weather information — never rely on it alone for real safety decisions during severe weather.
Frequently Asked Questions
Why do I need ESP32Servo instead of the regular Servo library?
The ESP32 handles timing signals differently from a classic Arduino, so the standard Servo library doesn't work reliably on it — ESP32Servo is a version built specifically to work correctly on ESP32 boards.
My display shows "Weather fetch failed" — what's wrong?
Double-check your WiFi name and password, confirm your API key has finished activating (this can take up to an hour), and make sure your city name is spelled correctly.
Can I add more weather conditions?
Yes! Add more else if checks in moveArrowToCondition() for conditions like "Snow" or "Mist", and add a matching symbol and servo angle for each.
What age group is this project good for?
This project is great for kids around age 10+ working with an adult, especially as an introduction to WiFi, web requests, and real-world data.

Comments
Post a Comment