ArduinoOTA ESP32: Wi-Fi (OTA) Wireless Update from the Arduino IDE

esp32 geekcreit wroom

The ArduinoOTA library for wireless updates (OTA) in Wi-Fi is also compatible with ESP32266, the ESP32266’s more powerful successor. It is integrated into the Arduino Core for ESP32 developed by Espressif (GitHub page of the project). It is not yet possible to install the development kit from the card manager. Since the SDK is still in development, the installation process depends on the machine on which the Arduino IDE is installed. It is now possible to use the password hash to further secure the remote update. Another novelty, it is now possible to update in Wi-Fi the SPIFFS memory area.

Install the ArduinoOTA library for ESP32 on the Arduino IDE

Before starting the installation, exit the Arduino IDE. Then, to install the development kit on your MacOS, Windows, Linux or Raspberry Pi, follow this previous tutorial. Once the SDK is installed, you can restart the IDE.

If everything went smoothly, you must have new ESP32 cards

esp32 board cartes ide arduino windows 10 64-bits

In the current version, the kit supports generic cards (ESP32 Dev Module up to 4MB), and several manufacturers’ cards known as the new Wemos LoLin32 presented recently.

Flash memory USB-Serial
SparkFun ESP32 Thing SparkFun ESP32 Thing 4MB
Electronic SweetPeas - ESP320 Electronic SweetPeas – ESP320 16MB ?
Nano32 de MakerAsia 4MB
wemos lolin32 WEMOS LoLin32 4MB
espea32 esp32 ESPea32 available on Tindie 4MB CP2104
Noduino Quantum esp32 Noduino Quantum 16MB CP2102
node32s esp32 development board Node32s 4MB
Hornbill ESP32 Dev Hornbill ESP32 Dev 4MB
hornbill esp32 minima Hornbill ESP32 Minima 4MB
FireBeetle-ESP32 4MB
IntoRobot Fig 4MB

To bring up the sample menu, select your ESP32. Generic cards are very well supported by the SDK. From the menu, select the example basicOTA.

The code differs very little from that of the ESP8266 cards.

#include <WiFi.h>
#include <ESPmDNS.h>
#include <WiFiUdp.h>
#include <ArduinoOTA.h>

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

void setup() {
  WiFi.begin(ssid, password);
  while (WiFi.waitForConnectResult() != WL_CONNECTED) {
    Serial.println("Connection Failed! Rebooting...");

  // Port defaults to 3232
  // ArduinoOTA.setPort(3232);

  // Hostname defaults to esp3232-[MAC]
  ArduinoOTA.setHostname("Demo OTA ESP32");

  // No authentication by default
  // ArduinoOTA.setPassword("admin");

  // Password can be set with it's md5 value as well
  // MD5(admin) = 21232f297a57a5a743894a0e4a801fc3

  ArduinoOTA.onStart([]() {
    String type;
    if (ArduinoOTA.getCommand() == U_FLASH)
      type = "sketch";
    else // U_SPIFFS
      type = "filesystem";

    // NOTE: if updating SPIFFS this would be the place to unmount SPIFFS using SPIFFS.end()
    Serial.println("Start updating " + type);
  ArduinoOTA.onEnd([]() {
  ArduinoOTA.onProgress([](unsigned int progress, unsigned int total) {
    Serial.printf("Progress: %u%%\r", (progress / (total / 100)));
  ArduinoOTA.onError([](ota_error_t error) {
    Serial.printf("Error[%u]: ", error);
    if (error == OTA_AUTH_ERROR) Serial.println("Auth Failed");
    else if (error == OTA_BEGIN_ERROR) Serial.println("Begin Failed");
    else if (error == OTA_CONNECT_ERROR) Serial.println("Connect Failed");
    else if (error == OTA_RECEIVE_ERROR) Serial.println("Receive Failed");
    else if (error == OTA_END_ERROR) Serial.println("End Failed");
  Serial.print("IP address: ");

void loop() {

Several parameters are available:

  • SetPort: by default the communication port is 8266. It is not very useful to change it unless it is already in use. For example, for a project integrating UDP communication.
  • SetHostname: This is probably the most important option. It allows you to assign a name to the ESP32. This machine name will be broadcast over the network and retrieved by the Arduino IDE. If you have a lot of objects on your network, it will be much easier to identify it by name than by an identifier built automatically from the serial number.
  • SetPassword: used to request a password from the Arduino IDE before running an update. Practice if you work at several or in a school.
  • SetPasswordHash: allows you to store the password fingerprint for added security. See below to learn how.

There are four other ways to connect treatments in the following cases:

  • OnStart: The code to be executed when the update is started. New on the ESP32, it is possible to remotely update the files of the zone SPIFFS. This is very handy if you need to develop an HTML interface for your project.
  • OnEnd: idem at the end
  • OnProgress: during the progress
  • OnError: and on error

At the end of the setup, the wireless update support is started by calling the begin () method.

Finally, for everything to work, it is necessary to call the ArduinoOTA.handle() method in the loop().

Before reversing the program, change the ssid variables (Wi-Fi network on which the ESP32 will connect) and password (network password).

Secure the update with the hash of the password

The ESP32 is much more secure than the ESP8266 (read this article for more information), it is possible to store the hash of the password in place of it. To create your password fingerprint, you can use an online generator such as this one. For example, the hash of the admin password will give the fingerprint 21232f297a57a5a743894a0e4a801fc3.

Please note that some online generators are not recommended … Do not use the admin password!

arduinoota esp32 2 hash password md5 online generator

Then, use the setPasswordhash function instead of setPassword () to specify the authentication password.


Wireless Update Test

Upload the program and open the Terminal to verify that the ESP32 is properly connected to the Wi-Fi network.

arduinoota esp32 6 serial monitor ip address

The Arduino IDE automatically detects devices that support remote update. They are added to the list of ports in a new section called Network ports.

arduinoota esp32 1 ide arduino

It seems that version 1.8.x includes a bug that prevents the devices from updating. If your ESP does not appear a few seconds after starting the ESP, just restart the Arduino IDE.

To update the program, simply select the ESP as the port instead of the usual serial port. Then upload the program as usual. Here, as a password is required, an input window appears in the IDE. It is requested only once

arduinoota esp32 3 password authentication

The remote update (or failure) of the remote update can be tracked directly from the Arduino IDE.

arduinoota esp32 5 wireless upload update ide arduino

The SDK is still in development. During the tests, I had to enter the password twice before successfully updating.

WEMOS WiFi & Bluetooth Batterie ESP32 développement outil ESP32 batterie esp8266 ESP WROOM 32 ESP32

Price: 8.92
as of 17 October 2019 3 h 02 min  
Buy Now
Wait For A Price Drop

Price History


Current Price €8.92 17 October 2019
Highest Price €9.48 22 May 2019
Lowest Price €8.29 16 January 2019
Since 22 October 2018

Last price changes

€8.92 27 July 2019
€9.48 22 May 2019
€9.46 10 March 2019
€8.81 18 February 2019
€8.87 10 February 2019

Subscribe to the weekly newsletter

No spam and no other use will be made of your email. You can unsubscribe anytime.

1 Comment
  1. Hi, Can you please share how the ESP32 is wired up and connected, thanks

Leave a Reply

DIY Projects
%d bloggers like this: