GPS speedometer and clock
A bike or car speedometer that needs no wheel sensor: satellites do the measuring.
Shop by category
Shop all componentsThe M5Stack Core2 is an ESP32 with a touchscreen, battery and case already built in, so a useful gadget needs no wiring at all. This sketch fetches current weather from the free Open-Meteo API every ten minutes and shows it in large type. Tap the screen to refresh.
setInsecure() skips certificate checks; fine for public weather data, never for passwords or payments.
Tick anything you already have and the total updates.
ESP32 with touchscreen, battery and case
Alternative ESP32-S3 touchscreen board: same logic, use the maker's display library
Optional: a separate 2.4 GHz network just for your IoT devices
weather_core2.ino#include <M5Unified.h>
#include <WiFi.h>
#include <WiFiClientSecure.h>
#include <HTTPClient.h>
#include <ArduinoJson.h>
const char* SSID = "your-wifi";
const char* PASS = "your-password";
const char* URL = "https://api.open-meteo.com/v1/forecast?latitude=26.14&longitude=91.74"
"¤t=temperature_2m,relative_humidity_2m,wind_speed_10m";
unsigned long last = 0;
void show() {
WiFiClientSecure client;
client.setInsecure(); // demo only: skips certificate checks
HTTPClient http;
http.begin(client, URL);
int code = http.GET();
M5.Display.fillScreen(BLACK);
M5.Display.setCursor(10, 20);
if (code == 200) {
JsonDocument doc;
deserializeJson(doc, http.getString());
float t = doc["current"]["temperature_2m"];
int rh = doc["current"]["relative_humidity_2m"];
float w = doc["current"]["wind_speed_10m"];
M5.Display.setTextSize(4); M5.Display.printf("%.1f C\n", t);
M5.Display.setTextSize(3); M5.Display.printf("\n%d %% RH\nWind %.0f km/h", rh, w);
} else {
M5.Display.setTextSize(2); M5.Display.printf("HTTP error %d", code);
}
http.end();
last = millis();
}
void setup() {
M5.begin();
M5.Display.setTextSize(2);
M5.Display.println("Connecting...");
WiFi.begin(SSID, PASS);
while (WiFi.status() != WL_CONNECTED) delay(500);
show();
}
void loop() {
M5.update();
if (M5.Touch.getCount() > 0 || millis() - last > 600000UL) show();
delay(50);
}
Wi-Fi dropped or the time is wrong for TLS; check the connection and try again.
Use a 2.4 GHz network and check the password.
Update ArduinoJson to version 7, or use DynamicJsonDocument doc(1024) on version 6.
Not for non-commercial use within its limits.
A few hours with the screen on; lower the brightness or sleep between updates.
Add &daily=temperature_2m_max,temperature_2m_min to the URL and show the next days.
3 parts: M5Stack Core2 ESP32 IoT Development Kit w/ 2-Inch Touch Screen, Waveshare ESP32-S3 2.8-Inch Capacitive Touch Display Development Board and TP-Link TL-WR820N 300 Mbps Multi-Mode Wi-Fi Router. On this page you can tick the parts you already have and add only the rest to your cart.
No. This page has the complete, tested code (weather_core2.ino).
About ₹10,077 for the parts at the prices on this page. Quantity price breaks lower the cost when you build several.
HTTPS requests from an ESP32; Parsing JSON with ArduinoJson; Drawing text with M5Unified.
setInsecure() skips certificate checks; fine for public weather data, never for passwords or payments.
Ideas that reuse this build: 4G SMS door alarm. They are listed under Take it further on this page.
A bike or car speedometer that needs no wheel sensor: satellites do the measuring.
Records where you went every five seconds, ready to open on a map.
Two boards, two radios: press the button at the gate and it rings indoors.
Check temperature, humidity and pressure from any phone on your Wi-Fi.
Learning project. Check every circuit and the datasheet of each part before you power it up.