This post is a quick write up of me following the instructions provided by G6EJD on how to do OTA firmware from inside Arduino IDE.
His instruction video can be found at the link below:
Here is the link to his GitHub page for this project: https://github.com/G6EJD/ESP32-OTA-Example
The Arduino Sketch
Two files are needed for this: "ESP32_Basic_OTA.ino", and "credentials.h".
Note, be sure to change the said and password to that of your wifi network.
Compile and upload the sketch to your ESP32 via the USB to serial link like you usually do with your other ESP32 projects. There is no need to burn special OTA bootloader to the ESP32 module before the upload.
Below is the output from the message window of the Arduino IDE.
After the upload is completed, the built-in LED of the ESP32 module starts flashing almost immediately.
Below is the output of the Serial Monitor.
At the end of the output message, you could see the IP address assigned to the ESP32 module by your WiFi Router.
Restart your Arduino IDE, then go to "Tools" -> "Port". A new option is now available for you to upload firmware from the Arduino IDE to the ESP32 module via the wireless network.
Testing the OTA capability
1. Unplug ESP32 from your computer and plug it to a phone charger to provide power to the ESP32.
2. In the Arduino sketch, change the delay time from 100 to 1000 as highlighted below.
3. Select the network port as the communication interface between the Arduino IDE and the ESP32 module.
4. Compile and upload the firmware to the ESP32 module.
Be sure to allow "espota.exe" to access the network if it's blocked by Windows firewall.
If all goes well, the new firmware will be uploaded to the ESP32 module wirelessly and the flashing of the LED will slow down after the upload is completed.
Tech Note 082 - ESP32 Over-the-Air (OTA) Updating
An example of using the OTA function of the ESP32