ESP8266/ESP32 AsyncElegantOTA Wi-Fi OTA

It's always troublesome to update firmware for your IoT projects? Tried Arduino BasicOTA examples, but never get it to work? Then you must try AsyncElegantOTA! It's very easy to use and I've succeed the first time I try it. 



For those of you do not have time to watch it all, here is the video timeline for your quick reference.

Video Timeline:

00:13 Tutorial summary 00:53 What's OTA & Why 01:25 Tutorial begin 01:36 Install AsyncElegantOTA library 02:32 Download ESPAsyncWebServer & ESPAsyncTCP 02:57 Ensure Arduino board is capable of OTA 03:41 Where to place downloaded libraries 04:09 Open sample AsyncElegantOTA sketch 04:52 Upload sketch 05:05 Open serial monitor to see ESP8266 IP address 05:36 Access to ESP8266 from browser 06:10 Update ESP8266 firmware from browser 06:31 Where to find .bin file in VS Code 06:54 How to create .bin file in Arduino IDE 08:16 OTA update ESP8266 firmware 09:01 Next video tutorial - How to combine ESP8266 project with AsyncElegantOTA library


Library URL:

References:

 Direct Download URL:


中文版~

ESP8266/ESP32 AsyncElegantOTA Wi-Fi 更新韌體 (OTA)

IoT 專案更新韌體很麻煩? Arduino BasicOTA 一直無法試成功? 今天來分享一下, 使用 AsyncElegantOTA, 真是太好用了!


沒時間看完全部影片的朋友, 可以由下列時間軸來快速翻閱!
00:13 影片大綱 00:53 什麼是 OTA & 為什麼需要 OTA 01:25 教學開始 01:36 安裝 AsyncElegantOTA 程式庫 02:32 下載 ESPAsyncWebServer & ESPAsyncTCP 程式庫 02:57 確認 Arduino 板子能做 OTA 03:41 下載程式庫安裝位置 04:09 打開 AsyncElegantOTA 示範程式 04:52 上傳程式到 ESP8266 05:05 打開 serial monitor 查詢 ESP8266 IP 地址 05:36 由流覽器連到 ESP8266 06:10 由流覽器更新 ESP8266 韌體 06:31 使用 VS Code - .bin 在什麼目錄 06:54 使用 Arduino IDE - .bin 如何產生 08:16 OTA 更新 ESP8266 韌體 09:01 下集預告 - 如何把 ESP8266 專案加上 AsyncElegantOTA library

ESP8266 Sample Code:


#include <ESP8266WiFi.h>
#include <ESPAsyncTCP.h>
#include <ESPAsyncWebServer.h>
#include <AsyncElegantOTA.h>

const char* ssid = "........";
const char* password = "........";

AsyncWebServer server(80);


void setup(void) {
  Serial.begin(115200);
  WiFi.mode(WIFI_STA);
  WiFi.begin(ssid, password);
  Serial.println("");

  // Wait for connection
  while (WiFi.status() != WL_CONNECTED) {
    delay(500);
    Serial.print(".");
  }
  Serial.println("");
  Serial.print("Connected to ");
  Serial.println(ssid);
  Serial.print("IP address: ");
  Serial.println(WiFi.localIP());

  server.on("/", HTTP_GET, [](AsyncWebServerRequest *request) {
    request->send(200, "text/plain", "Hi! I am ESP8266.");
  });

  AsyncElegantOTA.begin(&server);    // Start ElegantOTA
  server.begin();
  Serial.println("HTTP server started");
}

void loop(void) {
}



ESP32 Sample Code:

#include <WiFi.h>
#include <AsyncTCP.h>
#include <ESPAsyncWebServer.h>
#include <AsyncElegantOTA.h>

const char* ssid = "........";
const char* password = "........";

AsyncWebServer server(80);


void setup(void) {
  Serial.begin(115200);
  WiFi.mode(WIFI_STA);
  WiFi.begin(ssid, password);
  Serial.println("");

  // Wait for connection
  while (WiFi.status() != WL_CONNECTED) {
    delay(500);
    Serial.print(".");
  }
  Serial.println("");
  Serial.print("Connected to ");
  Serial.println(ssid);
  Serial.print("IP address: ");
  Serial.println(WiFi.localIP());

  server.on("/", HTTP_GET, [](AsyncWebServerRequest *request) {
    request->send(200, "text/plain", "Hi! I am ESP32.");
  });

  AsyncElegantOTA.begin(&server);    // Start ElegantOTA
  server.begin();
  Serial.println("HTTP server started");
}

void loop(void) {
}


Comments

Popular posts from this blog

Arduino - DFPlayer Mini MP3 Module

Android control color RGB LED using HC-05 Bluetooth with Arduino (Part I)

Arduino #27 AsyncWifimanager ElegantOTA ESP32 (WiFi Password Mgnt. + WiFi Firmware Update)