OPEN_ROBO_HUB ← Back to Dashboard
Module 10 // REST JSON

Wi-Fi Network Local Weather Station

Connects ESP8266 processors to remote HTTP weather APIs to parse localized temperature arrays over JSON object structures.

📋 SSD1306 Display Core Interfaces

OLED Screen Pin Data Vector ESP8266 Module Target Pin
SDA (Data Wire)<====>GPIO 4 (D2)
SCL (Clock Wire)====>GPIO 5 (D1)

💻 API JSON Extraction Firmware

#include <ESP8266WiFi.h>
#include <ESP8266HTTPClient.h>
#include <ArduinoJson.h>

const char* ssid = "WIFI_SSID";
const char* pass = "WIFI_PASSWORD";

void setup() {
  Serial.begin(115200);
  WiFi.begin(ssid, pass);
  while (WiFi.status() != WL_CONNECTED) { delay(500); }
}

void loop() {
  if (WiFi.status() == WL_CONNECTED) {
    WiFiClient client; HTTPClient http;
    http.begin(client, "http://api.openweathermap.org/data/2.5/weather?q=Mumbai,IN&APPID=YOUR_KEY&units=metric");
    if (http.GET() > 0) {
      DynamicJsonDocument doc(1024);
      deserializeJson(doc, http.getString());
      float temp = doc["main"]["temp"];
      Serial.print("Parsed Temp Metric Array: "); Serial.println(temp);
    }
    http.end();
  }
  delay(60000);
}