📅 16 Mei 2026  |  ⏱ 5 menit baca

📡 OTA Update ESP32 — Update Firmware Jarak Jauh

ESP32OTAUpdateWireless

OTA (Over-The-Air) update memungkinkan Anda update firmware ESP32 tanpa kabel USB. Cukup dari web browser, dari mana saja selama ESP32 terhubung ke internet.

Kenapa Perlu OTA?

Persiapan OTA

Pertama, upload firmware dasar yang sudah include OTA. Lakukan ini via USB sekali saja:

#include <WiFi.h> #include <ArduinoOTA.h> const char* ssid = "NAMA_WIFI_ANDA"; const char* password = "PASSWORD_WIFI_ANDA"; void setup() { WiFi.begin(ssid, password); ArduinoOTA.begin(); // Mulai service OTA } void loop() { ArduinoOTA.handle(); // Wajib dipanggil terus }

Cara Update via Arduino IDE

Cara Update via Web Browser (lebih mudah!)

Tambahkan kode ini untuk OTA via browser:

#include <WebServer.h> #include <Update.h> WebServer server(80); server.on("/update", HTTP_POST, [](){ Update.hasError() ? server.send(500, "text/plain", "FAIL") : server.send(200, "text/plain", "OK"); }, [](){ HTTPUpload& upload = server.upload(); if(upload.status == UPLOAD_FILE_START) Update.begin(UPDATE_SIZE_UNKNOWN); else if(upload.status == UPLOAD_FILE_WRITE) Update.write(upload.buf, upload.currentSize); else if(upload.status == UPLOAD_FILE_END) Update.end(true); });

Setelah itu, buka browser ke http://[IP-ESP32]/update, upload file .bin, dan ESP32 akan restart dengan firmware baru.

💡 Chat AIoT akan segera menambahkan fitur OTA built-in. ESP32 Anda bisa diupdate langsung dari dashboard Chat AIoT tanpa perlu tahu IP address!