Home | Difficulty level | Advanced | ArduinoOTA ESP32: Wi-Fi (OTA) Wireless Update from the Arduino IDE

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.

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.36
as of 10 September 2017 23 h 58 min  
Buy This Item
aliexpress.com
Wait For A Price Drop
You will receive a notification when the price drops.

Price History

Statistics

Current Price €8.36 10 September 2017
Highest Price €8.36 10 September 2017
Lowest Price €8.36 10 September 2017
Since 10 September 2017

Last price changes

€8.36 10 September 2017