Over-the-Air Programming (OTA) includes different methods of software, settings distribution and not limited to development board but includes the consumer devices such as smartphones, set-top boxes. With Over-the-Air Programming (OTA), from one central console we can send an update to all the devices. Related terminologies are over-the-air service provisioning (OTASP), over-the-air provisioning (OTAP), over-the-air parameter administration (OTAPA).
Over-the-Air Programming mechanism allows a device to update itself over WiFi or Bluetooth. OTA requires configuring the Partition Table of the device with minimum two OTA app slot partitions and one OTA Data Partition. OTA process writes new firmware image to OTA app slot is not in use for boot. In next step, the OTA Data partition is updated for the next boot.
Over-the-Air Programming (OTA) on ESP32 Arduino
OTA may be done using Arduino IDE, Web Browser or HTTP Server. Classic OTA supports platform package that provides first OTA implementation. This configuration is described below. ArduinoOTA provides support for ArduinoOTA library and upload via Arduino IDE.
---
Over-the-air updates can be used to upload new code to ESP32 board configured to be used with Arduino IDE. The OTA updater essentially creates a web server to upload new code to ESP32 board via web browser to local network.
ArduinoOTA library is added on ESP32 Arduino IDE, we need to go to File > Examples >ArduinoOTA> OTAWebUpdater to get the example code.
After changing the Wi-Fi network credentials, we can upload the code to ESP32 board and open the Serial Monitor, press the ESP32 enable button and get the IP address or ESP32. Next we will open the IP on web browser, which will be a password protected webpage. The username and password are on the code (default is admin, admin). After login, we will get a webpage which will allow us to upload a new code to your ESP32 as .bin
file.
We can add the new code to the OTAWebUpdater code. To generate the required .bin
file from sketch, we need to go to Arduino IDE’s Sketch > Export compiled Binary. A new folder with sketch and the .bin
file will be be created. (We can get the folder from Arduino IDE’s Sketch > Show Sketch Folder menu). Next is uploading of the .bin
file via the web page we opened on previous step.